├── .clang-format
├── .github
├── ISSUE_TEMPLATE
│ ├── bug.yml
│ ├── config.yml
│ └── feature.yml
├── actions
│ └── publish-doxygen
│ │ └── action.yml
├── advanced-issue-labeler.yml
├── auto_assign.yml
└── workflows
│ ├── Issue-Needs-Attention.yml
│ ├── auto-assign.yml
│ ├── check-changelog.yml
│ ├── check-pr-title.yml
│ ├── cmake.yml
│ ├── conan.yml
│ ├── issue-labeler.yml
│ ├── lock-threads.yml
│ ├── no-response.yml
│ ├── publish-doxygen-on-release.yml
│ ├── swiftpm.yml
│ ├── vcpkg.yml
│ └── wipe-clusters.yml
├── .gitignore
├── .gitmodules
├── Android.bp
├── CHANGELOG.md
├── CMakeLists.txt
├── CMakePresets.json
├── Doxyfile
├── LICENSE
├── Package.swift
├── README.md
├── cmake
├── ccache.cmake
├── cmake-build-xcode.sh
├── launch-c.in
└── launch-cxx.in
├── conanfile.py
├── contributing
└── release-process.md
├── dependencies.list
├── docs
└── fix-doxygen-titles.sh
├── examples
├── Android
│ ├── README.md
│ └── RealmExample
│ │ ├── .gitignore
│ │ ├── .idea
│ │ ├── .gitignore
│ │ ├── compiler.xml
│ │ ├── deploymentTargetDropDown.xml
│ │ ├── gradle.xml
│ │ ├── misc.xml
│ │ └── vcs.xml
│ │ ├── app
│ │ ├── .gitignore
│ │ ├── build.gradle
│ │ ├── proguard-rules.pro
│ │ └── src
│ │ │ ├── androidTest
│ │ │ └── java
│ │ │ │ └── com
│ │ │ │ └── mongodb
│ │ │ │ └── realmexample
│ │ │ │ └── ExampleInstrumentedTest.kt
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── cpp
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ └── native-lib.cpp
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── mongodb
│ │ │ │ │ └── realmexample
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ │ ├── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ │ │ ├── layout
│ │ │ │ └── activity_main.xml
│ │ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.webp
│ │ │ │ └── ic_launcher_round.webp
│ │ │ │ ├── values-night
│ │ │ │ └── themes.xml
│ │ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── themes.xml
│ │ │ │ └── xml
│ │ │ │ ├── backup_rules.xml
│ │ │ │ └── data_extraction_rules.xml
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── mongodb
│ │ │ └── realmexample
│ │ │ └── ExampleUnitTest.kt
│ │ ├── build.gradle
│ │ ├── gradle.properties
│ │ ├── gradle
│ │ └── wrapper
│ │ │ ├── gradle-wrapper.jar
│ │ │ └── gradle-wrapper.properties
│ │ ├── gradlew
│ │ ├── gradlew.bat
│ │ └── settings.gradle
├── Qt
│ └── coffee
│ │ ├── ApplicationFlow.qml
│ │ ├── ApplicationFlowForm.ui.qml
│ │ ├── Brewing.qml
│ │ ├── BrewingForm.ui.qml
│ │ ├── CMakeLists.txt
│ │ ├── ChoosingCoffee.ui.qml
│ │ ├── CoffeeButton.qml
│ │ ├── Cup.qml
│ │ ├── CupForm.ui.qml
│ │ ├── EmptyCup.qml
│ │ ├── EmptyCupForm.ui.qml
│ │ ├── LICENSE.txt
│ │ ├── NavigationButton.ui.qml
│ │ ├── README.md
│ │ ├── SideBar.qml
│ │ ├── assets
│ │ ├── coffee.gif
│ │ └── setup.png
│ │ ├── coffee.qdoc
│ │ ├── coffee_manager.cpp
│ │ ├── coffee_manager.hpp
│ │ ├── images
│ │ ├── cup structure
│ │ │ ├── coffee_cup_large.png
│ │ │ ├── coffee_cup_outline.png
│ │ │ ├── cup elements
│ │ │ │ ├── coffee_cup_back.png
│ │ │ │ ├── coffee_cup_coverplate.png
│ │ │ │ └── coffee_cup_front.png
│ │ │ └── liquids
│ │ │ │ ├── liquid_coffee.png
│ │ │ │ ├── liquid_foam.png
│ │ │ │ └── liquid_milk.png
│ │ ├── icons
│ │ │ ├── coffees
│ │ │ │ ├── Americano.png
│ │ │ │ ├── Espresso.png
│ │ │ │ ├── Latte.png
│ │ │ │ ├── Macchiato.png
│ │ │ │ └── cappucino.png
│ │ │ └── contents
│ │ │ │ ├── coffee.png
│ │ │ │ ├── milk.png
│ │ │ │ └── sugar.png
│ │ └── ui controls
│ │ │ ├── buttons
│ │ │ ├── back
│ │ │ │ └── white.png
│ │ │ └── go
│ │ │ │ └── white.png
│ │ │ └── line.png
│ │ ├── imports
│ │ └── Coffee
│ │ │ ├── Constants.qml
│ │ │ ├── TitilliumWeb-Regular.ttf
│ │ │ └── qmldir
│ │ ├── main.cpp
│ │ ├── main.qml
│ │ ├── qml.qrc
│ │ ├── qt_attribution.json
│ │ ├── qtquickcontrols2.conf
│ │ └── realm_models.hpp
├── SPM
│ ├── .gitignore
│ ├── Package.swift
│ ├── README.md
│ └── Sources
│ │ └── RealmCppExample
│ │ └── main.cpp
└── cmake
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── helloworld.cpp
│ └── vcpkg.json
├── include
└── cpprealm
│ ├── accessors.hpp
│ ├── analytics.hpp
│ ├── app.hpp
│ ├── bson.hpp
│ ├── client_reset.hpp
│ ├── db.hpp
│ ├── flex_sync.hpp
│ ├── internal
│ ├── bridge
│ │ ├── async_open_task.hpp
│ │ ├── binary.hpp
│ │ ├── col_key.hpp
│ │ ├── decimal128.hpp
│ │ ├── dictionary.hpp
│ │ ├── list.hpp
│ │ ├── lnklst.hpp
│ │ ├── mixed.hpp
│ │ ├── obj.hpp
│ │ ├── obj_key.hpp
│ │ ├── object.hpp
│ │ ├── object_id.hpp
│ │ ├── object_schema.hpp
│ │ ├── property.hpp
│ │ ├── query.hpp
│ │ ├── realm.hpp
│ │ ├── results.hpp
│ │ ├── schema.hpp
│ │ ├── set.hpp
│ │ ├── status.hpp
│ │ ├── sync_error.hpp
│ │ ├── sync_manager.hpp
│ │ ├── sync_session.hpp
│ │ ├── table.hpp
│ │ ├── thread_safe_reference.hpp
│ │ ├── timestamp.hpp
│ │ ├── utils.hpp
│ │ └── uuid.hpp
│ ├── networking
│ │ ├── shims.hpp
│ │ └── utils.hpp
│ ├── scheduler
│ │ └── realm_core_scheduler.hpp
│ └── type_info.hpp
│ ├── link.hpp
│ ├── logger.hpp
│ ├── macros.hpp
│ ├── managed_binary.hpp
│ ├── managed_decimal.hpp
│ ├── managed_dictionary.hpp
│ ├── managed_list.hpp
│ ├── managed_mixed.hpp
│ ├── managed_numeric.hpp
│ ├── managed_objectid.hpp
│ ├── managed_primary_key.hpp
│ ├── managed_set.hpp
│ ├── managed_string.hpp
│ ├── managed_timestamp.hpp
│ ├── managed_uuid.hpp
│ ├── networking
│ ├── http.hpp
│ └── websocket.hpp
│ ├── notifications.hpp
│ ├── observation.hpp
│ ├── rbool.hpp
│ ├── results.hpp
│ ├── scheduler.hpp
│ ├── schedulers
│ └── default_scheduler.hpp
│ ├── schema.hpp
│ ├── sdk.hpp
│ ├── thread_safe_reference.hpp
│ └── types.hpp
├── logo.png
├── ports
├── portfile.cmake
├── usage
└── vcpkg.json
├── src
├── CMakeLists.txt
├── cpprealm
│ ├── analytics.cpp
│ ├── app.cpp
│ ├── bson.cpp
│ ├── client_reset.cpp
│ ├── db.cpp
│ ├── flex_sync.cpp
│ ├── internal
│ │ ├── bridge
│ │ │ ├── async_open_task.cpp
│ │ │ ├── binary.cpp
│ │ │ ├── bridge_types.hpp.in
│ │ │ ├── col_key.cpp
│ │ │ ├── decimal128.cpp
│ │ │ ├── dictionary.cpp
│ │ │ ├── generator
│ │ │ │ ├── CMakeLists.txt
│ │ │ │ ├── bridge_type_info_generator.cpp.in
│ │ │ │ └── bridge_type_info_parser.cmake
│ │ │ ├── list.cpp
│ │ │ ├── lnklst.cpp
│ │ │ ├── mixed.cpp
│ │ │ ├── obj.cpp
│ │ │ ├── obj_key.cpp
│ │ │ ├── object.cpp
│ │ │ ├── object_id.cpp
│ │ │ ├── object_schema.cpp
│ │ │ ├── property.cpp
│ │ │ ├── query.cpp
│ │ │ ├── realm.cpp
│ │ │ ├── results.cpp
│ │ │ ├── schema.cpp
│ │ │ ├── set.cpp
│ │ │ ├── status.cpp
│ │ │ ├── sync_error.cpp
│ │ │ ├── sync_manager.cpp
│ │ │ ├── sync_session.cpp
│ │ │ ├── table.cpp
│ │ │ ├── thread_safe_reference.cpp
│ │ │ ├── timestamp.cpp
│ │ │ └── uuid.cpp
│ │ ├── networking
│ │ │ ├── network_transport.cpp
│ │ │ ├── shims.cpp
│ │ │ └── utils.cpp
│ │ ├── scheduler
│ │ │ └── realm_core_scheduler.cpp
│ │ └── version_numbers.hpp.in
│ ├── logger.cpp
│ ├── managed_binary.cpp
│ ├── managed_decimal.cpp
│ ├── managed_numeric.cpp
│ ├── managed_objectid.cpp
│ ├── managed_primary_key.cpp
│ ├── managed_string.cpp
│ ├── managed_timestamp.cpp
│ ├── managed_uuid.cpp
│ ├── networking
│ │ ├── http.cpp
│ │ └── websocket.cpp
│ ├── schedulers
│ │ └── default_scheduler.cpp
│ ├── sdk.cpp
│ ├── types.cpp
│ └── util
│ │ └── config.h.in
└── libcurl
│ └── module.modulemap
├── tests
├── CMakeLists.txt
├── admin_utils.cpp
├── admin_utils.hpp
├── aosp
│ ├── Android.bp
│ ├── README.md
│ └── main.cpp
├── conanfile.py
├── config_overrides.json
├── db
│ ├── binary_tests.cpp
│ ├── bson_tests.cpp
│ ├── date_tests.cpp
│ ├── decimal_tests.cpp
│ ├── embedded_object_tests.cpp
│ ├── frozen_tests.cpp
│ ├── list_tests.cpp
│ ├── map_tests.cpp
│ ├── mixed_tests.cpp
│ ├── numeric_tests.cpp
│ ├── object_id_tests.cpp
│ ├── object_tests.cpp
│ ├── optional_tests.cpp
│ ├── performance_tests.cpp
│ ├── query_tests.cpp
│ ├── realm_tests.cpp
│ ├── results_tests.cpp
│ ├── scheduler_tests.cpp
│ ├── set_tests.cpp
│ ├── string_tests.cpp
│ ├── test_objects.hpp
│ └── uuid_tests.cpp
├── dependencies.list
├── external
│ └── generated
│ │ ├── Dummy.m
│ │ └── catch2
│ │ └── catch_user_config.hpp
├── main.cpp
├── main.hpp
├── setup_baas.rb
├── sync
│ ├── app_tests.cpp
│ ├── asymmetric_object_tests.cpp
│ ├── client_reset_tests.cpp
│ ├── flexible_sync_tests.cpp
│ ├── networking_tests.cpp
│ └── test_objects.hpp
├── utils
│ └── networking
│ │ ├── proxy_server.cpp
│ │ └── proxy_server.hpp
└── vcpkg.json
└── tools
├── cmake
├── Config.cmake.in
└── GetVersion.cmake
└── generate-version-numbers-for-soong.sh
/.clang-format:
--------------------------------------------------------------------------------
1 | # Generated from CLion C/C++ Code Style settings
2 | BasedOnStyle: LLVM
3 | AccessModifierOffset: -4
4 | AlignAfterOpenBracket: Align
5 | AlignConsecutiveAssignments: None
6 | AlignOperands: Align
7 | AllowAllArgumentsOnNextLine: false
8 | AllowAllConstructorInitializersOnNextLine: false
9 | AllowAllParametersOfDeclarationOnNextLine: false
10 | AllowShortBlocksOnASingleLine: Always
11 | AllowShortCaseLabelsOnASingleLine: false
12 | AllowShortFunctionsOnASingleLine: All
13 | AllowShortIfStatementsOnASingleLine: Always
14 | AllowShortLambdasOnASingleLine: All
15 | AllowShortLoopsOnASingleLine: true
16 | AlwaysBreakAfterReturnType: None
17 | AlwaysBreakTemplateDeclarations: Yes
18 | BreakBeforeBraces: Custom
19 | BraceWrapping:
20 | AfterCaseLabel: false
21 | AfterClass: false
22 | AfterControlStatement: Never
23 | AfterEnum: false
24 | AfterFunction: false
25 | AfterNamespace: false
26 | AfterUnion: false
27 | BeforeCatch: false
28 | BeforeElse: false
29 | IndentBraces: false
30 | SplitEmptyFunction: false
31 | SplitEmptyRecord: true
32 | BreakBeforeBinaryOperators: None
33 | BreakBeforeTernaryOperators: true
34 | BreakConstructorInitializers: BeforeColon
35 | BreakInheritanceList: BeforeColon
36 | ColumnLimit: 0
37 | CompactNamespaces: false
38 | ContinuationIndentWidth: 8
39 | IndentCaseLabels: true
40 | IndentPPDirectives: None
41 | IndentWidth: 4
42 | KeepEmptyLinesAtTheStartOfBlocks: true
43 | MaxEmptyLinesToKeep: 2
44 | NamespaceIndentation: All
45 | ObjCSpaceAfterProperty: false
46 | ObjCSpaceBeforeProtocolList: true
47 | PointerAlignment: Right
48 | ReflowComments: false
49 | SpaceAfterCStyleCast: true
50 | SpaceAfterLogicalNot: false
51 | SpaceAfterTemplateKeyword: false
52 | SpaceBeforeAssignmentOperators: true
53 | SpaceBeforeCpp11BracedList: false
54 | SpaceBeforeCtorInitializerColon: true
55 | SpaceBeforeInheritanceColon: true
56 | SpaceBeforeParens: ControlStatements
57 | SpaceBeforeRangeBasedForLoopColon: false
58 | SpaceInEmptyParentheses: false
59 | SpacesBeforeTrailingComments: 0
60 | SpacesInAngles: false
61 | SpacesInCStyleCastParentheses: false
62 | SpacesInContainerLiterals: false
63 | SpacesInParentheses: false
64 | SpacesInSquareBrackets: false
65 | TabWidth: 4
66 | UseTab: Never
67 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug.yml:
--------------------------------------------------------------------------------
1 | name: Bug Report
2 | description: File a bug report
3 | labels: [T-Bug]
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | Thanks for taking the time to fill out this bug report!
9 | - type: textarea
10 | id: what-happened
11 | attributes:
12 | label: What happened?
13 | description: Tell us, what did you expect to happen?
14 | placeholder: Tell us what you see!
15 | value: "A bug happened!"
16 | validations:
17 | required: true
18 | - type: textarea
19 | id: repro-steps
20 | attributes:
21 | label: Repro steps
22 | description: If you can reproduce the issue, please provide detailed repro steps here or provide a link to a repro project.
23 | placeholder: 1. X, 2. Y, 3. Crash!
24 | validations:
25 | required: true
26 | - type: input
27 | id: version
28 | attributes:
29 | label: Version
30 | description: What version of the C++ SDK are you using?
31 | placeholder: e.g. 0.6.1-preview
32 | validations:
33 | required: true
34 | - type: input
35 | id: install-method
36 | attributes:
37 | label: Installation method
38 | description: How are you installing the C++ SDK?
39 | placeholder: e.g. CMake 3.15
40 | validations:
41 | required: true
42 | - type: dropdown
43 | id: services
44 | attributes:
45 | label: What Atlas Services are you using?
46 | options:
47 | - -- select --
48 | - Local Database only
49 | - Atlas Device Sync
50 | - 'Atlas App Services: Functions or GraphQL or DataAPI etc'
51 | - Both Atlas Device Sync and Atlas App Services
52 | validations:
53 | required: true
54 | - type: input
55 | id: compiler
56 | attributes:
57 | label: Compiler
58 | description: What compiler are you using?
59 | placeholder: e.g. Clang 16.0.6
60 | validations:
61 | required: true
62 | - type: input
63 | id: client-platforms
64 | attributes:
65 | label: OS and version
66 | description: What OS (name and version) are you seeing the issue on?
67 | placeholder: e.g. Ubuntu 18.04
68 | validations:
69 | required: true
70 | - type: textarea
71 | id: code-snippets
72 | attributes:
73 | label: Code snippets
74 | description: Please provide a code sample or test case that highlights the issue. If relevant, include your model definitions.
75 | placeholder: Your code here
76 | - type: textarea
77 | id: stacktrace
78 | attributes:
79 | label: Stacktrace of the exception/crash you're getting
80 | description: If you're getting an exception or a crash, please paste the stacktrace here.
81 | render: shell
82 | - type: textarea
83 | id: logs
84 | attributes:
85 | label: Relevant log output
86 | description: Please copy and paste any relevant log output.
87 | render: shell
88 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: true
2 | contact_links:
3 | - name: General Questions and Inquiries
4 | url: https://www.mongodb.com/community/forums/tags/c/atlas-app-services-realm/realm/58/cxx
5 | about: Please ask general design/architecture questions in the community forums.
6 | - name: MongoDB Atlas Device Sync Production Issues
7 | url: https://support.mongodb.com/
8 | about: Please report urgent production issues to the support portal directly.
9 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature.yml:
--------------------------------------------------------------------------------
1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service
2 | # and should only be modified in that repository.
3 |
4 | name: Feature Request
5 | description: Request a new feature or enhancement
6 | labels: [T-Enhancement]
7 | body:
8 | - type: markdown
9 | attributes:
10 | value: |
11 | Thanks for taking the time to suggest improvements to Realm!
12 | - type: textarea
13 | id: problem
14 | attributes:
15 | label: Problem
16 | description: A clear and concise description of the problem you are trying to solve.
17 | validations:
18 | required: true
19 | - type: textarea
20 | id: solution
21 | attributes:
22 | label: Solution
23 | description: Describe the solution you envision, including API and usage example if possible.
24 | validations:
25 | required: false
26 | - type: textarea
27 | id: alternative-solution
28 | attributes:
29 | label: Alternatives
30 | description: Describe the alternative solutions or features you have considered
31 | validations:
32 | required: false
33 | - type: dropdown
34 | id: importance
35 | attributes:
36 | label: How important is this improvement for you?
37 | options:
38 | - -- select --
39 | - Dealbreaker
40 | - Would be a major improvement
41 | - I would like to have it but have a workaround
42 | - Fairly niche but nice to have anyway
43 | validations:
44 | required: true
45 | - type: dropdown
46 | id: sync
47 | attributes:
48 | label: Feature would mainly be used with
49 | options:
50 | - -- select --
51 | - Local Database only
52 | - Atlas Device Sync
53 | - 'Atlas App Services: Auth or Functions etc'
54 | validations:
55 | required: true
56 |
--------------------------------------------------------------------------------
/.github/actions/publish-doxygen/action.yml:
--------------------------------------------------------------------------------
1 | name: "Publish Doxygen Docs"
2 | description: "Generate and push the Doxygen docs to the S3 bucket."
3 | inputs:
4 | version:
5 | description: "The version string to paste into the docs."
6 | required: true
7 | destination:
8 | description: "The destination directory on the S3 bucket."
9 | required: true
10 | AWS_S3_BUCKET:
11 | description: "The AWS S3 bucket name."
12 | required: true
13 | AWS_ACCESS_KEY_ID:
14 | description: "The AWS public key."
15 | required: true
16 | AWS_SECRET_ACCESS_KEY:
17 | description: "The AWS private key."
18 | required: true
19 | runs:
20 | using: "composite"
21 | steps:
22 | - name: Build docs
23 | uses: mattnotmitt/doxygen-action@1.9.4
24 | env:
25 | DOXYGEN_PROJECT_NUMBER: ${{ inputs.version }}
26 | - name: Fix doxygen titles for SEO
27 | shell: bash
28 | run: bash docs/fix-doxygen-titles.sh
29 | - name: Upload docs
30 | uses: jakejarvis/s3-sync-action@master
31 | with:
32 | args: --acl public-read --delete
33 | env:
34 | AWS_S3_BUCKET: ${{ inputs.AWS_S3_BUCKET }}
35 | AWS_ACCESS_KEY_ID: ${{ inputs.AWS_ACCESS_KEY_ID }}
36 | AWS_SECRET_ACCESS_KEY: ${{ inputs.AWS_SECRET_ACCESS_KEY }}
37 | SOURCE_DIR: docs/modified-doxygen-output
38 | DEST_DIR: docs/realm-sdks/cpp/${{ inputs.destination }}
39 |
--------------------------------------------------------------------------------
/.github/advanced-issue-labeler.yml:
--------------------------------------------------------------------------------
1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service
2 | # and should only be modified in that repository.
3 |
4 | # syntax - https://github.com/redhat-plumbers-in-action/advanced-issue-labeler#policy
5 | # Below keys map from the option used in issue form dropdowns to issue labels
6 | # Limitation:
7 | # Currently it's not possible to use strings containing ,␣ in the dropdown menus in the issue forms.
8 |
9 | ---
10 |
11 | policy:
12 | - template: [bug.yml, feature.yml]
13 | section:
14 | - id: [frequency]
15 | label:
16 | - name: 'Frequency:Once'
17 | keys: ['Once']
18 | - name: 'Frequency:Sometimes'
19 | keys: ['Sometimes']
20 | - name: 'Frequency:Always'
21 | keys: ['Always']
22 |
23 | - id: [repro]
24 | label:
25 | - name: 'Repro:Always'
26 | keys: ['Always']
27 | - name: 'Repro:Sometimes'
28 | keys: ['Sometimes']
29 | - name: 'Repro:No'
30 | keys: ['No']
31 |
32 | - id: [sync, flavour, services]
33 | block-list: []
34 | label:
35 | - name: 'SDK-Use:Local'
36 | keys: ['Local Database only']
37 | - name: 'SDK-Use:Sync'
38 | keys: ['Atlas Device Sync']
39 | - name: 'SDK-Use:Services'
40 | keys: ['Atlas App Services: Function or GraphQL or DataAPI etc']
41 | - name: ['SDK-Use:All']
42 | keys: ['Both Atlas Device Sync and Atlas App Services']
43 |
44 | - id: [encryption]
45 | block-list: []
46 | label:
47 | - name: 'Encryption:On'
48 | keys: ['Yes']
49 | - name: 'Encryption:Off'
50 | keys: ['No']
51 |
52 | - id: [app-type]
53 | block-list: []
54 | label:
55 | - name: 'App-type:Unity'
56 | keys: ['Unity']
57 | - name: 'App-type:Xamarin'
58 | keys: ['Xamarin']
59 | - name: 'App-type:WPF'
60 | keys: ['WPF']
61 | - name: 'App-type:Console'
62 | keys: ['Console or Server']
63 | - name: 'App-type:Other'
64 | keys: ['Other']
65 |
66 | - id: [importance]
67 | block-list: []
68 | label:
69 | - name: 'Importance:Dealbraker'
70 | keys: ['Dealbreaker']
71 | - name: 'Importance:Major'
72 | keys: ['Would be a major improvement']
73 | - name: 'Importance:Workaround'
74 | keys: ['I would like to have it but have a workaround']
75 | - name: 'Importance:Nice'
76 | keys: ['Fairly niche but nice to have anyway']
77 |
--------------------------------------------------------------------------------
/.github/auto_assign.yml:
--------------------------------------------------------------------------------
1 | addAssignees: author
2 | addReviewers: false
3 | runOnDraft: true
4 |
--------------------------------------------------------------------------------
/.github/workflows/Issue-Needs-Attention.yml:
--------------------------------------------------------------------------------
1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service
2 | # and should only be modified in that repository.
3 |
4 | name: Issue Needs Attention
5 | # This workflow is triggered on issue comments.
6 | on:
7 | issue_comment:
8 | types: created
9 |
10 | jobs:
11 | applyNeedsAttentionLabel:
12 | uses: realm/ci-actions/.github/workflows/issue-needs-attention.yml@main
13 |
--------------------------------------------------------------------------------
/.github/workflows/auto-assign.yml:
--------------------------------------------------------------------------------
1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service
2 | # and should only be modified in that repository.
3 |
4 | name: 'Auto Assign'
5 | on:
6 | pull_request:
7 | types: [opened]
8 |
9 | jobs:
10 | add-assignee:
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: kentaro-m/auto-assign-action@248761c4feb3917c1b0444e33fad1a50093b9847
14 |
--------------------------------------------------------------------------------
/.github/workflows/check-changelog.yml:
--------------------------------------------------------------------------------
1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service
2 | # and should only be modified in that repository.
3 |
4 | name: "Check Changelog"
5 | on:
6 | pull_request:
7 | types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
8 |
9 | jobs:
10 | changelog:
11 | runs-on: ubuntu-latest
12 | steps:
13 | - name: Checkout
14 | uses: actions/checkout@v4
15 | with:
16 | submodules: false
17 | - name: Enforce Changelog
18 | uses: dangoslen/changelog-enforcer@c0b9fd225180a405c5f21f7a74b99e2eccc3e951
19 | with:
20 | skipLabels: no-changelog
21 | missingUpdateErrorMessage: Please add an entry in CHANGELOG.md or apply the 'no-changelog' label to skip this check.
22 |
--------------------------------------------------------------------------------
/.github/workflows/check-pr-title.yml:
--------------------------------------------------------------------------------
1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service
2 | # and should only be modified in that repository.
3 |
4 | name: "Check PR Title"
5 | on:
6 | pull_request:
7 | types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled, converted_to_draft, edited]
8 |
9 | jobs:
10 | check-pr-title:
11 | name: Check PR Title
12 | runs-on: ubuntu-latest
13 | steps:
14 | - uses: actions/checkout@v4
15 | with:
16 | submodules: false
17 | - name: Enforce PR title
18 | uses: realm/ci-actions/title-checker@main
19 | with:
20 | regex: R[A-Z]{2,6}-[0-9]{1,6}
21 | error-hint: Invalid PR title. Make sure it's prefixed with the JIRA ticket the PR addresses or add the no-jira-ticket label.
22 | ignore-labels: 'no-jira-ticket'
--------------------------------------------------------------------------------
/.github/workflows/conan.yml:
--------------------------------------------------------------------------------
1 | name: Test Conan integration
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 | pull_request:
8 |
9 | jobs:
10 | build:
11 | runs-on: ${{ matrix.os }}
12 | strategy:
13 | matrix:
14 | os: [ubuntu-latest, windows-latest, macos-latest]
15 | build_type: [Debug, Release]
16 | linkage_is_dynamic: ["True", "False"]
17 |
18 | steps:
19 | - name: Checkout
20 | uses: actions/checkout@v2
21 | with:
22 | submodules: 'recursive'
23 |
24 | - name: Select Python 3.10
25 | if: matrix.os == 'macos-latest'
26 | # otherwise turtlebrowser/get-conan@v1.1 fails on macos-12
27 | uses: actions/setup-python@v4
28 | with:
29 | python-version: '3.10'
30 |
31 | - name: Install Conan
32 | id: conan
33 | uses: turtlebrowser/get-conan@main
34 |
35 | - name: Conan version
36 | run: echo "${{ steps.conan.outputs.version }}"
37 |
38 | - name: Conan profile detect
39 | working-directory: .
40 | run: |
41 | conan profile detect
42 |
43 | - name: Update Conan profile
44 | if: matrix.os == 'windows-latest'
45 | run: |
46 | $profilePath = "$env:USERPROFILE\.conan2\profiles\default"
47 | $content = Get-Content -Path $profilePath
48 | $content = $content -replace 'compiler.cppstd=14', 'compiler.cppstd=17'
49 | $content | Set-Content -Path $profilePath
50 |
51 | - name: Conan create
52 | working-directory: .
53 | run: |
54 | conan create . -tf="tests" -s build_type=${{ matrix.build_type }} -o shared=${{ matrix.linkage_is_dynamic }} --build=missing
55 |
56 | - name: Open a tmate debug session
57 | if: ${{ failure() }}
58 | uses: mxschmitt/action-tmate@v3
59 | with:
60 | timeout-minutes: 15
--------------------------------------------------------------------------------
/.github/workflows/issue-labeler.yml:
--------------------------------------------------------------------------------
1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service
2 | # and should only be modified in that repository.
3 |
4 | # See configuration in .github/advanced-issue-labeler.yml
5 |
6 | name: Issue labeler (policy)
7 | on:
8 | issues:
9 | types: [ opened ]
10 |
11 | jobs:
12 | label-issues-policy:
13 | runs-on: ubuntu-latest
14 | permissions:
15 | issues: write
16 |
17 | strategy:
18 | matrix:
19 | template: [ bug.yml, feature.yml ]
20 |
21 | steps:
22 | - uses: actions/checkout@v4
23 |
24 | - name: Parse issue form
25 | uses: stefanbuck/github-issue-parser@c1a559d78bfb8dd05216dab9ffd2b91082ff5324 # v3.0.1
26 | id: issue-parser
27 | with:
28 | template-path: .github/ISSUE_TEMPLATE/${{ matrix.template }}
29 |
30 | - name: Set labels based on policy
31 | uses: redhat-plumbers-in-action/advanced-issue-labeler@6ee6fddfd744ee26b977e6a0436916f256896971 # v2.0.3
32 | with:
33 | issue-form: ${{ steps.issue-parser.outputs.jsonString }}
34 | template: ${{ matrix.template }}
35 | token: ${{ secrets.GITHUB_TOKEN }}
36 |
--------------------------------------------------------------------------------
/.github/workflows/lock-threads.yml:
--------------------------------------------------------------------------------
1 | name: 'Lock Threads'
2 |
3 | on:
4 | schedule:
5 | - cron: '0 * * * *'
6 | workflow_dispatch:
7 |
8 | permissions:
9 | issues: write
10 | pull-requests: write
11 | discussions: write
12 |
13 | concurrency:
14 | group: lock-threads
15 |
16 | jobs:
17 | action:
18 | runs-on: ubuntu-latest
19 | steps:
20 | - uses: dessant/lock-threads@v5
21 | with:
22 | issue-inactive-days: 30
23 | pr-inactive-days: 30
24 | log-output: true
25 |
--------------------------------------------------------------------------------
/.github/workflows/no-response.yml:
--------------------------------------------------------------------------------
1 | # NOTE: This is a common file that is overwritten by realm/ci-actions sync service
2 | # and should only be modified in that repository.
3 |
4 | name: No Response
5 |
6 | # Both `issue_comment` and `scheduled` event types are required for this Action
7 | # to work properly.
8 | on:
9 | issue_comment:
10 | types: [created]
11 | schedule:
12 | # Schedule at 00:00 every day
13 | - cron: '0 0 * * *'
14 |
15 | jobs:
16 | noResponse:
17 | runs-on: ubuntu-latest
18 | steps:
19 | - uses: lee-dohm/no-response@v0.5.0
20 | with:
21 | token: ${{ github.token }}
22 | responseRequiredLabel: More-information-needed
23 |
--------------------------------------------------------------------------------
/.github/workflows/publish-doxygen-on-release.yml:
--------------------------------------------------------------------------------
1 | name: Publish Doxygen Docs on Release
2 |
3 | on:
4 | release:
5 | types: [published]
6 |
7 | jobs:
8 | publish:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v3
12 | - uses: ./.github/actions/publish-doxygen
13 | with:
14 | version: Version ${{github.ref_name}}
15 | destination: ${{github.ref_name}}
16 | AWS_S3_BUCKET: ${{ secrets.DOCS_AWS_S3_BUCKET }}
17 | AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
18 | AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY }}
19 | - uses: ./.github/actions/publish-doxygen
20 | with:
21 | version: Version ${{github.ref_name}}
22 | destination: latest
23 | AWS_S3_BUCKET: ${{ secrets.DOCS_AWS_S3_BUCKET }}
24 | AWS_ACCESS_KEY_ID: ${{ secrets.DOCS_AWS_ACCESS_KEY_ID }}
25 | AWS_SECRET_ACCESS_KEY: ${{ secrets.DOCS_AWS_SECRET_ACCESS_KEY }}
26 |
--------------------------------------------------------------------------------
/.github/workflows/swiftpm.yml:
--------------------------------------------------------------------------------
1 | name: SwiftPM Build
2 |
3 | env:
4 | REALM_CI: true
5 | REALM_DISABLE_ANALYTICS: true
6 |
7 | on:
8 | push:
9 | branches:
10 | - main
11 | pull_request:
12 |
13 | jobs:
14 | build:
15 | runs-on: macos-13
16 | name: ${{ matrix.platform }} ${{ matrix.configuration }}, Xcode ${{ matrix.xcode }}
17 | strategy:
18 | fail-fast: false
19 | max-parallel: 6
20 | matrix:
21 | platform:
22 | - macOS
23 | - macOS,variant=Mac Catalyst
24 | - iOS
25 | - iOS Simulator
26 | - tvOS
27 | - tvOS Simulator
28 | xcode:
29 | - '15.0'
30 | configuration:
31 | - Debug
32 | - Release
33 | exclude:
34 | - configuration: ${{ github.event_name == 'pull_request' && 'Debug' || 'none' }}
35 | steps:
36 | - name: Checkout
37 | uses: actions/checkout@v2
38 | with:
39 | # git-restore-mtime-bare uses the ref log to find the correct timestamp
40 | # for each file. This requires a full git history. The default value (1)
41 | # creates a shallow checkout.
42 | fetch-depth: 0
43 | submodules: 'recursive'
44 | # Restore timestamps so that DerivedData caching can work across runs
45 | - name: Restore timestamps
46 | uses: chetan/git-restore-mtime-action@v1
47 |
48 | - name: Setup Xcode
49 | uses: maxim-lobanov/setup-xcode@v1
50 | with:
51 | xcode-version: ${{ matrix.xcode }}
52 |
53 | - uses: ammaraskar/gcc-problem-matcher@master
54 |
55 | - name: Compute cache key
56 | id: platform-escaped
57 | shell: pwsh
58 | run: echo "::set-output name=value::$([uri]::EscapeDataString('${{ matrix.platform }}'))"
59 |
60 | - name: Cache Derived Data
61 | uses: actions/cache@v2
62 | with:
63 | path: .build/derivedData
64 | key: swiftpm-derivedData-${{ steps.platform-escaped.outputs.value }}-${{ matrix.configuration }}-xcode-${{ matrix.xcode }}-derivedData-cache-${{ github.sha }}
65 | restore-keys: |
66 | swiftpm-derivedData-${{ steps.platform-escaped.outputs.value }}-${{ matrix.configuration }}-xcode-${{ matrix.xcode }}-derivedData-cache-
67 |
68 | # https://stackoverflow.com/questions/53753511/is-it-possible-to-copy-an-xcode-derived-data-cache
69 | - name: Avoid inode changes for DerivedData
70 | run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
71 |
72 | - name: Build
73 | run: |
74 | scheme=realm-tests
75 | xcodebuild -scheme $scheme -destination "generic/platform=${{ matrix.platform }}" -configuration ${{ matrix.configuration }} -derivedDataPath .build/derivedData
76 |
77 | - name: Open a tmate debug session
78 | if: ${{ failure() && runner.debug }}
79 | uses: mxschmitt/action-tmate@v3
80 | with:
81 | timeout-minutes: 15
82 |
--------------------------------------------------------------------------------
/.github/workflows/wipe-clusters.yml:
--------------------------------------------------------------------------------
1 | name: Wipe all clusters and apps
2 |
3 | on:
4 | workflow_dispatch:
5 | jobs:
6 | main:
7 | runs-on: ubuntu-latest
8 | name: Wipe all clusters and apps
9 | steps:
10 | - uses: realm/ci-actions/mdb-realm/deleteAllClusters@28a12a22e135d56db2b678fbe6479c0e1b52f169
11 | with:
12 | realmUrl: ${{ secrets.APPSERVICES_QA_BASE_URL }}
13 | atlasUrl: ${{ secrets.ATLAS_QA_BASE_URL }}
14 | projectId: ${{ secrets.ATLAS_QA_PROJECT_ID }}
15 | apiKey: ${{ secrets.ATLAS_QA_API_KEY }}
16 | privateApiKey: ${{ secrets.ATLAS_QA_PRIVATE_API_KEY }}
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | /.build
3 | /Packages
4 | /*.xcodeproj
5 | /.swiftpm
6 | xcuserdata/
7 | DerivedData/
8 | Package.resolved
9 | # Qt demo apps
10 | examples/*.pro.user
11 | docs/html
12 | docs/latex
13 | .idea/
14 | realm-core/src/realm/parser/generated/
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "realm-core"]
2 | path = realm-core
3 | url = https://github.com/realm/realm-core.git
4 | [submodule "Catch2"]
5 | path = Catch2
6 | url = https://github.com/catchorg/Catch2/
7 |
--------------------------------------------------------------------------------
/Android.bp:
--------------------------------------------------------------------------------
1 | package {
2 | default_applicable_licenses: ["external_realm_cpp_license"],
3 | }
4 |
5 | license {
6 | name: "external_realm_cpp_license",
7 | visibility: [":__subpackages__"],
8 | license_kinds: [
9 | "SPDX-license-identifier-Apache-2.0"
10 | ],
11 | license_text: [
12 | "LICENSE",
13 | ],
14 | }
15 |
16 | genrule {
17 | name: "gen_realmcxx_version_numbers",
18 | srcs: [
19 | "dependencies.list",
20 | "src/cpprealm/internal/version_numbers.hpp.in",
21 | ],
22 | out: ["cpprealm/version_numbers.hpp"],
23 | tool_files: ["tools/generate-version-numbers-for-soong.sh"],
24 | cmd: "$(location) $(in) > $(out)",
25 | }
26 |
27 |
28 | cc_defaults {
29 | name: "realm_cpp_defaults",
30 | cflags: [
31 | "-DREALM_AOSP_VENDOR=1"
32 | ],
33 | cppflags: [
34 | "-Wno-delete-non-abstract-non-virtual-dtor",
35 | "-Wno-mismatched-tags",
36 | "-Wno-unused-parameter",
37 | "-Wno-reorder-ctor",
38 | "-Wno-unused-function",
39 | "-Wno-unused-local-typedef",
40 | "-Wno-unused-variable"
41 | ],
42 | generated_headers: ["gen_realmcxx_version_numbers"]
43 | }
44 |
45 | cc_library_static {
46 | name: "realm-cpp",
47 | defaults: ["realm_consumer_defaults", "realm_defaults", "realm_cpp_defaults"],
48 | srcs: ["src/cpprealm/**/*.cpp"],
49 | export_include_dirs: ["include"],
50 | export_generated_headers: ["gen_realmcxx_version_numbers"],
51 | static_libs: ["realm"],
52 | include_build_directory: false,
53 | vendor: true
54 | }
--------------------------------------------------------------------------------
/cmake/ccache.cmake:
--------------------------------------------------------------------------------
1 | find_program(CCACHE_PROGRAM ccache)
2 | if(CCACHE_PROGRAM)
3 | message(STATUS "Found Ccache: ${CCACHE_PROGRAM}")
4 | if(CMAKE_GENERATOR STREQUAL "Xcode")
5 | # Set up wrapper scripts
6 | configure_file("${CMAKE_CURRENT_LIST_DIR}/launch-c.in" "${CMAKE_BINARY_DIR}/launch-c" @ONLY)
7 | configure_file("${CMAKE_CURRENT_LIST_DIR}/launch-cxx.in" "${CMAKE_BINARY_DIR}/launch-cxx" @ONLY)
8 | execute_process(COMMAND chmod a+rx
9 | "${CMAKE_BINARY_DIR}/launch-c"
10 | "${CMAKE_BINARY_DIR}/launch-cxx"
11 | )
12 |
13 | # Set Xcode project attributes to route compilation and linking
14 | # through our scripts
15 | set(CMAKE_XCODE_ATTRIBUTE_CC "${CMAKE_BINARY_DIR}/launch-c")
16 | set(CMAKE_XCODE_ATTRIBUTE_CXX "${CMAKE_BINARY_DIR}/launch-cxx")
17 | set(CMAKE_XCODE_ATTRIBUTE_LD "${CMAKE_BINARY_DIR}/launch-c")
18 | set(CMAKE_XCODE_ATTRIBUTE_LDPLUSPLUS "${CMAKE_BINARY_DIR}/launch-cxx")
19 | else()
20 | # Support Unix Makefiles and Ninja
21 | set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
22 | set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
23 | endif()
24 | else()
25 | message(WARNING "ccache was not found")
26 | endif()
27 |
--------------------------------------------------------------------------------
/cmake/cmake-build-xcode.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -eo pipefail
4 |
5 | XCODEBUILD_ARGS=()
6 | for arg in "$@"
7 | do
8 | if [ "$arg" = "-target" ]; then
9 | arg="-scheme"
10 | fi
11 | XCODEBUILD_ARGS+=("$arg")
12 | done
13 |
14 | xcodebuild "${XCODEBUILD_ARGS[@]}"
15 |
--------------------------------------------------------------------------------
/cmake/launch-c.in:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | export CCACHE_CPP2=true
4 | exec "@CCACHE_PROGRAM@" "@CMAKE_C_COMPILER@" "$@"
5 |
--------------------------------------------------------------------------------
/cmake/launch-cxx.in:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | export CCACHE_CPP2=true
4 | exec "@CCACHE_PROGRAM@" "@CMAKE_CXX_COMPILER@" "$@"
5 |
--------------------------------------------------------------------------------
/conanfile.py:
--------------------------------------------------------------------------------
1 | from conan import ConanFile
2 | from conan.tools.build import check_min_cppstd, can_run
3 | from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps
4 | from conan.tools.scm import Git
5 |
6 | class cpprealmRecipe(ConanFile):
7 | name = "cpprealm"
8 | version = "2.2.0"
9 |
10 | # Optional metadata
11 | license = "Apache-2.0"
12 | url = "https://github.com/realm/realm-cpp"
13 | description = "Realm is a mobile database that runs directly inside phones, tablets or wearables."
14 |
15 | # Binary configuration
16 | settings = "os", "compiler", "build_type", "arch"
17 | options = {"shared": [True, False]}
18 | default_options = {"shared": False}
19 |
20 | def is_darwin(self):
21 | return self.settings.os == "Macos" or self.settings.os == "iOS" or self.settings.os == "watchOS"
22 |
23 | def validate(self):
24 | check_min_cppstd(self, "17")
25 |
26 | def requirements(self):
27 | self.requires(self.tested_reference_str)
28 | if not self.is_darwin() and not self.settings.os == "Emscripten":
29 | self.requires("zlib/1.3")
30 | if not self.is_darwin():
31 | self.requires("openssl/3.2.0")
32 | self.requires("libuv/1.48.0")
33 | def source(self):
34 | git = Git(self)
35 | git.clone(url="https://github.com/realm/realm-cpp", target=".")
36 | git.folder = "."
37 | git.checkout(commit="5ec1bda338dfd0c91ce1eea2ccb2c0adf7d86690")
38 | git.run("submodule update --init --recursive")
39 |
40 | def layout(self):
41 | cmake_layout(self)
42 |
43 | def generate(self):
44 | deps = CMakeDeps(self)
45 | deps.generate()
46 | tc = CMakeToolchain(self)
47 | tc.variables["USES_CONAN"] = "ON"
48 | tc.variables["REALM_CPP_NO_TESTS"] = "ON"
49 | tc.variables["REALM_CORE_SUBMODULE_BUILD"] = "ON"
50 | tc.variables["REALM_USE_SYSTEM_OPENSSL"] = "ON"
51 | if self.settings.os == "Windows":
52 | self.cpp_info.cxxflags = ["/Zc:preprocessor /bigobj"]
53 | tc.generate()
54 |
55 | def build(self):
56 | cmake = CMake(self)
57 | cmake.configure()
58 | cmake.build()
59 |
60 | def package(self):
61 | cmake = CMake(self)
62 | cmake.install()
63 |
64 | def package_info(self):
65 | if self.settings.build_type == "Debug":
66 | self.cpp_info.libs = ["cpprealm-dbg", "realm-object-store-dbg", "realm-parser-dbg", "realm-sync-dbg", "realm-dbg"]
67 | else:
68 | self.cpp_info.libs = ["cpprealm", "realm-object-store", "realm-parser", "realm-sync", "realm"]
69 | if self.is_darwin():
70 | self.cpp_info.frameworks = ["Foundation", "Security", "Compression", "z"]
71 | if self.settings.os == "Windows":
72 | self.cpp_info.system_libs = ["Version"]
--------------------------------------------------------------------------------
/contributing/release-process.md:
--------------------------------------------------------------------------------
1 | # Realm C++ SDK Release Process:
2 |
3 | ### What to check on GitHub Actions:
4 | There are four main workflows:
5 | - CMake build
6 | - SPM
7 | - Vcpkg
8 | - Conan
9 |
10 | #### CMake build:
11 | This is where the majority of testing is done, tests run on macos, Windows and Ubuntu. On Ubuntu a variety of compilers are tested. Debug and Release configurations are tested on each platform.
12 | DB tests, Sync tests and Client reset tests run separately as part of the workflow.
13 | #### SPM:
14 | Only DB tests are performed.
15 | #### Vcpkg:
16 | The Vcpkg tests are to ensure that nothing in our CMakeLists has changed to break the Vcpkg portfile. It will install the cpprealm Vcpkg and link it against the DB tests to ensure everything integrates fine.
17 | #### Conan:
18 | Similar to Vcpkg, the purpose of these tests is to ensure the Conanfile is setup correctly and it links correctly against the DB tests.
19 |
20 | ### AOSP:
21 | Before each release check that everything builds fine on AOSP. It’s recommended to install AOSP on a Ubuntu workstation VM.
22 | Clone the repo (can take a few hours)
23 | https://source.android.com/docs/setup/download
24 | Build android (also takes hours)
25 | https://source.android.com/docs/setup/build/building
26 | - `source build/envsetup.sh`
27 | - `lunch aosp_cf_x86_64_phone-trunk_staging-eng`
28 | - `m`
29 | Once that is done, create a ‘vendor’ folder
30 | All 3rd party libs should be cloned inside of `vendor`
31 | Cd into your project folder and run `mma`
32 |
33 | ### Vcpkg:
34 | Whenever Core has a new release we should take it upon ourselves to update the portfile on the vcpkg repo. The main steps are:
35 | Fork Vcpkg
36 | Create a branch for the Core update
37 | Update the versions in the portfile, example [here](https://github.com/microsoft/vcpkg/pull/39888).
38 |
39 | Once the Core update has performed, the same process should be taken for the C++ SDK. On Vcpkg the SDK is called cpprealm
40 |
41 | ### Conanfile:
42 | We haven’t submitted to the Conan index yet, but users can consume the conanfile locally.
43 |
44 | # Releasing from main:
45 | - Ensure changelog is correct
46 | - Ensure Core submodule is updated in both [Package.swift](https://github.com/realm/realm-cpp/blob/5ec1bda338dfd0c91ce1eea2ccb2c0adf7d86690/Package.swift#L5) and git submodules
47 | - Ensure Conanfile.py is [pointing to the latest upstream](https://github.com/realm/realm-cpp/blob/main/conanfile.py#L39) and the [version is correct](https://github.com/realm/realm-cpp/blob/main/conanfile.py#L8).
48 | - Ensure [version in local vcpkg portfile](https://github.com/realm/realm-cpp/blob/5ec1bda338dfd0c91ce1eea2ccb2c0adf7d86690/ports/vcpkg.json#L3) is correct
49 | - Ensure the version in [dependencies.list](https://github.com/realm/realm-cpp/blob/5ec1bda338dfd0c91ce1eea2ccb2c0adf7d86690/dependencies.list#L1) is correct.
50 | - Create a tag prefixed with v and publish the release.
51 | - Copy the link for the release to appx-releases.
52 |
--------------------------------------------------------------------------------
/dependencies.list:
--------------------------------------------------------------------------------
1 | VERSION=2.2.0
--------------------------------------------------------------------------------
/docs/fix-doxygen-titles.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash -ex
2 |
3 | # Output this to a temp directory because we can't write to the html directory
4 | # Assume doxygen was run first
5 | pushd "`dirname "$0"`"
6 | cp -R html modified-doxygen-output
7 |
8 | find ./modified-doxygen-output -name "*.html" | while read ln
9 | do
10 | # Make the output SEO friendly by converting the "div" title to the proper "h1"
11 | sed -i -e 's|
\([^<]*\)
|\1
|' "$ln"
12 | done
13 | find ./modified-doxygen-output -iname "*.html-e" -exec rm '{}' \;
14 |
15 | popd
16 |
--------------------------------------------------------------------------------
/examples/Android/README.md:
--------------------------------------------------------------------------------
1 | ## Building an Android App with Realm C++ SDK
2 | - Add `` to your AndroidManifest.xml
3 | - Add the subdirectory of the Realm C++ SDK to your native library's CMakeLists.txt e.g:
4 | ```
5 | set(CMAKE_CXX_STANDARD 17)
6 | add_subdirectory("realm-cpp")
7 | ...
8 | target_link_libraries( # Specifies the target library.
9 | myapplication
10 | # make sure to link the Realm C++ SDK.
11 | cpprealm)
12 | ```
13 | - Ensure that the git submodules are initialized inside of the realm-cpp folder before building.
14 | - When instantiating the Realm or the Realm App you must pass the `filesDir.path` to the `path` parameter in the respective constructors.
15 | - See the MainActivity.kt & native-lib.cpp files in the Android example app for reference.
16 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/.idea/deploymentTargetDropDown.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
19 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'org.jetbrains.kotlin.android'
4 | }
5 |
6 | android {
7 | namespace 'com.mongodb.realmexample'
8 | compileSdk 32
9 |
10 | defaultConfig {
11 | applicationId "com.mongodb.realmexample"
12 | minSdk 26
13 | targetSdk 32
14 | versionCode 1
15 | versionName "1.0"
16 |
17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18 | externalNativeBuild {
19 | cmake {
20 | cppFlags '-std=c++17'
21 | targets "realmexample"
22 | }
23 | }
24 | }
25 |
26 | buildTypes {
27 | release {
28 | minifyEnabled false
29 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
30 | }
31 | }
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 | kotlinOptions {
37 | jvmTarget = '1.8'
38 | }
39 | externalNativeBuild {
40 | cmake {
41 | path file('src/main/cpp/CMakeLists.txt')
42 | version '3.18.1'
43 | }
44 | }
45 | buildFeatures {
46 | viewBinding true
47 | }
48 | }
49 |
50 | dependencies {
51 |
52 | implementation 'androidx.core:core-ktx:1.7.0'
53 | implementation 'androidx.appcompat:appcompat:1.5.1'
54 | implementation 'com.google.android.material:material:1.7.0'
55 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
56 | testImplementation 'junit:junit:4.13.2'
57 | androidTestImplementation 'androidx.test.ext:junit:1.1.4'
58 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
59 | }
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/androidTest/java/com/mongodb/realmexample/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.mongodb.realmexample
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.mongodb.realmexample", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/cpp/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # For more information about using CMake with Android Studio, read the
2 | # documentation: https://d.android.com/studio/projects/add-native-code.html
3 |
4 | # Sets the minimum version of CMake required to build the native library.
5 |
6 | cmake_minimum_required(VERSION 3.18.1)
7 | set(CMAKE_CXX_STANDARD 17)
8 |
9 | # Declares and names the project.
10 |
11 | project("realmexample")
12 |
13 | # Creates and names a library, sets it as either STATIC
14 | # or SHARED, and provides the relative paths to its source code.
15 | # You can define multiple libraries, and CMake builds them for you.
16 | # Gradle automatically packages shared libraries with your APK.
17 |
18 | add_subdirectory("../../../../../../../" "realmcpp")
19 |
20 | add_library( # Sets the name of the library.
21 | realmexample
22 |
23 | # Sets the library as a shared library.
24 | SHARED
25 |
26 | # Provides a relative path to your source file(s).
27 | native-lib.cpp)
28 |
29 | # Searches for a specified prebuilt library and stores the path as a
30 | # variable. Because CMake includes system libraries in the search path by
31 | # default, you only need to specify the name of the public NDK library
32 | # you want to add. CMake verifies that the library exists before
33 | # completing its build.
34 |
35 | find_library( # Sets the name of the path variable.
36 | log-lib
37 |
38 | # Specifies the name of the NDK library that
39 | # you want CMake to locate.
40 | log)
41 |
42 | # Specifies libraries CMake should link to your target library. You
43 | # can link multiple libraries, such as libraries you define in this
44 | # build script, prebuilt third-party libraries, or system libraries.
45 |
46 | target_link_libraries( # Specifies the target library.
47 | realmexample
48 |
49 | # Links the target library to the log library
50 | # included in the NDK.
51 | ${log-lib}
52 | # link the Realm C++ SDK
53 | cpprealm)
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/java/com/mongodb/realmexample/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.mongodb.realmexample
2 |
3 | import androidx.appcompat.app.AppCompatActivity
4 | import android.os.Bundle
5 | import android.view.MotionEvent
6 | import android.view.View
7 | import android.widget.TextView
8 | import com.mongodb.realmexample.databinding.ActivityMainBinding
9 |
10 | class MainActivity : AppCompatActivity() {
11 |
12 | private lateinit var binding: ActivityMainBinding
13 |
14 | override fun onCreate(savedInstanceState: Bundle?) {
15 | super.onCreate(savedInstanceState)
16 |
17 | binding = ActivityMainBinding.inflate(layoutInflater)
18 | setContentView(binding.root)
19 |
20 | // Pass the folder path of the app so we
21 | // can create a folder to store the Realm files.
22 | setupRealm(this.filesDir.path)
23 |
24 | binding.incrementButton.setOnClickListener {
25 | incrementCounter()
26 | }
27 |
28 | binding.decrementButton.setOnClickListener {
29 | decrementCounter()
30 | }
31 | }
32 |
33 | fun counterNotificationRecieved(changed_property: String) {
34 | binding.sampleText.text = changed_property
35 | }
36 |
37 | external fun setupRealm(path: String)
38 | // Movement methods
39 | external fun incrementCounter()
40 | external fun decrementCounter()
41 |
42 | companion object {
43 | // Used to load the 'realmexample' library on application startup.
44 | init {
45 | System.loadLibrary("realmexample")
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
30 |
31 |
41 |
42 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Android/RealmExample/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Android/RealmExample/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Android/RealmExample/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Android/RealmExample/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Android/RealmExample/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Android/RealmExample/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Android/RealmExample/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Android/RealmExample/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Android/RealmExample/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Android/RealmExample/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RealmExample
3 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/app/src/test/java/com/mongodb/realmexample/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.mongodb.realmexample
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/examples/Android/RealmExample/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | plugins {
3 | id 'com.android.application' version '7.3.0' apply false
4 | id 'com.android.library' version '7.3.0' apply false
5 | id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
6 | }
--------------------------------------------------------------------------------
/examples/Android/RealmExample/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app's APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Kotlin code style for this project: "official" or "obsolete":
19 | kotlin.code.style=official
20 | # Enables namespacing of each library's R class so that its R class includes only the
21 | # resources declared in the library itself and none from the library's dependencies,
22 | # thereby reducing the size of the R class for that library
23 | android.nonTransitiveRClass=true
--------------------------------------------------------------------------------
/examples/Android/RealmExample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Android/RealmExample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/examples/Android/RealmExample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Dec 06 21:03:48 GMT 2022
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
7 |
--------------------------------------------------------------------------------
/examples/Android/RealmExample/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | gradlePluginPortal()
4 | google()
5 | mavenCentral()
6 | }
7 | }
8 | dependencyResolutionManagement {
9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
10 | repositories {
11 | google()
12 | mavenCentral()
13 | }
14 | }
15 | rootProject.name = "RealmExample"
16 | include ':app'
17 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/ApplicationFlow.qml:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | import QtQuick
5 | import Barista
6 |
7 | ApplicationFlowForm {
8 | id: applicationFlow
9 | state: "initial"
10 |
11 | property int animationDuration: 400
12 |
13 | //! [0]
14 | choosingCoffee.brewButtonSelection.onClicked: {
15 | applicationFlow.state = "settings"
16 | applicationFlow.choosingCoffee.milkSlider.value = applicationFlow.choosingCoffee.sideBar.currentMilk
17 | applicationFlow.choosingCoffee.sugarSlider.value = 2
18 | }
19 | //! [0]
20 |
21 | choosingCoffee.sideBar.onCoffeeSelected: {
22 | applicationFlow.state = "selection"
23 | }
24 |
25 | choosingCoffee.backButton.onClicked: {
26 | applicationFlow.state = "selection"
27 | }
28 |
29 | //! [2]
30 | choosingCoffee.brewButton.onClicked: {
31 | applicationFlow.state = "empty cup"
32 | }
33 | //! [2]
34 |
35 | //! [1]
36 | emptyCup.continueButton.onClicked: {
37 | applicationFlow.state = "brewing"
38 | brewing.coffeeName = choosingCoffee.sideBar.currentCoffee
39 | brewing.start()
40 | backend.startBrew(choosingCoffee.sideBar.currentCoffeeId,
41 | choosingCoffee.milkSlider.value,
42 | choosingCoffee.sideBar.currentCoffeeAmount,
43 | choosingCoffee.sugarSlider.value);
44 | }
45 | //! [1]
46 |
47 | brewing.onFinished: {
48 | applicationFlow.state = "initial"
49 |
50 | }
51 |
52 | Behavior on choosingCoffee.x {
53 | PropertyAnimation {
54 | duration: applicationFlow.animationDuration
55 | easing.type: Easing.InOutQuad
56 | }
57 | }
58 |
59 | Behavior on emptyCup.x {
60 | PropertyAnimation {
61 | duration: applicationFlow.animationDuration
62 | easing.type: Easing.InOutQuad
63 | }
64 | }
65 |
66 | Behavior on brewing.x {
67 | PropertyAnimation {
68 | duration: applicationFlow.animationDuration
69 | easing.type: Easing.InOutQuad
70 | }
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/Brewing.qml:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | import QtQuick
5 |
6 | //! [0]
7 | BrewingForm {
8 | id: root
9 | function start() {
10 | animation.start()
11 | }
12 |
13 | signal finished()
14 |
15 | SequentialAnimation {
16 | id: animation
17 | PauseAnimation {
18 | duration: 1500
19 | }
20 | PropertyAction {
21 | target: root
22 | property: "state"
23 | value: "coffee"
24 | }
25 | PauseAnimation {
26 | duration: 1500
27 | }
28 | PropertyAction {
29 | target: root
30 | property: "state"
31 | value: "milk"
32 | }
33 | PauseAnimation {
34 | duration: 1500
35 | }
36 | PropertyAction {
37 | target: root
38 | property: "state"
39 | value: "finished"
40 | }
41 | ScriptAction {
42 | script: root.finished()
43 | }
44 | }
45 |
46 | Behavior on cup.coffeeAmount {
47 | PropertyAnimation {
48 |
49 | }
50 | }
51 |
52 | Behavior on cup.milkAmount {
53 | PropertyAnimation {
54 | }
55 | }
56 | }
57 | //! [0]
58 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/BrewingForm.ui.qml:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 | import QtQuick 2.4
4 | import QtQuick.Controls 2.0
5 | import QtQuick.Layouts 1.3
6 | import Coffee
7 |
8 | Item {
9 | id: root
10 | width: Constants.width
11 | height: Constants.height
12 | clip: true
13 | property string coffeeName: qsTr("Cappucino")
14 | property alias cup: cup
15 |
16 | state: "initial state"
17 |
18 | Rectangle {
19 | id: rectangle
20 | color: Constants.backgroundColor
21 | anchors.fill: parent
22 |
23 | CupForm {
24 | id: cup
25 | x: 256
26 | y: 96
27 | anchors.horizontalCenterOffset: 150
28 | anchors.horizontalCenter: parent.horizontalCenter
29 | anchors.verticalCenter: parent.verticalCenter
30 | questionVisible: false
31 | coffeeLabel: ""
32 | showLabels: false
33 | milkAmount: 0
34 | coffeeAmount: 0
35 | sugarAmount: 0
36 | }
37 | }
38 | Text {
39 | id: brewLabel
40 |
41 | color: "#ffffff"
42 | text: qsTr("Making ") + root.coffeeName
43 | anchors.topMargin: Constants.defaultMargin
44 | anchors.top: parent.top
45 | anchors.horizontalCenter: parent.horizontalCenter
46 | font.family: Constants.fontFamily
47 | wrapMode: Text.WrapAnywhere
48 | font.pixelSize: 64
49 | font.capitalization: Font.AllUppercase
50 | }
51 | states: [
52 | State {
53 | name: "coffee"
54 |
55 | PropertyChanges {
56 | target: cup
57 | coffeeAmount: 4
58 | }
59 | },
60 | State {
61 | name: "milk"
62 | PropertyChanges {
63 | target: cup
64 | milkAmount: 4
65 | coffeeAmount: 6
66 | }
67 |
68 | PropertyChanges {
69 | target: brewLabel
70 | text: root.coffeeName + qsTr(" Ready")
71 | }
72 | },
73 | State {
74 | name: "finished"
75 | PropertyChanges {
76 | target: cup
77 | milkAmount: 0
78 | coffeeAmount: 0
79 | }
80 |
81 | PropertyChanges {
82 | target: brewLabel
83 | text: qsTr("Making ") + root.coffeeName
84 | }
85 | }
86 | ]
87 | }
88 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16)
2 | project(coffee LANGUAGES CXX)
3 |
4 | set(CMAKE_AUTOMOC ON)
5 |
6 | find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick)
7 | add_subdirectory(../../../../realm-cpp realm-cpp)
8 |
9 | qt_add_executable(coffee
10 | main.cpp
11 | )
12 |
13 | set_target_properties(coffee PROPERTIES
14 | WIN32_EXECUTABLE TRUE
15 | MACOSX_BUNDLE TRUE
16 | )
17 |
18 | qt_add_qml_module(Barista
19 | URI Barista
20 | VERSION 1.0
21 | SOURCES coffee_manager.hpp realm_models.hpp coffee_manager.cpp imports/Coffee/Constants.qml
22 | NO_PLUGIN
23 | OUTPUT_TARGETS BARISTA_DEPS
24 | )
25 |
26 | target_link_libraries(Barista PUBLIC cpprealm)
27 |
28 | target_link_libraries(coffee PUBLIC
29 | Barista
30 | Qt::Core
31 | Qt::Gui
32 | Qt::Qml
33 | Qt::Quick
34 | )
35 |
36 | # Resources:
37 | set(qml_resource_files
38 | "ApplicationFlow.qml"
39 | "ApplicationFlowForm.ui.qml"
40 | "Brewing.qml"
41 | "BrewingForm.ui.qml"
42 | "ChoosingCoffee.ui.qml"
43 | "CoffeeButton.qml"
44 | "CupForm.ui.qml"
45 | "EmptyCupForm.ui.qml"
46 | "NavigationButton.ui.qml"
47 | "SideBar.qml"
48 | "images/cup structure/coffee_cup_large.png"
49 | "images/cup structure/coffee_cup_outline.png"
50 | "images/cup structure/cup elements/coffee_cup_back.png"
51 | "images/cup structure/cup elements/coffee_cup_coverplate.png"
52 | "images/cup structure/cup elements/coffee_cup_front.png"
53 | "images/cup structure/liquids/liquid_coffee.png"
54 | "images/cup structure/liquids/liquid_foam.png"
55 | "images/cup structure/liquids/liquid_milk.png"
56 | "images/icons/coffees/Americano.png"
57 | "images/icons/coffees/Espresso.png"
58 | "images/icons/coffees/Latte.png"
59 | "images/icons/coffees/Macchiato.png"
60 | "images/icons/coffees/cappucino.png"
61 | "images/icons/contents/coffee.png"
62 | "images/icons/contents/milk.png"
63 | "images/icons/contents/sugar.png"
64 | "images/ui controls/buttons/back/white.png"
65 | "images/ui controls/buttons/go/white.png"
66 | "images/ui controls/line.png"
67 | "imports/Coffee/Constants.qml"
68 | "imports/Coffee/TitilliumWeb-Regular.ttf"
69 | "imports/Coffee/qmldir"
70 | "main.qml"
71 | "qtquickcontrols2.conf"
72 | )
73 |
74 | qt6_add_resources(coffee "qml"
75 | PREFIX
76 | "/"
77 | FILES
78 | ${qml_resource_files}
79 | )
80 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/Cup.qml:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | import QtQuick
5 |
6 | CupForm {
7 | }
8 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/EmptyCup.qml:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | import QtQuick
5 |
6 | EmptyCupForm {
7 | }
8 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/EmptyCupForm.ui.qml:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | import QtQuick 2.4
5 | import QtQuick.Controls 2.0
6 | import QtQuick.Layouts 1.3
7 | import Coffee
8 |
9 | Item {
10 | id: root
11 | width: Constants.width
12 | height: Constants.height
13 | property alias continueButton: continueButton
14 |
15 | state: "initial state"
16 |
17 | Rectangle {
18 | id: rectangle
19 | color: Constants.backgroundColor
20 | anchors.fill: parent
21 |
22 | Image {
23 | id: image
24 | x: 284
25 | y: 174
26 | anchors.horizontalCenter: parent.horizontalCenter
27 | anchors.verticalCenter: parent.verticalCenter
28 | source: "images/cup structure/coffee_cup_outline.png"
29 | }
30 | }
31 |
32 | Text {
33 | id: brewLabel
34 | x: 84
35 | y: 26
36 | color: "#ffffff"
37 | text: qsTr("Please insert cup into tray")
38 | anchors.horizontalCenter: parent.horizontalCenter
39 | font.family: Constants.fontFamily
40 | wrapMode: Text.WrapAnywhere
41 | font.pixelSize: 64
42 | font.capitalization: Font.AllUppercase
43 | }
44 |
45 | NavigationButton {
46 | id: continueButton
47 | x: 324
48 | y: 650
49 | text: "Continue"
50 | anchors.bottomMargin: Constants.defaultMargin
51 | anchors.horizontalCenter: parent.horizontalCenter
52 | anchors.bottom: parent.bottom
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/NavigationButton.ui.qml:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 | import QtQuick 2.4
4 | import QtQuick.Controls 2.0
5 | import QtQuick.Layouts 1.3
6 | import Coffee
7 |
8 | Row {
9 | id: row
10 |
11 | signal clicked
12 |
13 | property alias text: brewLabel.text
14 |
15 | property bool forward: true
16 | layoutDirection: row.forward ? Qt.LeftToRight : Qt.RightToLeft
17 |
18 | spacing: 17
19 |
20 | Text {
21 | id: brewLabel
22 | color: "#ffffff"
23 | text: qsTr("Brew Me a CUP")
24 | font.family: Constants.fontFamily
25 | wrapMode: Text.WrapAnywhere
26 | font.pixelSize: 64
27 | font.capitalization: Font.AllUppercase
28 | }
29 |
30 | Image {
31 | id: image
32 |
33 | anchors.verticalCenter: parent.verticalCenter
34 | source: row.forward ? "images/ui controls/buttons/go/white.png" : "images/ui controls/buttons/back/white.png"
35 | scale: mouseArea.containsMouse ? 1.1 : 1
36 | MouseArea {
37 | id: mouseArea
38 | hoverEnabled: true
39 |
40 | anchors.fill: parent
41 | Connections {
42 | function onClicked(mouse) {
43 | row.clicked()
44 | }
45 | }
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/README.md:
--------------------------------------------------------------------------------
1 | # Coffee Machine - Operated and powered by Atlas Device Sync
2 |
3 | The example extends the [Qt provided Coffee Machine](https://doc.qt.io/qt-6/qtdoc-demos-coffee-example.html) with [Atlas Device Sync](https://www.mongodb.com/docs/atlas/app-services/sync/) - essentially turning the coffee machine into a fleet of coffee machines that can be operated and controlled remotely by an operator.
4 |
5 | The animation below shows the Coffee Machine with the Qt/QML UI on the left controlled by the mobile app written in Swift with data displayed on the right hand side with [Atlas Charts](https://www.mongodb.com/docs/charts/).
6 |
7 |
8 |

9 |
10 |
11 |
12 | The below diagram shows the setup in highlevel:
13 |
14 |
15 |

16 |
17 |
18 | ## Project Structure
19 |
20 | This repository contains the source code of the Coffee Machine - the most relevant files are:
21 |
22 | ```
23 | coffee
24 | ├── CMakeLists.txt - Barista QML module
25 | ├── coffee_manager.cpp - App ID and sync setup, initial drink list, emit Qt Signals etc.
26 | ├── coffee_manager.hpp - Class definitions with Qt tie-in
27 | ├── main.cpp - Main initialising the QML app engine
28 | ├── main.qml - QML main including out of order state
29 | └── realm_models.hpp - Objects deposited to Realm and synced to MongoDB Atlas
30 | ```
31 |
32 | ## Use Cases
33 |
34 | The following use cases are supported:
35 |
36 | * **Configuring drink recipes remotely** - the Coffee Machine shows the drink options based on the recipes configured in MongoDB Atlas. The current recipes include espresso, cappuccino and flat white.
37 | * **Out of order sensing and remote control logic** - the control logic on the Atlas side implemented with Atlas Functions checks the availability of the ingredients in the machine needed for the drinks and automatically sets the machine out of order once the level of ingredients drops below the set thresholds.
38 | * **Resiliency to dropped network connection** - consuming the ingredients when serving drinks is deposited to the machine local Realm storage. Once the network is back up, ingredients are synchronized to the Atlas database in cloud.
39 |
40 | ### Prerequisites:
41 |
42 | - Install the Atlas Device SDK for C++ like so:
43 | ```
44 | mkdir build
45 | cd build
46 | cmake -GNinja ..
47 | ninja install
48 | ```
49 | - Create a Atlas App Services app then do the following:
50 | - Enable anonymous authentication.
51 | - Enable Sync with Development Mode turned on.
52 | - Use the `CMakeLists.txt` file to open the project in Qt Creator.
53 | - Replace `MY_APP_ID` in coffee_manager.cpp with your Atlas App ID.
54 | - Build and run!
--------------------------------------------------------------------------------
/examples/Qt/coffee/SideBar.qml:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | import QtQuick
5 |
6 |
7 |
8 | Flickable {
9 | id: sideBar
10 | property string currentCoffeeId
11 | property string currentCoffee: qsTr("Cappucino")
12 | signal coffeeSelected
13 | property real currentMilk: 0
14 | property real currentCoffeeAmount: 4
15 |
16 | Behavior on currentMilk {
17 | NumberAnimation { duration: 250 }
18 | }
19 |
20 | Behavior on currentCoffeeAmount {
21 | NumberAnimation { duration: 250 }
22 | }
23 |
24 | x: 0
25 | y: 0
26 | width: 354
27 | height: 768
28 |
29 |
30 | contentWidth: 354
31 | boundsBehavior: Flickable.StopAtBounds
32 | contentHeight: 1506
33 | clip: true
34 |
35 | Rectangle {
36 | id: background
37 | x: 0
38 | width: 354
39 | height: 1506
40 | color: "#eec1a2"
41 | }
42 |
43 | TableView {
44 | implicitWidth: 250
45 | height: 768
46 |
47 | model: backend.drinkSelectionModel
48 | anchors.horizontalCenter: parent.horizontalCenter
49 |
50 | delegate: CoffeeButton {
51 | required property var model
52 | required property string name
53 | required property int milkQty
54 | required property int espressoQty
55 |
56 | id: espressoButton
57 | text: model.name
58 | onClicked: {
59 | sideBar.currentCoffeeId = qsTr(model.id)
60 | sideBar.currentCoffee = qsTr(model.name)
61 | sideBar.currentMilk = model.milkQty
62 | sideBar.currentCoffeeAmount = model.espressoQty
63 | sideBar.coffeeSelected()
64 | }
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/assets/coffee.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/assets/coffee.gif
--------------------------------------------------------------------------------
/examples/Qt/coffee/assets/setup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/assets/setup.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/coffee.qdoc:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | /*!
5 |
6 | \example demos/coffee
7 | \title Coffee Machine Example
8 | \ingroup qtquickdemos
9 | \brief A Qt Quick application with a state-based custom user interface.
10 |
11 | \borderedimage coffee_machine_overview.png
12 |
13 | The coffee machine application lets you choose a type of coffee on the
14 | left side of the main screen. After selection, the app displays what
15 | the coffee blend will contain (ratio coffee/hot milk/milk foam).
16 | This can be modified with two sliders. When the brew has been started,
17 | the app shows an animated display of the brewing process, then returns
18 | to the start screen.
19 |
20 | First the start screen \c Animationflowform is displayed, showing a
21 | sidebar with several types of coffee, and an empty cup on the right
22 | screen.
23 |
24 | Selecting a coffee type - for example, cappuccino - triggers \c animation1
25 | and \c animation2 in CoffeeButton.qml. On the right side, you will see
26 | the coffee blend you selected.
27 |
28 | \snippet demos/coffee/CoffeeButton.qml 0
29 |
30 | It also triggers cappuccinoButton.onClicked(), which sets the default
31 | mix for the coffee type selected:
32 |
33 | \snippet demos/coffee/SideBar.qml 0
34 |
35 | \borderedimage coffee_machine_selection.png
36 | \caption Coffee blend cappuccino
37 |
38 | \c sideBar.coffeeSelected() \c sets applicationFlow.state to "selection"
39 |
40 | If you click "Brew me a cup", choosingCoffee.brewButtonSelection.onClicked
41 | is triggered:
42 |
43 | \snippet demos/coffee/ApplicationFlow.qml 0
44 |
45 | On the right side of the screen, you will see two sliders, one for
46 | the amount of milk, and one for sugar. They will have default values,
47 | but can be modified by the user.
48 |
49 | \borderedimage coffee_machine_modify.png
50 |
51 | If you click on \c Brew, \c choosingCoffee.brewButton.onClicked() is triggered,
52 | which displays a screen with the message "Please insert cup into tray".
53 |
54 | \snippet demos/coffee/ApplicationFlow.qml 2
55 |
56 | \borderedimage coffee_machine_emptycup.png
57 |
58 | Clicking on \c Continue starts the brewing of the coffee type you
59 | selected.
60 |
61 | \snippet demos/coffee/ApplicationFlow.qml 1
62 |
63 | The brewing process is defined as follows in \c Brewing.qml:
64 |
65 | \snippet demos/coffee/Brewing.qml 0
66 |
67 | After completion, the application returns to the start screen.
68 | */
69 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/coffee_manager.hpp:
--------------------------------------------------------------------------------
1 | #ifndef COFFEE_MANAGER_HPP
2 | #define COFFEE_MANAGER_HPP
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | #include "realm_models.hpp"
12 |
13 | class DrinkSelectionModel : public QAbstractTableModel
14 | {
15 | Q_OBJECT
16 | public :
17 | enum Role
18 | {
19 | Id = Qt::UserRole + 1,
20 | Name,
21 | MilkQty,
22 | EspressoQty
23 | };
24 | DrinkSelectionModel(realm::managed& machine);
25 | int rowCount(const QModelIndex& parent = QModelIndex()) const override;
26 | int columnCount(const QModelIndex& parent = QModelIndex()) const override;
27 | Q_INVOKABLE QVariant data(const QModelIndex &index, int role) const override;
28 | QHash roleNames() const override;
29 | private:
30 | realm::managed mMachine;
31 | realm::notification_token mToken;
32 | };
33 |
34 |
35 | class CoffeeMachineManager : public QObject
36 | {
37 | Q_OBJECT
38 | Q_PROPERTY(NOTIFY enableMachine NOTIFY disableMachine)
39 | Q_PROPERTY(QAbstractTableModel* drinkSelectionModel READ drinkSelectionModel CONSTANT)
40 |
41 | QML_ELEMENT
42 |
43 | public:
44 | explicit CoffeeMachineManager(QObject *parent = nullptr);
45 |
46 | Q_INVOKABLE void prepareForBrew(const QString &coffeeId);
47 | Q_INVOKABLE void startBrew(const QString &coffeeId, int64_t milkQty, int64_t espressoQty, int64_t sugarQty);
48 |
49 | DrinkSelectionModel *drinkSelectionModel() { return mDrinksTableModel.data(); }
50 |
51 | signals:
52 | void enableMachine();
53 | void disableMachine();
54 |
55 | private:
56 | realm::user mUser;
57 | realm::managed mCoffeeMachine;
58 | QScopedPointer mDrinksTableModel;
59 | realm::notification_token mToken;
60 | };
61 |
62 | #endif // COFFEE_MANAGER_HPP
63 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/cup structure/coffee_cup_large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/cup structure/coffee_cup_large.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/cup structure/coffee_cup_outline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/cup structure/coffee_cup_outline.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/cup structure/cup elements/coffee_cup_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/cup structure/cup elements/coffee_cup_back.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/cup structure/cup elements/coffee_cup_coverplate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/cup structure/cup elements/coffee_cup_coverplate.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/cup structure/cup elements/coffee_cup_front.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/cup structure/cup elements/coffee_cup_front.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/cup structure/liquids/liquid_coffee.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/cup structure/liquids/liquid_coffee.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/cup structure/liquids/liquid_foam.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/cup structure/liquids/liquid_foam.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/cup structure/liquids/liquid_milk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/cup structure/liquids/liquid_milk.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/icons/coffees/Americano.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/icons/coffees/Americano.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/icons/coffees/Espresso.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/icons/coffees/Espresso.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/icons/coffees/Latte.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/icons/coffees/Latte.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/icons/coffees/Macchiato.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/icons/coffees/Macchiato.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/icons/coffees/cappucino.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/icons/coffees/cappucino.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/icons/contents/coffee.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/icons/contents/coffee.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/icons/contents/milk.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/icons/contents/milk.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/icons/contents/sugar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/icons/contents/sugar.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/ui controls/buttons/back/white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/ui controls/buttons/back/white.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/ui controls/buttons/go/white.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/ui controls/buttons/go/white.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/images/ui controls/line.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/images/ui controls/line.png
--------------------------------------------------------------------------------
/examples/Qt/coffee/imports/Coffee/Constants.qml:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 |
5 | pragma Singleton
6 | import QtQuick
7 |
8 | QtObject {
9 | property FontLoader fontLoader: FontLoader {
10 | id: fontLoader
11 | source: "TitilliumWeb-Regular.ttf"
12 | }
13 | readonly property alias fontFamily: fontLoader.name
14 |
15 | readonly property int width: 1024
16 | readonly property int height: 768
17 | readonly property int leftSideBarWidth: 366
18 | readonly property int defaultX: 0
19 |
20 | readonly property color backgroundColor: "#443224"
21 | readonly property int defaultMargin: 8
22 | }
23 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/imports/Coffee/TitilliumWeb-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/examples/Qt/coffee/imports/Coffee/TitilliumWeb-Regular.ttf
--------------------------------------------------------------------------------
/examples/Qt/coffee/imports/Coffee/qmldir:
--------------------------------------------------------------------------------
1 | singleton Constants 1.0 Constants.qml
2 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/main.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2020 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | #include
5 | #include
6 | #include "coffee_manager.hpp"
7 |
8 | int main(int argc, char *argv[])
9 | {
10 | QGuiApplication app(argc, argv);
11 |
12 | QQmlApplicationEngine engine;
13 | engine.addImportPath(":/imports");
14 | engine.load(QUrl(QLatin1String("qrc:/main.qml")));
15 | if (engine.rootObjects().isEmpty())
16 | return -1;
17 |
18 | return app.exec();
19 | }
20 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/main.qml:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2017 The Qt Company Ltd.
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3 |
4 | import QtQuick
5 | import QtQuick.Controls
6 | import QtQuick.Layouts
7 | import Barista
8 | import Coffee
9 |
10 | ApplicationWindow {
11 | visible: true
12 | width: Constants.width
13 | height: Constants.height
14 | title: qsTr("Coffee")
15 |
16 | CoffeeMachineManager {
17 | id: backend
18 | onEnableMachine: {
19 | outOfOrderView.visible = false;
20 | coffeeView.visible = true;
21 | }
22 | onDisableMachine: {
23 | outOfOrderView.visible = true;
24 | coffeeView.visible = false;
25 | }
26 | }
27 |
28 | ApplicationFlow {
29 | id: coffeeView
30 | }
31 |
32 | Text {
33 | id: outOfOrderView
34 | visible: false
35 | text: "Out of order. Help is coming."
36 | font.family: "Helvetica"
37 | font.pointSize: 24
38 | color: "white"
39 | anchors.horizontalCenter: parent.horizontalCenter
40 | anchors.verticalCenter: parent.verticalCenter
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 | qtquickcontrols2.conf
5 | images/cup structure/cup elements/coffee_cup_back.png
6 | images/cup structure/cup elements/coffee_cup_coverplate.png
7 | images/cup structure/cup elements/coffee_cup_front.png
8 | images/cup structure/liquids/liquid_coffee.png
9 | images/cup structure/liquids/liquid_foam.png
10 | images/cup structure/liquids/liquid_milk.png
11 | images/cup structure/coffee_cup_large.png
12 | images/cup structure/coffee_cup_outline.png
13 | images/icons/contents/coffee.png
14 | images/icons/contents/milk.png
15 | images/icons/contents/sugar.png
16 | images/icons/coffees/Americano.png
17 | images/icons/coffees/cappucino.png
18 | images/icons/coffees/Espresso.png
19 | images/icons/coffees/Latte.png
20 | images/icons/coffees/Macchiato.png
21 | images/ui controls/buttons/back/white.png
22 | images/ui controls/buttons/go/white.png
23 | images/ui controls/line.png
24 | CoffeeButton.qml
25 | CupForm.ui.qml
26 | SideBar.qml
27 | NavigationButton.ui.qml
28 | ApplicationFlow.qml
29 | ApplicationFlowForm.ui.qml
30 | EmptyCupForm.ui.qml
31 | Brewing.qml
32 | BrewingForm.ui.qml
33 | ChoosingCoffee.ui.qml
34 | imports/Coffee/Constants.qml
35 | imports/Coffee/qmldir
36 | imports/Coffee/TitilliumWeb-Regular.ttf
37 |
38 |
39 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/qt_attribution.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "Id": "coffeeexample-titillium",
4 | "Name": "Titillium Web Font",
5 | "QDocModule": "qtdoc",
6 | "QtUsage": "Used in the Coffee Maker example.",
7 | "QtParts": ["examples"],
8 | "Files": "TitilliumWeb-Regular.ttf",
9 |
10 | "License": "SIL Open Font License 1.1",
11 | "LicenseId": "OFL-1.1",
12 | "LicenseFile": "LICENSE.txt",
13 | "Copyright": "Copyright (c) 2009-2011 by Accademia di Belle Arti di Urbino and students of MA course of Visual design. Some rights reserved."
14 | }
15 | ]
16 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/qtquickcontrols2.conf:
--------------------------------------------------------------------------------
1 | [Controls]
2 | Style=Material
3 |
4 | [Material]
5 | Accent=White
6 | Primary=Grey
7 | Theme=Dark
8 |
9 | [Universal]
10 | Theme=Light
11 |
--------------------------------------------------------------------------------
/examples/Qt/coffee/realm_models.hpp:
--------------------------------------------------------------------------------
1 | #ifndef REALM_MODELS_HPP
2 | #define REALM_MODELS_HPP
3 |
4 | #include
5 | #include
6 |
7 | namespace realm {
8 | struct DrinkTemplate {
9 | primary_key _id;
10 | std::string name;
11 | int64_t milkQty;
12 | int64_t espressoQty;
13 | int64_t chocolateQty;
14 | int64_t sugarQty;
15 | };
16 |
17 | REALM_SCHEMA(DrinkTemplate,
18 | _id,
19 | name,
20 | milkQty,
21 | espressoQty,
22 | chocolateQty,
23 | sugarQty)
24 |
25 | struct CoffeeMachine {
26 | enum class State {
27 | NEEDS_ATTENTION,
28 | OK,
29 | MAINTENANCE_MODE
30 | };
31 | primary_key _id;
32 | std::string location;
33 | realm::object_id ownerId;
34 | int64_t milkQty;
35 | int64_t espressoQty;
36 | int64_t chocolateQty;
37 | int64_t sugarQty;
38 | State state;
39 | std::vector availableDrinks;
40 | };
41 |
42 | REALM_SCHEMA(CoffeeMachine,
43 | _id,
44 | location,
45 | ownerId,
46 | milkQty,
47 | espressoQty,
48 | chocolateQty,
49 | sugarQty,
50 | state,
51 | availableDrinks)
52 | }
53 |
54 | #endif // REALM_MODELS_HPP
55 |
--------------------------------------------------------------------------------
/examples/SPM/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | /.build
3 | /Packages
4 | /*.xcodeproj
5 | xcuserdata/
6 | DerivedData/
7 | .swiftpm/config/registries.json
8 | .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
9 | .netrc
10 |
--------------------------------------------------------------------------------
/examples/SPM/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version: 5.6
2 | // The swift-tools-version declares the minimum version of Swift required to build this package.
3 |
4 | import PackageDescription
5 |
6 | let package = Package(
7 | name: "RealmCppExample",
8 | platforms: [.macOS(.v11)],
9 | dependencies: [
10 | // Dependencies declare other packages that this package depends on.
11 | .package(path: "../../")
12 | ],
13 | targets: [
14 | // Targets are the basic building blocks of a package. A target can define a module or a test suite.
15 | // Targets can depend on other targets in this package, and on products in packages this package depends on.
16 | .executableTarget(
17 | name: "RealmCppExample",
18 | dependencies: [
19 | .product(name: "realm-cpp-sdk", package: "realm-cpp")
20 | ])
21 | ],
22 | cxxLanguageStandard: .cxx17
23 | )
24 |
--------------------------------------------------------------------------------
/examples/SPM/README.md:
--------------------------------------------------------------------------------
1 | You will first need to create a [Atlas Device Sync App and turn development mode on for it.](https://www.mongodb.com/docs/atlas/app-services/sync/get-started/)
2 | Make sure to enable anonymous authentication.
3 | Then replace 'YOUR_APP_ID' in main.cpp with the one you just created.
4 |
--------------------------------------------------------------------------------
/examples/SPM/Sources/RealmCppExample/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | #include
6 |
7 | namespace realm {
8 | struct Person {
9 | realm::primary_key _id;
10 | int64_t age;
11 | std::string name;
12 | std::string country;
13 | };
14 | REALM_SCHEMA(Person, _id, age, name, country)
15 | }
16 |
17 |
18 | int main() {
19 | auto app_config = realm::App::configuration();
20 | app_config.app_id = "MY_DEVICE_SYNC_APP_ID";
21 | auto app = realm::App(app_config);
22 | auto user = app.login(realm::App::credentials::anonymous()).get();
23 | auto config = user.flexible_sync_configuration();
24 |
25 | auto synced_realm = realm::db(std::move(config));
26 |
27 | auto update_success = synced_realm.subscriptions().update([](realm::mutable_sync_subscription_set &subs) {
28 | subs.add("country", [](auto &obj) {
29 | return obj.country == "USA" || obj.country == "IE";
30 | });
31 | }).get();
32 |
33 | synced_realm.write([&synced_realm]() {
34 | realm::Person o;
35 | o._id = realm::object_id::generate();
36 | o.name = "foo";
37 | o.country = "USA";
38 | synced_realm.add(std::move(o));
39 | });
40 |
41 | synced_realm.get_sync_session()->wait_for_upload_completion().get();
42 | synced_realm.get_sync_session()->wait_for_download_completion().get();
43 |
44 | synced_realm.refresh();
45 |
46 | auto results = synced_realm.objects();
47 | auto token = results.observe([](auto change) {
48 | std::cout << "collection changed " << change.collection->size() << " objects in collection" << "\n";
49 | });
50 |
51 | std::cout << "Enter a name:" << "\n";
52 | std::string name;
53 | std::cin >> name;
54 |
55 | synced_realm.write([&]() {
56 | realm::Person p;
57 | p._id = realm::object_id::generate();
58 | p.name = name;
59 | p.country = "USA";
60 | synced_realm.add(std::move(p));
61 | });
62 |
63 | std::cout << results.size() << std::endl;
64 | std::cout << "Make some changes to the data from Atlas and watch the callback in real time." << std::endl;
65 |
66 | // Instantiating the runloop here just ensures the program allows the sync thread
67 | // time to push the changes. If you prefer a synchronous approach you can do
68 | // `synced_realm.get_sync_session()->wait_for_upload_completion().get();`
69 |
70 | CFRunLoopRun();
71 | return 0;
72 | }
73 |
--------------------------------------------------------------------------------
/examples/cmake/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 |
3 | project (realm_helloworld)
4 |
5 | set(CMAKE_CXX_STANDARD 17)
6 | if(MSVC)
7 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:preprocessor /bigobj")
8 | else ()
9 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
10 | endif()
11 | add_executable(realm_helloworld helloworld.cpp)
12 |
13 | if (DEFINED VCPKG_OVERLAY_PORTS)
14 | find_package(cpprealm REQUIRED)
15 | else()
16 | add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../realm-cpp ${CMAKE_CURRENT_BINARY_DIR}/realm-cpp)
17 | endif()
18 |
19 | target_link_libraries(realm_helloworld cpprealm)
20 |
21 | if(MSVC)
22 | set_property(TARGET realm_helloworld PROPERTY
23 | MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>")
24 | endif()
--------------------------------------------------------------------------------
/examples/cmake/README.md:
--------------------------------------------------------------------------------
1 | You will first need to create a [Atlas Device Sync App and turn development mode on for it.](https://www.mongodb.com/docs/atlas/app-services/sync/get-started/)
2 | Make sure to enable anonymous authentication.
3 |
4 | set `USE_REALM_LOCAL` to build everything from source otherwise you must have previously installed realm-cpp.
5 |
6 | Linux platforms require the following packages:
7 | ```
8 | sudo apt-get install -y \
9 | libcurl4-openssl-dev \
10 | libssl-dev \
11 | libuv1-dev \
12 | ninja-build \
13 | zlib1g-dev
14 | ```
15 |
16 | Change to the example project directory.
17 | ```
18 | mkdir build.debug
19 | cd build.debug
20 | cmake -GNinja -D CMAKE_BUILD_TYPE=debug ..
21 | ninja
22 | ./hello
23 | ```
24 |
25 | # Using vcpkg
26 |
27 | In the root directory of this example project run:
28 | `cmake -B [build directory] -S . -DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake -DVCPKG_OVERLAY_PORTS="../ports"`
--------------------------------------------------------------------------------
/examples/cmake/helloworld.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | #if __APPLE__
6 | #include
7 | #else
8 | #include
9 | #endif
10 |
11 | namespace realm {
12 | struct Person {
13 | realm::primary_key _id;
14 | int64_t age;
15 | std::string name;
16 | std::string country;
17 | };
18 | REALM_SCHEMA(Person, _id, age, name, country)
19 | }
20 |
21 |
22 | int main() {
23 | auto app_config = realm::App::configuration();
24 | app_config.app_id = "MY_DEVICE_SYNC_APP_ID";
25 | auto app = realm::App(app_config);
26 | auto user = app.login(realm::App::credentials::anonymous()).get();
27 | auto config = user.flexible_sync_configuration();
28 |
29 | auto synced_realm = realm::db(std::move(config));
30 |
31 | auto update_success = synced_realm.subscriptions().update([](realm::mutable_sync_subscription_set &subs) {
32 | subs.add("country", [](auto &obj) {
33 | return obj.country == "USA" || obj.country == "IE";
34 | });
35 | }).get();
36 |
37 | synced_realm.write([&synced_realm]() {
38 | realm::Person o;
39 | o._id = realm::object_id::generate();
40 | o.name = "foo";
41 | o.country = "USA";
42 | synced_realm.add(std::move(o));
43 | });
44 |
45 | synced_realm.get_sync_session()->wait_for_upload_completion().get();
46 | synced_realm.get_sync_session()->wait_for_download_completion().get();
47 |
48 | synced_realm.refresh();
49 |
50 | auto results = synced_realm.objects();
51 | auto token = results.observe([](auto change) {
52 | std::cout << "collection changed " << change.collection->size() << " objects in collection" << "\n";
53 | });
54 |
55 | std::cout << "Enter a name:" << "\n";
56 | std::string name;
57 | std::cin >> name;
58 |
59 | synced_realm.write([&]() {
60 | realm::Person p;
61 | p._id = realm::object_id::generate();
62 | p.name = name;
63 | p.country = "USA";
64 | synced_realm.add(std::move(p));
65 | });
66 |
67 | std::cout << results.size() << std::endl;
68 | std::cout << "Make some changes to the data from Atlas and watch the callback in real time." << std::endl;
69 |
70 | // Instantiating the runloop here just ensures the program allows the sync thread
71 | // time to push the changes. If you prefer a synchronous approach you can do
72 | // `synced_realm.get_sync_session()->wait_for_upload_completion().get();`
73 |
74 | #if REALM_HAVE_UV
75 | uv_run(uv_default_loop(), UV_RUN_DEFAULT);
76 | #elif __APPLE__
77 | CFRunLoopRun();
78 | #else
79 | #error "No EventLoop implementation selected"
80 | #endif
81 | return 0;
82 | }
83 |
--------------------------------------------------------------------------------
/examples/cmake/vcpkg.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": [
3 | "cpprealm"
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/include/cpprealm/analytics.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2022 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_ANALYTICS_HPP
20 | #define CPPREALM_ANALYTICS_HPP
21 |
22 | // Asynchronously submits build information to Realm if running in
23 | // DEBUG mode.
24 | //
25 | // To be clear: this does *not* run when your app is built with RELEASE mode;
26 | // To forcefully disable analytics set the REALM_DISABLE_ANALYTICS environment variable.
27 | //
28 | // Why are we doing this? In short, because it helps us build a better product
29 | // for you. None of the data personally identifies you, your employer or your
30 | // app, but it *will* help us understand what version of c++ you use, what host
31 | // you, etc. Having this info will help prioritizing our time,
32 | // adding new features and deprecating old features. Collecting an anonymized
33 | // bundle & anonymized MAC is the only way for us to count actual usage of the
34 | // other metrics accurately. If we don’t have a way to deduplicate the info
35 | // reported, it will be useless, as a single developer building their app
36 | // 10 times would report 10 times more than another single developer that
37 | // only builds once, making the data all but useless.
38 | // No one likes sharing data unless it’s necessary, we get it, and we’ve
39 | // debated adding this for a long long time. Since Realm is a free product
40 | // without an email signup, we feel this is a necessary step so we can collect
41 | // relevant data to build a better product for you. If you truly, absolutely
42 | // feel compelled to not send this data back to Realm, then you can set the environment variable
43 | // named REALM_DISABLE_ANALYTICS. Since Realm is free we believe
44 | // letting these analytics run is a small price to pay for the product & support
45 | // we give you.
46 | //
47 | // Currently the following information is reported:
48 | // - What version of Realm is being used, and which version of C++ you are using.
49 | // - What type of operating system you are using.
50 | // - An anonymous MAC address to aggregate the other information on.
51 | namespace realm {
52 | struct realm_analytics {
53 | static void send();
54 | };
55 | } // namespace realm
56 |
57 | #endif //CPPREALM_ANALYTICS_HPP
58 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/bridge/async_open_task.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_BRIDGE_ASYNC_OPEN_TASK_HPP
20 | #define CPPREALM_BRIDGE_ASYNC_OPEN_TASK_HPP
21 |
22 | #include
23 | #include
24 |
25 | namespace realm {
26 | class AsyncOpenTask;
27 |
28 | namespace internal::bridge {
29 | struct thread_safe_reference;
30 |
31 | struct async_open_task {
32 | async_open_task(std::shared_ptr&&); //NOLINT(google-explicit-constructor)
33 | void start(std::function &&fn) const;
34 | private:
35 | std::shared_ptr m_task;
36 | };
37 | }
38 | }
39 |
40 | #endif //CPPREALM_BRIDGE_ASYNC_OPEN_TASK_HPP
41 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/bridge/binary.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_BRIDGE_BINARY_HPP
20 | #define CPPREALM_BRIDGE_BINARY_HPP
21 |
22 | #include
23 | #include
24 |
25 | namespace realm {
26 | class BinaryData;
27 | class OwnedBinaryData;
28 | }
29 | namespace realm::internal::bridge {
30 | struct binary {
31 | binary();
32 | binary(const binary& other) ;
33 | binary& operator=(const binary& other) ;
34 | binary(binary&& other);
35 | binary& operator=(binary&& other);
36 | ~binary();
37 | binary(const BinaryData&); //NOLINT(google-explicit-constructor)
38 | binary(const std::vector&); //NOLINT(google-explicit-constructor)
39 | [[nodiscard]] const char* data() const;
40 | [[nodiscard]] size_t size() const;
41 | operator std::vector() const; //NOLINT(google-explicit-constructor)
42 | operator OwnedBinaryData() const; //NOLINT(google-explicit-constructor)
43 | operator BinaryData() const; //NOLINT(google-explicit-constructor)
44 | char operator[](size_t i) const noexcept;
45 | private:
46 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
47 | storage::OwnedBinaryData m_data[1];
48 | #else
49 | char* m_data;
50 | size_t m_size = 0;
51 | #endif
52 | };
53 |
54 | bool operator ==(const binary& lhs, const binary& rhs);
55 | bool operator !=(const binary& lhs, const binary& rhs);
56 | }
57 |
58 | #endif //CPPREALM_BRIDGE_BINARY_HPP
59 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/bridge/col_key.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_BRIDGE_COL_KEY_HPP
20 | #define CPPREALM_BRIDGE_COL_KEY_HPP
21 |
22 | #include
23 |
24 | namespace realm {
25 | struct ColKey;
26 | }
27 | namespace realm::internal::bridge {
28 | struct col_key {
29 | col_key() noexcept;
30 | col_key(const col_key& other) ;
31 | col_key& operator=(const col_key& other) ;
32 | col_key(col_key&& other);
33 | col_key& operator=(col_key&& other);
34 | ~col_key() = default;
35 | col_key(int64_t); //NOLINT(google-explicit-constructor)
36 | col_key(const ColKey&); //NOLINT(google-explicit-constructor)
37 | operator ColKey() const; //NOLINT(google-explicit-constructor)
38 | operator bool() const;
39 | [[nodiscard]] int64_t value() const;
40 | private:
41 | uint64_t m_col_key;
42 | };
43 | }
44 |
45 | #endif //CPPREALM_BRIDGE_COL_KEY_HPP
46 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/bridge/lnklst.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_LNKLST_HPP
20 | #define CPPREALM_LNKLST_HPP
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace realm {
27 | class LnkLst;
28 | }
29 | namespace realm::internal::bridge {
30 | struct obj;
31 | struct obj_key;
32 |
33 | struct lnklst {
34 | lnklst() ;
35 | lnklst(const lnklst& other) ;
36 | lnklst& operator=(const lnklst& other) ;
37 | lnklst(lnklst&& other);
38 | lnklst& operator=(lnklst&& other);
39 | ~lnklst();
40 | lnklst(const LnkLst&); // NOLINT
41 | operator LnkLst() const; //NOLINT
42 | obj create_and_insert_linked_object(size_t idx);
43 | void add(const obj_key&);
44 | private:
45 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
46 | storage::LnkLst m_lnk_lst[1];
47 | #else
48 | std::shared_ptr m_lnk_lst;
49 | #endif
50 | };
51 |
52 | }
53 |
54 | #endif //CPPREALM_LNKLST_HPP
55 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/bridge/obj_key.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_BRIDGE_OBJ_KEY_HPP
20 | #define CPPREALM_BRIDGE_OBJ_KEY_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace realm {
28 | struct ObjKey;
29 | struct ObjLink;
30 | }
31 |
32 | namespace realm::internal::bridge {
33 | struct obj_key {
34 | obj_key(const ObjKey&);
35 | obj_key(int64_t);
36 | obj_key();
37 | obj_key(const obj_key& other) = default;
38 | obj_key& operator=(const obj_key& other) = default;
39 | obj_key(obj_key&& other) = default;
40 | obj_key& operator=(obj_key&& other) = default;
41 | ~obj_key() = default;
42 | operator ObjKey() const;
43 | private:
44 | int64_t m_obj_key;
45 | };
46 |
47 | bool operator==(const obj_key &, const obj_key &);
48 |
49 | bool operator!=(const obj_key &, const obj_key &);
50 | }
51 |
52 | namespace realm::internal::bridge {
53 | struct obj_link {
54 | obj_link(const ObjLink&);
55 | obj_link();
56 | obj_link(const obj_link& other);
57 | obj_link(uint32_t table_key, obj_key obj_key);
58 | obj_link& operator=(const obj_link& other);
59 | obj_link(obj_link&& other);
60 | obj_link& operator=(obj_link&& other);
61 | ~obj_link();
62 | operator ObjLink() const;
63 | obj_key get_obj_key();
64 | uint32_t get_table_key();
65 | private:
66 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
67 | storage::ObjLink m_obj_link[1];
68 | #else
69 | std::shared_ptr m_obj_link;
70 | #endif
71 | };
72 |
73 | bool operator==(const obj_link &, const obj_link &);
74 |
75 | bool operator!=(const obj_link &, const obj_link &);
76 | }
77 |
78 |
79 | #endif //CPPREALM_BRIDGE_OBJ_KEY_HPP
80 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/bridge/object_id.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_BRIDGE_OBJECT_ID_HPP
20 | #define CPPREALM_BRIDGE_OBJECT_ID_HPP
21 |
22 | #include
23 | #include
24 |
25 | namespace realm {
26 | struct object_id;
27 | class ObjectId;
28 | }
29 |
30 | namespace realm::internal::bridge {
31 | struct object_id {
32 | object_id();
33 | object_id(const object_id& other) = default;
34 | object_id& operator=(const object_id& other) = default;
35 | object_id(object_id&& other) = default;
36 | object_id& operator=(object_id&& other) = default;
37 | ~object_id() = default;
38 | object_id(const ObjectId&); //NOLINT(google-explicit-constructor);
39 | explicit object_id(const std::string&);
40 | object_id(const struct ::realm::object_id&); //NOLINT(google-explicit-constructor);
41 | operator ObjectId() const; //NOLINT(google-explicit-constructor);
42 | operator ::realm::object_id() const; //NOLINT(google-explicit-constructor);
43 | [[nodiscard]] std::string to_string() const;
44 | [[nodiscard]] static object_id generate();
45 | private:
46 | std::array m_object_id;
47 |
48 | friend bool operator ==(const object_id&, const object_id&);
49 | friend bool operator !=(const object_id&, const object_id&);
50 | friend bool operator >(const object_id&, const object_id&);
51 | friend bool operator <(const object_id&, const object_id&);
52 | friend bool operator >=(const object_id&, const object_id&);
53 | friend bool operator <=(const object_id&, const object_id&);
54 | };
55 |
56 | bool operator ==(const object_id&, const object_id&);
57 | bool operator !=(const object_id&, const object_id&);
58 | bool operator >(const object_id&, const object_id&);
59 | bool operator <(const object_id&, const object_id&);
60 | bool operator >=(const object_id&, const object_id&);
61 | bool operator <=(const object_id&, const object_id&);
62 | }
63 |
64 | #endif //CPPREALM_BRIDGE_OBJECT_ID_HPP
65 |
66 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/bridge/object_schema.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_BRIDGE_OBJECT_SCHEMA_HPP
20 | #define CPPREALM_BRIDGE_OBJECT_SCHEMA_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace realm {
28 | class ObjectSchema;
29 | }
30 | namespace realm::internal::bridge {
31 | struct property;
32 |
33 | struct object_schema {
34 | enum class object_type : uint8_t { TopLevel = 0, Embedded = 0x1, TopLevelAsymmetric = 0x2 };
35 |
36 | object_schema();
37 |
38 | object_schema(const object_schema& other) ;
39 | object_schema& operator=(const object_schema& other) ;
40 | object_schema(object_schema&& other);
41 | object_schema& operator=(object_schema&& other);
42 | ~object_schema();
43 |
44 |
45 | object_schema(const std::string& name,
46 | const std::vector& properties,
47 | const std::string& primary_key,
48 | object_type type);
49 | object_schema(const ObjectSchema&);
50 | operator ObjectSchema() const;
51 | uint32_t table_key();
52 | void add_property(const property&);
53 |
54 | void set_name(const std::string& name);
55 | std::string get_name() const;
56 | void set_primary_key(const std::string& primary_key);
57 | void set_object_type(object_type);
58 | property property_for_name(const std::string&);
59 | bool operator==(const object_schema& rhs);
60 | private:
61 | ObjectSchema* get_object_schema();
62 | const ObjectSchema* get_object_schema() const;
63 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
64 | storage::ObjectSchema m_schema[1];
65 | #else
66 | std::shared_ptr m_schema;
67 | #endif
68 | };
69 | }
70 |
71 | #endif //CPPREALM_BRIDGE_OBJECT_SCHEMA_HPP
72 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/bridge/schema.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_BRIDGE_SCHEMA_HPP
20 | #define CPPREALM_BRIDGE_SCHEMA_HPP
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace realm {
27 | class Schema;
28 | }
29 | namespace realm::internal::bridge {
30 | struct object_schema;
31 |
32 | struct schema {
33 | schema();
34 | schema(const schema& other) ;
35 | schema& operator=(const schema& other) ;
36 | schema(schema&& other);
37 | schema& operator=(schema&& other);
38 | ~schema();
39 | schema(const std::vector&); //NOLINT(google-explicit-constructor)
40 | schema(const Schema&); //NOLINT(google-explicit-constructor)
41 | operator Schema() const; //NOLINT(google-explicit-constructor)
42 | object_schema find(const std::string &name);
43 | private:
44 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
45 | storage::Schema m_schema[1];
46 | #else
47 | std::shared_ptr m_schema;
48 | #endif
49 | };
50 | }
51 |
52 | #endif //CPPREALM_BRIDGE_SCHEMA_HPP
53 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/bridge/sync_manager.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_BRIDGE_SYNC_MANAGER_HPP
20 | #define CPPREALM_BRIDGE_SYNC_MANAGER_HPP
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | namespace realm {
28 | class SyncManager;
29 | class App;
30 | struct user;
31 |
32 | namespace internal::bridge {
33 | struct sync_manager {
34 | void set_log_level(logger::level);
35 | private:
36 | friend class ::realm::App;
37 | friend struct ::realm::user;
38 | sync_manager(const std::shared_ptr &);
39 | std::shared_ptr m_manager;
40 | };
41 | }
42 | }
43 |
44 | #endif //CPPREALM_BRIDGE_SYNC_MANAGER_HPP
45 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/bridge/thread_safe_reference.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_BRIDGE_THREAD_SAFE_REFERENCE_HPP
20 | #define CPPREALM_BRIDGE_THREAD_SAFE_REFERENCE_HPP
21 |
22 | #include
23 |
24 | namespace realm {
25 | class ThreadSafeReference;
26 | }
27 | namespace realm::internal::bridge {
28 | struct object;
29 | struct dictionary;
30 | struct realm;
31 |
32 | struct thread_safe_reference {
33 | thread_safe_reference();
34 | thread_safe_reference(const thread_safe_reference& other) = delete;
35 | thread_safe_reference& operator=(const thread_safe_reference& other) = delete;
36 | thread_safe_reference(thread_safe_reference&& other);
37 | thread_safe_reference& operator=(thread_safe_reference&& other);
38 | ~thread_safe_reference();
39 | thread_safe_reference(const object&);
40 | thread_safe_reference(const dictionary&);
41 | thread_safe_reference(ThreadSafeReference&&);
42 | operator ThreadSafeReference&&();
43 | operator bool() const; //NOLINT(google-explicit-constructor)
44 | private:
45 | friend struct realm;
46 | template
47 | friend T resolve(const realm&, thread_safe_reference&& tsr);
48 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
49 | storage::ThreadSafeReference m_thread_safe_reference[1];
50 | #else
51 | std::shared_ptr m_thread_safe_reference;
52 | #endif
53 | };
54 |
55 | }
56 |
57 | #endif //CPPREALM_BRIDGE_THREAD_SAFE_REFERENCE_HPP
58 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/bridge/uuid.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_BRIDGE_UUID_HPP
20 | #define CPPREALM_BRIDGE_UUID_HPP
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace realm {
27 | struct uuid;
28 | class UUID;
29 | }
30 |
31 | namespace realm::internal::bridge {
32 | struct uuid {
33 | uuid();
34 | uuid(const uuid& other) = default;
35 | uuid& operator=(const uuid& other) = default;
36 | uuid(uuid&& other) = default;
37 | uuid& operator=(uuid&& other) = default;
38 | ~uuid() = default;
39 | uuid(const UUID&); //NOLINT(google-explicit-constructor);
40 | explicit uuid(const std::string&);
41 | uuid(const std::array&);
42 | uuid(const struct ::realm::uuid&); //NOLINT(google-explicit-constructor);
43 | operator UUID() const; //NOLINT(google-explicit-constructor);
44 | operator ::realm::uuid() const; //NOLINT(google-explicit-constructor);
45 | [[nodiscard]] std::string to_string() const;
46 | [[nodiscard]] std::string to_base64() const;
47 | [[nodiscard]] std::array to_bytes() const;
48 | private:
49 | std::array m_uuid;
50 | friend bool operator ==(const uuid&, const uuid&);
51 | friend bool operator !=(const uuid&, const uuid&);
52 | friend bool operator >(const uuid&, const uuid&);
53 | friend bool operator <(const uuid&, const uuid&);
54 | friend bool operator >=(const uuid&, const uuid&);
55 | friend bool operator <=(const uuid&, const uuid&);
56 | };
57 |
58 | bool operator ==(const uuid&, const uuid&);
59 | bool operator !=(const uuid&, const uuid&);
60 | bool operator >(const uuid&, const uuid&);
61 | bool operator <(const uuid&, const uuid&);
62 | bool operator >=(const uuid&, const uuid&);
63 | bool operator <=(const uuid&, const uuid&);
64 | }
65 |
66 | #endif //CPPREALM_BRIDGE_UUID_HPP
67 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/networking/shims.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_SHIMS_HPP
20 | #define CPPREALM_SHIMS_HPP
21 |
22 | #include
23 | #include
24 |
25 | namespace realm {
26 | namespace sync {
27 | class SyncSocketProvider;
28 | }
29 | namespace app {
30 | struct GenericNetworkTransport;
31 | }
32 | }
33 |
34 | namespace realm::internal::networking {
35 | std::shared_ptr create_http_client_shim(const std::shared_ptr<::realm::networking::http_transport_client>&);
36 | std::unique_ptr<::realm::sync::SyncSocketProvider> create_sync_socket_provider_shim(const std::shared_ptr<::realm::networking::sync_socket_provider>& provider);
37 | }
38 |
39 | #endif //CPPREALM_SHIMS_HPP
40 |
--------------------------------------------------------------------------------
/include/cpprealm/internal/networking/utils.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_NETWORKING_UTILS_HPP
20 | #define CPPREALM_NETWORKING_UTILS_HPP
21 |
22 | #include
23 |
24 | #include
25 |
26 | namespace realm {
27 | namespace app {
28 | struct Request;
29 | struct Response;
30 | }
31 | namespace sync {
32 | struct WebSocketEndpoint;
33 | }
34 |
35 | namespace networking {
36 | struct request;
37 | struct response;
38 | }
39 | }
40 |
41 | namespace realm::internal::networking {
42 | ::realm::networking::request to_request(const ::realm::app::Request&);
43 | ::realm::app::Response to_core_response(const ::realm::networking::response&);
44 |
45 | ::realm::sync::WebSocketEndpoint to_core_websocket_endpoint(const ::realm::networking::websocket_endpoint& ep,
46 | const std::optional<::realm::networking::default_socket_provider::configuration>& config);
47 | ::realm::networking::websocket_endpoint to_websocket_endpoint(const ::realm::sync::WebSocketEndpoint& ep);
48 | } //namespace realm::internal::networking
49 |
50 | #endif //CPPREALM_NETWORKING_UTILS_HPP
51 |
--------------------------------------------------------------------------------
/include/cpprealm/logger.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_LOGGER_HPP
20 | #define CPPREALM_LOGGER_HPP
21 |
22 | #include
23 | #include
24 |
25 | namespace realm {
26 |
27 | struct logger {
28 | /// Specifies criticality when passed to log().
29 | ///
30 | /// error Be silent unless when there is an error.
31 | /// warn Be silent unless when there is an error or a warning.
32 | /// info Reveal information about what is going on, but in a
33 | /// minimalistic fashion to avoid general overhead from logging
34 | /// and to keep volume down.
35 | /// detail Same as 'info', but prioritize completeness over minimalism.
36 | /// debug Reveal information that can aid debugging, no longer paying
37 | /// attention to efficiency.
38 | /// trace A version of 'debug' that allows for very high volume
39 | /// output.
40 | enum class level { all = 0,
41 | trace = 1,
42 | debug = 2,
43 | detail = 3,
44 | info = 4,
45 | warn = 5,
46 | error = 6,
47 | fatal = 7,
48 | off = 8 };
49 | virtual void do_log(level, const std::string &) = 0;
50 | virtual inline ~logger() noexcept = default;
51 | void set_level_threshold(level l) {
52 | m_level_threshold = l;
53 | }
54 |
55 | level get_level_threshold() const {
56 | return m_level_threshold;
57 | }
58 | protected:
59 | level m_level_threshold;
60 | };
61 |
62 | void set_default_logger(std::shared_ptr &&);
63 | }
64 |
65 | #endif//CPPREALM_LOGGER_HPP
66 |
--------------------------------------------------------------------------------
/include/cpprealm/scheduler.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2022 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_SCHEDULER_HPP
20 | #define CPPREALM_SCHEDULER_HPP
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace realm {
27 | struct scheduler {
28 | virtual ~scheduler() = default;
29 |
30 | // Invoke the given function on the scheduler's thread.
31 | //
32 | // This function can be called from any thread.
33 | virtual void invoke(std::function &&) = 0;
34 |
35 | // Check if the caller is currently running on the scheduler's thread.
36 | //
37 | // This function can be called from any thread.
38 | [[nodiscard]] virtual bool is_on_thread() const noexcept = 0;
39 |
40 | // Checks if this scheduler instance wraps the same underlying instance.
41 | // This is up to the platforms to define, but if this method returns true,
42 | // caching may occur.
43 | virtual bool is_same_as(const scheduler *other) const noexcept = 0;
44 |
45 | // Check if this scheduler actually can support invoke(). Invoking may be
46 | // either not implemented, not applicable to a scheduler type, or simply not
47 | // be possible currently (e.g. if the associated event loop is not actually
48 | // running).
49 | //
50 | // This function is not thread-safe.
51 | [[nodiscard]] virtual bool can_invoke() const noexcept = 0;
52 | };
53 | }
54 | #endif //CPPREALM_SCHEDULER_HPP
55 |
--------------------------------------------------------------------------------
/include/cpprealm/schedulers/default_scheduler.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2024 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the >License>);
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an >AS IS> BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_DEFAULT_SCHEDULERS_HPP
20 | #define CPPREALM_DEFAULT_SCHEDULERS_HPP
21 |
22 | #include
23 |
24 | #if __has_include()
25 | #include
26 | #endif
27 |
28 | #if defined(REALM_HAVE_UV) && REALM_HAVE_UV
29 | typedef struct uv_loop_s uv_loop_t;
30 | #endif
31 |
32 | namespace realm::default_scheduler {
33 | /**
34 | * Tries to choose a built in scheduler as default for the platform
35 | * Current options are:
36 | * - CFRunLoop for Apple platforms
37 | * - UV for Linux and Windows
38 | * - ALooper for Android
39 | * If no suitable scheduler is available a generic scheduler will be provided.
40 | */
41 | std::shared_ptr make_platform_default();
42 |
43 | /**
44 | * Register a factory function which can produce custom schedulers when
45 | * `scheduler::make_default()` is called. This function is not thread-safe
46 | * and must be called before any schedulers are created.
47 | */
48 | void set_default_factory(std::function()>&& factory_fn);
49 |
50 | /**
51 | * Create a new instance of the scheduler type returned by the default
52 | * scheduler factory. By default, the factory function is
53 | * `scheduler::make_platform_default()`.
54 | */
55 | std::shared_ptr make_default();
56 | } // namespace realm
57 |
58 | #endif//CPPREALM_DEFAULT_SCHEDULERS_HPP
59 |
--------------------------------------------------------------------------------
/include/cpprealm/sdk.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2022 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the >License>);
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an >AS IS> BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_SDK_HPP
20 | #define CPPREALM_SDK_HPP
21 |
22 | #if __has_include()
23 | #include
24 | #endif
25 |
26 | #include
27 |
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 | #include
34 | #include
35 |
36 | #include
37 | #include
38 | #include
39 | #include
40 | #include
41 | #include
42 | #include
43 | #include
44 | #include
45 | #include
46 | #include
47 | #include
48 | #include
49 | #include
50 | #include
51 | #include
52 | #include
53 | #include
54 |
55 | #endif /* CPPREALM_SDK_HPP */
56 |
--------------------------------------------------------------------------------
/include/cpprealm/thread_safe_reference.hpp:
--------------------------------------------------------------------------------
1 | ////////////////////////////////////////////////////////////////////////////
2 | //
3 | // Copyright 2022 Realm Inc.
4 | //
5 | // Licensed under the Apache License, Version 2.0 (the "License");
6 | // you may not use this file except in compliance with the License.
7 | // You may obtain a copy of the License at
8 | //
9 | // http://www.apache.org/licenses/LICENSE-2.0
10 | //
11 | // Unless required by applicable law or agreed to in writing, software
12 | // distributed under the License is distributed on an "AS IS" BASIS,
13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | // See the License for the specific language governing permissions and
15 | // limitations under the License.
16 | //
17 | ////////////////////////////////////////////////////////////////////////////
18 |
19 | #ifndef CPPREALM_THREAD_SAFE_REFERENCE_HPP
20 | #define CPPREALM_THREAD_SAFE_REFERENCE_HPP
21 |
22 | #include
23 |
24 | namespace realm {
25 |
26 | template
27 | struct thread_safe_reference {
28 | explicit thread_safe_reference(const managed& object)
29 | : m_tsr(internal::bridge::thread_safe_reference(internal::bridge::object(object.m_realm, object.m_obj))) { }
30 | private:
31 | internal::bridge::thread_safe_reference m_tsr;
32 | friend struct db;
33 | };
34 | }
35 |
36 | #endif /* CPPREALM_THREAD_SAFE_REFERENCE_HPP */
37 |
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realm/realm-cpp/62ba127cfddbd551e520ebb2be881947078c70ef/logo.png
--------------------------------------------------------------------------------
/ports/portfile.cmake:
--------------------------------------------------------------------------------
1 | cmake_path(GET CMAKE_CURRENT_LIST_DIR PARENT_PATH SOURCE_PATH)
2 |
3 | find_program(GIT git)
4 |
5 | vcpkg_execute_required_process(
6 | COMMAND ${GIT} submodule update --init --recursive
7 | WORKING_DIRECTORY ${SOURCE_PATH}
8 | LOGNAME submodules
9 | )
10 |
11 | set(CPPREALM_CMAKE_OPTIONS -DREALM_CPP_NO_TESTS=ON -DREALM_ENABLE_EXPERIMENTAL=ON)
12 |
13 | if (ANDROID OR WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
14 | list(APPEND CPPREALM_CMAKE_OPTIONS -DREALM_USE_SYSTEM_OPENSSL=ON)
15 | endif()
16 |
17 | vcpkg_cmake_configure(
18 | SOURCE_PATH "${SOURCE_PATH}"
19 | DISABLE_PARALLEL_CONFIGURE
20 | OPTIONS
21 | ${CPPREALM_CMAKE_OPTIONS}
22 | )
23 |
24 | vcpkg_cmake_install()
25 |
26 | vcpkg_cmake_config_fixup(PACKAGE_NAME "cpprealm" CONFIG_PATH "cmake")
27 |
28 | file(READ ${CURRENT_PACKAGES_DIR}/debug/include/cpprealm/internal/bridge/bridge_types.hpp DEBUG_TYPE_HEADER_CONTENTS)
29 | set(REGEX_PATTERN "\\{([^()]*)\\}")
30 | string(REGEX MATCHALL "${REGEX_PATTERN}" MATCHED_CONTENT "${DEBUG_TYPE_HEADER_CONTENTS}")
31 | set(MATCHED_DEBUG_TYPE_HEADER_CONTENTS "${CMAKE_MATCH_1}")
32 |
33 | file(READ ${CURRENT_PACKAGES_DIR}/include/cpprealm/internal/bridge/bridge_types.hpp RELEASE_TYPE_HEADER_CONTENTS)
34 | set(REGEX_PATTERN "\\{([^()]*)\\}")
35 | string(REGEX MATCHALL "${REGEX_PATTERN}" MATCHED_CONTENT "${RELEASE_TYPE_HEADER_CONTENTS}")
36 | set(MATCHED_RELEASE_TYPE_HEADER_CONTENTS "${CMAKE_MATCH_1}")
37 |
38 | string(REGEX REPLACE "\\{([^()]*)\\}" "
39 | {
40 | #ifdef REALM_DEBUG
41 | ${MATCHED_DEBUG_TYPE_HEADER_CONTENTS}
42 | #else
43 | ${MATCHED_RELEASE_TYPE_HEADER_CONTENTS}
44 | #endif
45 | }
46 | " MODIFIED_HEADER "${DEBUG_TYPE_HEADER_CONTENTS}")
47 |
48 | file(WRITE ${CURRENT_PACKAGES_DIR}/include/cpprealm/internal/bridge/bridge_types.hpp "${MODIFIED_HEADER}")
49 | file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
50 |
51 | file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
52 | vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
53 |
--------------------------------------------------------------------------------
/ports/usage:
--------------------------------------------------------------------------------
1 | cpprealm provides CMake targets:
2 |
3 | find_package(cpprealm CONFIG REQUIRED)
4 | target_link_libraries(main PRIVATE cpprealm)
--------------------------------------------------------------------------------
/ports/vcpkg.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "cpprealm",
3 | "version": "2.2.0",
4 | "description": "Realm is a mobile database that runs directly inside phones, tablets or wearables.",
5 | "homepage": "https://github.com/realm/realm-cpp",
6 | "license": "Apache-2.0",
7 | "supports": "!emscripten",
8 | "dependencies": [
9 | {
10 | "name": "vcpkg-cmake",
11 | "host": true
12 | },
13 | {
14 | "name": "vcpkg-cmake-config",
15 | "host": true
16 | },
17 | {
18 | "name": "libuv",
19 | "version>=": "1.43.0",
20 | "platform": "!osx"
21 | },
22 | {
23 | "name": "realm-core",
24 | "version>=": "14.10.4"
25 | }
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/src/cpprealm/client_reset.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | namespace realm {
6 |
7 | namespace client_reset {
8 | manual::manual() {
9 | m_mode = client_reset_mode::manual;
10 | }
11 |
12 | discard_unsynced_changes::discard_unsynced_changes(std::function before,
13 | std::function after) {
14 | m_before = std::move(before);
15 | m_after = std::move(after);
16 | m_mode = client_reset_mode::discard_unsynced;
17 | }
18 |
19 | recover_unsynced_changes::recover_unsynced_changes(std::function before,
20 | std::function after) {
21 | m_before = std::move(before);
22 | m_after = std::move(after);
23 | m_mode = client_reset_mode::recover;
24 | }
25 |
26 | recover_or_discard_unsynced_changes::recover_or_discard_unsynced_changes(std::function before,
27 | std::function after) {
28 | m_before = std::move(before);
29 | m_after = std::move(after);
30 | m_mode = client_reset_mode::recover_or_discard;
31 | }
32 | }
33 |
34 | } //namespace realm
--------------------------------------------------------------------------------
/src/cpprealm/db.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | namespace realm {
5 | ::realm::sync_subscription_set db::subscriptions() {
6 | return ::realm::sync_subscription_set(m_realm);
7 | }
8 |
9 | bool db::is_frozen() const {
10 | return m_realm.is_frozen();
11 | }
12 | db db::freeze() {
13 | return db(m_realm.freeze());
14 | }
15 |
16 | db db::thaw() {
17 | return db(m_realm.thaw());
18 | }
19 |
20 | void db::invalidate() {
21 | m_realm.invalidate();
22 | }
23 |
24 | void db::close() {
25 | m_realm.close();
26 | }
27 |
28 | bool db::is_closed() {
29 | return m_realm.is_closed();
30 | }
31 |
32 | bool operator==(const db& lhs, const db& rhs) {
33 | return lhs.m_realm == rhs.m_realm;
34 | }
35 | bool operator!=(const db& lhs, const db& rhs) {
36 | return lhs.m_realm != rhs.m_realm;
37 | }
38 |
39 | } // namespace realm
40 |
--------------------------------------------------------------------------------
/src/cpprealm/internal/bridge/async_open_task.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 | #include
6 |
7 | namespace realm::internal::bridge {
8 | async_open_task::async_open_task(std::shared_ptr &&v) {
9 | m_task = std::move(v);
10 | }
11 |
12 | void async_open_task::start(std::function &&fn) const {
13 | m_task->start([fn = std::move(fn)](ThreadSafeReference tsr, std::exception_ptr ptr) -> void {
14 | fn(thread_safe_reference(std::move(tsr)), ptr);
15 | });
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/cpprealm/internal/bridge/bridge_types.hpp.in:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #define CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
6 |
7 | namespace realm::internal::bridge::storage {
8 | @BRIDGE_TYPE_DECLS@
9 | }
10 |
--------------------------------------------------------------------------------
/src/cpprealm/internal/bridge/col_key.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | namespace realm::internal::bridge {
5 | col_key::col_key() noexcept {
6 | m_col_key = ColKey::null_value;
7 | }
8 | col_key::col_key(const col_key& other) {
9 | m_col_key = other.m_col_key;
10 | }
11 | col_key& col_key::operator=(const col_key& other) {
12 | m_col_key = other.m_col_key;
13 | return *this;
14 | }
15 | col_key::col_key(col_key&& other) {
16 | m_col_key = std::move(other.m_col_key);
17 | }
18 | col_key& col_key::operator=(col_key&& other) {
19 | m_col_key = std::move(other.m_col_key);
20 | return *this;
21 | }
22 |
23 | col_key::col_key(int64_t v) {
24 | m_col_key = v;
25 | }
26 | col_key::col_key(const ::realm::ColKey &v) {
27 | m_col_key = v.value;
28 | }
29 |
30 | int64_t col_key::value() const {
31 | return m_col_key;
32 | }
33 | col_key::operator bool() const {
34 | return ColKey(m_col_key).operator bool();
35 | }
36 | col_key::operator ColKey() const {
37 | return ColKey(m_col_key);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/cpprealm/internal/bridge/generator/bridge_type_info_generator.cpp.in:
--------------------------------------------------------------------------------
1 | #if defined(_MSC_VER)
2 | #define _WINSOCKAPI_
3 | #endif
4 |
5 | @BRIDGE_TYPE_HEADER_DECLS@
6 |
7 | #undef KEY
8 | #if defined(__i386)
9 | # define KEY '_','_','i','3','8','6'
10 | #elif defined(__x86_64)
11 | # define KEY '_','_','x','8','6','_','6','4'
12 | #elif defined(__ppc__)
13 | # define KEY '_','_','p','p','c','_','_'
14 | #elif defined(__ppc64__)
15 | # define KEY '_','_','p','p','c','6','4','_','_'
16 | #elif defined(__aarch64__)
17 | # define KEY '_','_','a','a','r','c','h','6','4','_','_'
18 | #elif defined(__ARM_ARCH_7A__)
19 | # define KEY '_','_','A','R','M','_','A','R','C','H','_','7','A','_','_'
20 | #elif defined(__ARM_ARCH_7S__)
21 | # define KEY '_','_','A','R','M','_','A','R','C','H','_','7','S','_','_'
22 | #endif
23 |
24 | int main()
25 | {
26 | int required = 0;
27 |
28 | #define REALM_TYPE_INFO(NAME, EXPRESSION, ...) \
29 | static char info_##NAME[] = {'R', 'E', 'A', 'L', 'M', '_', 'T', 'Y', 'P', 'E', '_', 'I', 'N', 'F', 'O', ':', __VA_ARGS__,'[', \
30 | ('0' + ((sizeof(EXPRESSION) / 10000)%10)), \
31 | ('0' + ((sizeof(EXPRESSION) / 1000)%10)), \
32 | ('0' + ((sizeof(EXPRESSION) / 100)%10)), \
33 | ('0' + ((sizeof(EXPRESSION) / 10)%10)), \
34 | ('0' + (sizeof(EXPRESSION) % 10)), \
35 | ',', \
36 | ('0' + ((alignof(EXPRESSION) / 10000)%10)), \
37 | ('0' + ((alignof(EXPRESSION) / 1000)%10)), \
38 | ('0' + ((alignof(EXPRESSION) / 100)%10)), \
39 | ('0' + ((alignof(EXPRESSION) / 10)%10)), \
40 | ('0' + (alignof(EXPRESSION) % 10)), \
41 | ']', \
42 | '\0'}; \
43 | required += info_##NAME[0]
44 |
45 | @TYPE_INFO_QUERY_DECLS@
46 |
47 | return required;
48 | }
--------------------------------------------------------------------------------
/src/cpprealm/internal/bridge/generator/bridge_type_info_parser.cmake:
--------------------------------------------------------------------------------
1 | file(STRINGS ${BRIDGE_TYPE_INFO_BIN} compiled_string_literals REGEX "^REALM_TYPE_INFO")
2 |
3 | set(regex "REALM_TYPE_INFO:(.+)\\[0*(.*),0*(.*)\\]")
4 | set(BRIDGE_TYPE_DECLS "")
5 |
6 | foreach(i ${compiled_string_literals})
7 | if("${i}" MATCHES "${regex}")
8 | set(BRIDGE_TYPE_DECLS "${BRIDGE_TYPE_DECLS} using ${CMAKE_MATCH_1} = std::aligned_storage<${CMAKE_MATCH_2}, ${CMAKE_MATCH_3}>::type;\n")
9 | else()
10 | message(FATAL_ERROR "Unrecognized type info string: " ${h})
11 | endif()
12 | endforeach()
13 |
14 | configure_file(${SOURCE_DIR}/bridge_types.hpp.in ${BINARY_DIR}/bridge_types.hpp)
15 |
--------------------------------------------------------------------------------
/src/cpprealm/internal/bridge/lnklst.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 |
7 | namespace realm::internal::bridge {
8 |
9 | lnklst::lnklst() {
10 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
11 | new (&m_lnk_lst) LnkLst();
12 | #else
13 | m_lnk_lst = std::make_shared();
14 | #endif
15 | }
16 |
17 | lnklst::lnklst(const lnklst& other) {
18 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
19 | new (&m_lnk_lst) LnkLst(*reinterpret_cast(&other.m_lnk_lst));
20 | #else
21 | m_lnk_lst = other.m_lnk_lst;
22 | #endif
23 | }
24 |
25 | lnklst& lnklst::operator=(const lnklst& other) {
26 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
27 | if (this != &other) {
28 | *reinterpret_cast(&m_lnk_lst) = *reinterpret_cast(&other.m_lnk_lst);
29 | }
30 | #else
31 | m_lnk_lst = other.m_lnk_lst;
32 | #endif
33 | return *this;
34 | }
35 |
36 | lnklst::lnklst(lnklst&& other) {
37 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
38 | new (&m_lnk_lst) LnkLst(std::move(*reinterpret_cast(&other.m_lnk_lst)));
39 | #else
40 | m_lnk_lst = std::move(other.m_lnk_lst);
41 | #endif
42 | }
43 |
44 | lnklst& lnklst::operator=(lnklst&& other) {
45 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
46 | if (this != &other) {
47 | *reinterpret_cast(&m_lnk_lst) = std::move(*reinterpret_cast(&other.m_lnk_lst));
48 | }
49 | #else
50 | m_lnk_lst = std::move(other.m_lnk_lst);
51 | #endif
52 | return *this;
53 | }
54 |
55 | lnklst::~lnklst() {
56 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
57 | reinterpret_cast(&m_lnk_lst)->~LnkLst();
58 | #endif
59 | }
60 |
61 | lnklst::lnklst(const LnkLst &v) {
62 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
63 | new (&m_lnk_lst) LnkLst(v);
64 | #else
65 | m_lnk_lst = std::make_shared(v);
66 | #endif
67 | }
68 |
69 | obj lnklst::create_and_insert_linked_object(size_t idx) {
70 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
71 | return reinterpret_cast(&m_lnk_lst)->create_and_insert_linked_object(idx);
72 | #else
73 | return m_lnk_lst->create_and_insert_linked_object(idx);
74 | #endif
75 | }
76 |
77 | void lnklst::add(const obj_key &v) {
78 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
79 | return reinterpret_cast(&m_lnk_lst)->add(v);
80 | #else
81 | return m_lnk_lst->add(v);
82 | #endif
83 | }
84 |
85 | lnklst::operator LnkLst() const {
86 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
87 | return *reinterpret_cast(&m_lnk_lst);
88 | #else
89 | return *m_lnk_lst;
90 | #endif
91 | }
92 | }
--------------------------------------------------------------------------------
/src/cpprealm/internal/bridge/object_id.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | namespace realm::internal::bridge {
9 | object_id::object_id() {
10 | m_object_id = ObjectId().to_bytes();
11 | }
12 |
13 | object_id::object_id(const std::string &v) {
14 | m_object_id = ObjectId(v).to_bytes();
15 | }
16 |
17 | object_id::object_id(const ::realm::object_id &v) {
18 | m_object_id = ObjectId(v.to_string()).to_bytes();
19 | }
20 |
21 | object_id::object_id(const ObjectId &v) {
22 | m_object_id = ObjectId(v).to_bytes();
23 | }
24 |
25 | std::string object_id::to_string() const {
26 | return ObjectId(m_object_id).to_string();
27 | }
28 |
29 | object_id object_id::generate() {
30 | return ObjectId::gen();
31 | }
32 |
33 | object_id::operator ::realm::object_id() const {
34 | return ::realm::object_id(*this);
35 | }
36 |
37 | object_id::operator ObjectId() const {
38 | return ObjectId(m_object_id);
39 | }
40 |
41 | bool operator ==(const object_id& a, const object_id& b) {
42 | return ObjectId(a.m_object_id) == ObjectId(b.m_object_id);
43 | }
44 |
45 | bool operator !=(const object_id& a, const object_id& b) {
46 | return ObjectId(a.m_object_id) != ObjectId(b.m_object_id);
47 | }
48 |
49 | bool operator >(const object_id& a, const object_id& b) {
50 | return ObjectId(a.m_object_id) > ObjectId(b.m_object_id);
51 | }
52 |
53 | bool operator <(const object_id& a, const object_id& b) {
54 | return ObjectId(a.m_object_id) < ObjectId(b.m_object_id);
55 | }
56 |
57 | bool operator >=(const object_id& a, const object_id& b) {
58 | return ObjectId(a.m_object_id) >= ObjectId(b.m_object_id);
59 | }
60 |
61 | bool operator <=(const object_id& a, const object_id& b) {
62 | return ObjectId(a.m_object_id) <= ObjectId(b.m_object_id);
63 | }
64 | }
--------------------------------------------------------------------------------
/src/cpprealm/internal/bridge/schema.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include
5 | #include
6 |
7 | namespace realm::internal::bridge {
8 | schema::schema() {
9 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
10 | new (&m_schema) Schema();
11 | #else
12 | m_schema = std::make_shared();
13 | #endif
14 | }
15 |
16 | schema::schema(const schema& other) {
17 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
18 | new (&m_schema) Schema(*reinterpret_cast(&other.m_schema));
19 | #else
20 | m_schema = other.m_schema;
21 | #endif
22 | }
23 |
24 | schema& schema::operator=(const schema& other) {
25 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
26 | if (this != &other) {
27 | *reinterpret_cast(&m_schema) = *reinterpret_cast(&other.m_schema);
28 | }
29 | #else
30 | m_schema = other.m_schema;
31 | #endif
32 | return *this;
33 | }
34 |
35 | schema::schema(schema&& other) {
36 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
37 | new (&m_schema) Schema(std::move(*reinterpret_cast(&other.m_schema)));
38 | #else
39 | m_schema = std::move(other.m_schema);
40 | #endif
41 | }
42 |
43 | schema& schema::operator=(schema&& other) {
44 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
45 | if (this != &other) {
46 | *reinterpret_cast(&m_schema) = std::move(*reinterpret_cast(&other.m_schema));
47 | }
48 | #else
49 | m_schema = std::move(other.m_schema);
50 | #endif
51 | return *this;
52 | }
53 |
54 | schema::~schema() {
55 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
56 | reinterpret_cast(&m_schema)->~Schema();
57 | #endif
58 | }
59 |
60 | object_schema schema::find(const std::string &name) {
61 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
62 | return *reinterpret_cast(&m_schema)->find(name);
63 | #else
64 | return *m_schema->find(name);
65 | #endif
66 | }
67 |
68 | schema::schema(const std::vector &v) {
69 | std::vector v2;
70 | for (auto& os : v) {
71 | v2.push_back(os);
72 | }
73 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
74 | new (&m_schema) Schema(v2);
75 | #else
76 | m_schema = std::make_shared(v2);
77 | #endif
78 | }
79 |
80 | schema::operator Schema() const {
81 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
82 | return *reinterpret_cast(&m_schema);
83 | #else
84 | return *m_schema;
85 | #endif
86 | }
87 |
88 | schema::schema(const realm::Schema &v) {
89 | #ifdef CPPREALM_HAVE_GENERATED_BRIDGE_TYPES
90 | new (&m_schema) Schema(v);
91 | #else
92 | m_schema = std::make_shared(v);
93 | #endif
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/src/cpprealm/internal/bridge/sync_manager.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 |
5 | namespace realm::internal::bridge {
6 |
7 | sync_manager::sync_manager(const std::shared_ptr &v) {
8 | m_manager = v;
9 | }
10 |
11 | void sync_manager::set_log_level(logger::level level) {
12 | m_manager->set_log_level(static_cast(level));
13 | }
14 | }
--------------------------------------------------------------------------------
/src/cpprealm/internal/bridge/timestamp.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | namespace realm::internal::bridge {
6 | timestamp::timestamp(const realm::Timestamp &v) {
7 | m_seconds = v.get_seconds();
8 | m_nanoseconds = v.get_nanoseconds();
9 | }
10 |
11 | timestamp::timestamp(int64_t seconds, int32_t nanoseconds) {
12 | m_seconds = seconds;
13 | m_nanoseconds = nanoseconds;
14 | }
15 |
16 | timestamp::timestamp(const std::chrono::time_point &tp) {
17 | auto ts = Timestamp(tp);
18 | m_seconds = ts.get_seconds();
19 | m_nanoseconds = ts.get_nanoseconds();
20 | }
21 | timestamp::operator std::chrono::time_point() const {
22 | return Timestamp(m_seconds, m_nanoseconds).get_time_point();
23 | }
24 |
25 | int64_t timestamp::get_seconds() const noexcept {
26 | return m_seconds;
27 | }
28 |
29 | int32_t timestamp::get_nanoseconds() const noexcept {
30 | return m_nanoseconds;
31 | }
32 |
33 | timestamp::operator Timestamp() const {
34 | return Timestamp(m_seconds, m_nanoseconds);
35 | }
36 |
37 | #define __cpp_realm_gen_timestamp_op(op) \
38 | bool operator op(const timestamp& a, const timestamp& b) { \
39 | return a.operator Timestamp() op b.operator Timestamp(); \
40 | } \
41 |
42 | __cpp_realm_gen_timestamp_op(==)
43 | __cpp_realm_gen_timestamp_op(!=)
44 | __cpp_realm_gen_timestamp_op(>)
45 | __cpp_realm_gen_timestamp_op(<)
46 | __cpp_realm_gen_timestamp_op(>=)
47 | __cpp_realm_gen_timestamp_op(<=)
48 | }
49 |
--------------------------------------------------------------------------------
/src/cpprealm/internal/bridge/uuid.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 |
6 | namespace realm::internal::bridge {
7 | uuid::uuid() {
8 | m_uuid = UUID::UUIDBytes();
9 | }
10 |
11 | uuid::uuid(const std::string& v) {
12 | m_uuid = UUID(v).to_bytes();
13 | }
14 |
15 | uuid::uuid(const std::array& v) {
16 | m_uuid = v;
17 | }
18 |
19 | uuid::uuid(const ::realm::uuid &v)
20 | {
21 | m_uuid = UUID(v.to_string()).to_bytes();
22 | }
23 |
24 | uuid::uuid(const UUID &v) {
25 | m_uuid = UUID(v).to_bytes();
26 | }
27 |
28 | std::string uuid::to_string() const {
29 | return UUID(m_uuid).to_string();
30 | }
31 |
32 | uuid::operator ::realm::uuid() const {
33 | return ::realm::uuid(*this);
34 | }
35 |
36 | uuid::operator UUID() const {
37 | return UUID(m_uuid);
38 | }
39 |
40 | std::string uuid::to_base64() const {
41 | return UUID(m_uuid).to_base64();
42 | }
43 |
44 | std::array uuid::to_bytes() const {
45 | return m_uuid;
46 | }
47 |
48 | #define __cpp_realm_gen_uuid_op(op) \
49 | bool operator op(const uuid& a, const uuid& b) { \
50 | return a.operator UUID() op b.operator UUID(); \
51 | }
52 |
53 | __cpp_realm_gen_uuid_op(==)
54 | __cpp_realm_gen_uuid_op(!=)
55 | __cpp_realm_gen_uuid_op(>)
56 | __cpp_realm_gen_uuid_op(<)
57 | __cpp_realm_gen_uuid_op(>=)
58 | __cpp_realm_gen_uuid_op(<=)
59 | }
--------------------------------------------------------------------------------
/src/cpprealm/internal/scheduler/realm_core_scheduler.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 |
5 | namespace realm::internal {
6 | void realm_core_scheduler::invoke(std::function &&fn) {
7 | s->invoke(std::move(fn));
8 | }
9 |
10 | [[nodiscard]] bool realm_core_scheduler::is_on_thread() const noexcept {
11 | return s->is_on_thread();
12 | }
13 |
14 | bool realm_core_scheduler::is_same_as(const scheduler *other) const noexcept {
15 | if (auto o = dynamic_cast(other)) {
16 | return o->s->is_same_as(this->s.get());
17 | }
18 | return false;
19 | }
20 |
21 | [[nodiscard]] bool realm_core_scheduler::can_invoke() const noexcept {
22 | return s->can_invoke();
23 | }
24 |
25 | realm_core_scheduler::operator std::shared_ptr() {
26 | return s;
27 | }
28 |
29 | std::shared_ptr create_scheduler_shim(const std::shared_ptr& s) {
30 | struct internal_scheduler : util::Scheduler {
31 | internal_scheduler(const std::shared_ptr& s)
32 | : m_scheduler(s)
33 | {
34 | }
35 |
36 | ~internal_scheduler() override = default;
37 | void invoke(util::UniqueFunction &&fn) override {
38 | m_scheduler->invoke([fn = std::move(fn.release())]() {
39 | auto f = util::UniqueFunction(std::move(fn));
40 | f();
41 | });
42 | }
43 |
44 | bool is_on_thread() const noexcept override {
45 | return m_scheduler->is_on_thread();
46 | }
47 | bool is_same_as(const util::Scheduler *other) const noexcept override {
48 | if (auto o = dynamic_cast(other)) {
49 | return m_scheduler->is_same_as(o->m_scheduler.get());
50 | }
51 | return false;
52 | }
53 |
54 | bool can_invoke() const noexcept override {
55 | return m_scheduler->can_invoke();
56 | }
57 | private:
58 | std::shared_ptr m_scheduler;
59 | };
60 |
61 | return std::make_shared(s);
62 | }
63 | }
--------------------------------------------------------------------------------
/src/cpprealm/internal/version_numbers.hpp.in:
--------------------------------------------------------------------------------
1 | /*************************************************************************
2 | *
3 | * Copyright 2023 Realm Inc.
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | *
17 | **************************************************************************/
18 |
19 | #ifndef REALMCXX_VERSION_NUMBERS_HPP
20 | #define REALMCXX_VERSION_NUMBERS_HPP
21 |
22 | // Do not use `cmakedefine` here, as certain versions can be 0, which CMake
23 | // interprets as being undefined.
24 | #define REALMCXX_VERSION_MAJOR @CONFIG_REALMCXX_VERSION_MAJOR@
25 | #define REALMCXX_VERSION_MINOR @CONFIG_REALMCXX_VERSION_MINOR@
26 | #define REALMCXX_VERSION_PATCH @CONFIG_REALMCXX_VERSION_PATCH@
27 | #define REALMCXX_VERSION_STRING "@CONFIG_REALMCXX_VERSION@"
28 |
29 | #endif // REALMCXX_VERSION_NUMBERS_HPP
--------------------------------------------------------------------------------
/src/cpprealm/managed_binary.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | namespace realm {
5 | std::vector managed>::detach() const {
6 | return m_obj->template get(m_key);
7 | }
8 |
9 | [[nodiscard]] managed>::operator std::vector() const {
10 | return m_obj->template get(m_key);
11 | }
12 |
13 | std::vector managed>::operator*() const {
14 | return detach();
15 | }
16 |
17 | void managed>::push_back(uint8_t v) {
18 | auto v2 = m_obj->template get(m_key).operator std::vector();
19 | v2.push_back(v);
20 | m_obj->template set(m_key, v2);
21 | }
22 |
23 | uint8_t managed>::operator[](uint8_t idx) const {
24 | return m_obj->template get(m_key)[idx];
25 | }
26 |
27 | size_t managed>::size() const {
28 | return m_obj->template get(m_key).size();
29 | }
30 |
31 | __cpprealm_build_query(==, equal, std::vector)
32 | __cpprealm_build_query(!=, not_equal, std::vector)
33 |
34 | // MARK: Optional
35 |
36 | std::optional> managed>>::detach() const {
37 | return m_obj->get_optional(m_key);
38 | }
39 |
40 | [[nodiscard]] managed>>::operator std::optional>() const {
41 | return m_obj->get_optional(m_key);
42 | }
43 |
44 | void managed>>::box::push_back(uint8_t v) {
45 | if (auto b = m_parent.get().m_obj->get_optional(m_parent.get().m_key)) {
46 | auto v2 = b->operator std::vector();
47 | v2.push_back(v);
48 | m_parent.get().m_obj->template set(m_parent.get().m_key, v2);
49 | }
50 |
51 | }
52 |
53 | uint8_t managed>>::box::operator[](uint8_t idx) const {
54 | auto b = m_parent.get().m_obj->get_optional(m_parent.get().m_key);
55 | return b->operator[](idx);
56 | }
57 |
58 | size_t managed>>::box::size() const {
59 | return m_parent.get().m_obj->template get(m_parent.get().m_key).size();
60 | }
61 |
62 | __cpprealm_build_optional_query(==, equal, std::vector)
63 | __cpprealm_build_optional_query(!=, not_equal, std::vector)
64 | }
65 |
--------------------------------------------------------------------------------
/src/cpprealm/managed_numeric.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | namespace realm {
4 | __cpprealm_build_query(==, equal, bool)
5 | __cpprealm_build_query(!=, not_equal, bool)
6 |
7 | __cpprealm_build_optional_query(==, equal, int64_t)
8 | __cpprealm_build_optional_query(!=, not_equal, int64_t)
9 |
10 | __cpprealm_build_optional_query(==, equal, double)
11 | __cpprealm_build_optional_query(!=, not_equal, double)
12 |
13 | __cpprealm_build_optional_query(==, equal, bool)
14 | __cpprealm_build_optional_query(!=, not_equal, bool)
15 | }
--------------------------------------------------------------------------------
/src/cpprealm/managed_objectid.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | namespace realm {
5 | __cpprealm_build_query(==, equal, realm::object_id)
6 | __cpprealm_build_query(!=, not_equal, realm::object_id)
7 | __cpprealm_build_optional_query(==, equal, realm::object_id)
8 | __cpprealm_build_optional_query(!=, not_equal, realm::object_id)
9 | }
10 |
--------------------------------------------------------------------------------
/src/cpprealm/managed_timestamp.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | namespace realm {
5 | __cpprealm_build_query(==, equal, std::chrono::time_point