diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml new file mode 100644 index 00000000..55769ef7 --- /dev/null +++ b/.github/workflows/ios.yml @@ -0,0 +1,32 @@ +name: iOS Build + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: macos-latest + steps: + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '16.1.0' + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Tuist + run: | + brew tap tuist/tuist + brew install --formula tuist@4.41.0 + + - name: Tuist Install + run: | + tuist install + + - name: Build iOS App + run: | + tuist build Example --generate --clean --no-binary-cache --platform iOS + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..33faf92f --- /dev/null +++ b/.gitignore @@ -0,0 +1,70 @@ +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### Xcode ### +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) +build/ +DerivedData/ +*.moved-aside +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 + +### Xcode Patch ### +*.xcodeproj/* +!*.xcodeproj/project.pbxproj +!*.xcodeproj/xcshareddata/ +!*.xcworkspace/contents.xcworkspacedata +/*.gcno + +### Projects ### +*.xcodeproj +*.xcworkspace + +### Tuist derived files ### +graph.dot +Derived/ + +### Tuist managed dependencies ### +Tuist/.build diff --git a/.mise.toml b/.mise.toml new file mode 100644 index 00000000..f169f597 --- /dev/null +++ b/.mise.toml @@ -0,0 +1,2 @@ +[tools] +tuist = "4.41.0" diff --git a/.package.resolved b/.package.resolved new file mode 100644 index 00000000..280f227a --- /dev/null +++ b/.package.resolved @@ -0,0 +1,15 @@ +{ + "originHash" : "cb9339b11ed9d7d2ecad83323078648becec11b51488c8702396ac0d9ffb1283", + "pins" : [ + { + "identity" : "swift-syntax", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-syntax.git", + "state" : { + "revision" : "0687f71944021d616d34d922343dcef086855920", + "version" : "600.0.1" + } + } + ], + "version" : 3 +} diff --git a/Architecture/CoreData.gif b/Architecture/CoreData.gif deleted file mode 100644 index 257887be..00000000 Binary files a/Architecture/CoreData.gif and /dev/null differ diff --git a/Architecture/Modules Details.drawing b/Architecture/Modules Details.drawing deleted file mode 100644 index bc37212b..00000000 Binary files a/Architecture/Modules Details.drawing and /dev/null differ diff --git a/Architecture/Modules Details.png b/Architecture/Modules Details.png deleted file mode 100644 index b44d50b7..00000000 Binary files a/Architecture/Modules Details.png and /dev/null differ diff --git a/Architecture/Modules.drawing b/Architecture/Modules.drawing deleted file mode 100644 index ffb90438..00000000 Binary files a/Architecture/Modules.drawing and /dev/null differ diff --git a/Architecture/Modules.png b/Architecture/Modules.png deleted file mode 100644 index 23497e73..00000000 Binary files a/Architecture/Modules.png and /dev/null differ diff --git a/Architecture/Realm.gif b/Architecture/Realm.gif deleted file mode 100644 index 1abcccf9..00000000 Binary files a/Architecture/Realm.gif and /dev/null differ diff --git a/CleanArchitectureRxSwift.xcodeproj/project.pbxproj b/CleanArchitectureRxSwift.xcodeproj/project.pbxproj deleted file mode 100644 index 849f98e9..00000000 --- a/CleanArchitectureRxSwift.xcodeproj/project.pbxproj +++ /dev/null @@ -1,2072 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 2526A7141E59F8260078870E /* ErrorTracker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2526A7131E59F8260078870E /* ErrorTracker.swift */; }; - 2526A7161E5A2CD30078870E /* EditPostViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2526A7151E5A2CD30078870E /* EditPostViewController.swift */; }; - 25897B041E58BD9100D3563C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B031E58BD9100D3563C /* AppDelegate.swift */; }; - 25897B091E58BD9100D3563C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 25897B071E58BD9100D3563C /* Main.storyboard */; }; - 25897B0B1E58BD9100D3563C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 25897B0A1E58BD9100D3563C /* Assets.xcassets */; }; - 25897B0E1E58BD9100D3563C /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 25897B0C1E58BD9100D3563C /* LaunchScreen.storyboard */; }; - 25897B191E58BD9100D3563C /* CleanArchitectureRxSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B181E58BD9100D3563C /* CleanArchitectureRxSwiftTests.swift */; }; - 25897B311E58BF0D00D3563C /* Domain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25897B281E58BF0D00D3563C /* Domain.framework */; }; - 25897B381E58BF0D00D3563C /* DomainTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B371E58BF0D00D3563C /* DomainTests.swift */; }; - 25897B3A1E58BF0D00D3563C /* Domain.h in Headers */ = {isa = PBXBuildFile; fileRef = 25897B2A1E58BF0D00D3563C /* Domain.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 25897B3D1E58BF0D00D3563C /* Domain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25897B281E58BF0D00D3563C /* Domain.framework */; }; - 25897B3E1E58BF0D00D3563C /* Domain.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 25897B281E58BF0D00D3563C /* Domain.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 25897B541E58BF3600D3563C /* CoreDataPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25897B4B1E58BF3600D3563C /* CoreDataPlatform.framework */; }; - 25897B5B1E58BF3600D3563C /* CoreDataPlatformTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B5A1E58BF3600D3563C /* CoreDataPlatformTests.swift */; }; - 25897B5D1E58BF3600D3563C /* CoreDataPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 25897B4D1E58BF3600D3563C /* CoreDataPlatform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 25897B601E58BF3600D3563C /* CoreDataPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25897B4B1E58BF3600D3563C /* CoreDataPlatform.framework */; }; - 25897B611E58BF3600D3563C /* CoreDataPlatform.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 25897B4B1E58BF3600D3563C /* CoreDataPlatform.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 25897B761E58BF4600D3563C /* RealmPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25897B6D1E58BF4600D3563C /* RealmPlatform.framework */; }; - 25897B7D1E58BF4600D3563C /* RealmPlatformTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B7C1E58BF4600D3563C /* RealmPlatformTests.swift */; }; - 25897B7F1E58BF4600D3563C /* RealmPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 25897B6F1E58BF4600D3563C /* RealmPlatform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 25897B821E58BF4600D3563C /* RealmPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25897B6D1E58BF4600D3563C /* RealmPlatform.framework */; }; - 25897B831E58BF4600D3563C /* RealmPlatform.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 25897B6D1E58BF4600D3563C /* RealmPlatform.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 25897B8C1E58C24500D3563C /* CoreDataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B8B1E58C24500D3563C /* CoreDataStack.swift */; }; - 25897B9A1E58C24B00D3563C /* CDLocation+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B8E1E58C24B00D3563C /* CDLocation+CoreDataClass.swift */; }; - 25897B9B1E58C24B00D3563C /* CDLocation+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B8F1E58C24B00D3563C /* CDLocation+CoreDataProperties.swift */; }; - 25897B9C1E58C24B00D3563C /* CDLocation+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B901E58C24B00D3563C /* CDLocation+Ext.swift */; }; - 25897B9D1E58C24B00D3563C /* CDMedia+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B911E58C24B00D3563C /* CDMedia+CoreDataClass.swift */; }; - 25897B9E1E58C24B00D3563C /* CDMedia+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B921E58C24B00D3563C /* CDMedia+CoreDataProperties.swift */; }; - 25897B9F1E58C24B00D3563C /* CDMedia+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B931E58C24B00D3563C /* CDMedia+Ext.swift */; }; - 25897BA01E58C24B00D3563C /* CDPost+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B941E58C24B00D3563C /* CDPost+CoreDataClass.swift */; }; - 25897BA11E58C24B00D3563C /* CDPost+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B951E58C24B00D3563C /* CDPost+CoreDataProperties.swift */; }; - 25897BA21E58C24B00D3563C /* CDPost+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B961E58C24B00D3563C /* CDPost+Ext.swift */; }; - 25897BA31E58C24B00D3563C /* DomainConvertibleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B981E58C24B00D3563C /* DomainConvertibleType.swift */; }; - 25897BA41E58C24B00D3563C /* Persistable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897B991E58C24B00D3563C /* Persistable.swift */; }; - 25897BA81E58C25000D3563C /* NSManagedObjectContext+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BA61E58C25000D3563C /* NSManagedObjectContext+Ext.swift */; }; - 25897BA91E58C25000D3563C /* Observable+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BA71E58C25000D3563C /* Observable+Ext.swift */; }; - 25897BAC1E58C25500D3563C /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 25897BAA1E58C25500D3563C /* Model.xcdatamodeld */; }; - 25897BB71E58C25A00D3563C /* Repository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BAE1E58C25A00D3563C /* Repository.swift */; }; - 25897BB81E58C25A00D3563C /* ContextScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BB01E58C25A00D3563C /* ContextScheduler.swift */; }; - 25897BB91E58C25A00D3563C /* FetchedResultsControllerEntityObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BB11E58C25A00D3563C /* FetchedResultsControllerEntityObserver.swift */; }; - 25897BBA1E58C25A00D3563C /* NSManagedObjectContext+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BB21E58C25A00D3563C /* NSManagedObjectContext+Rx.swift */; }; - 25897BBB1E58C25A00D3563C /* AllPostsUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BB41E58C25A00D3563C /* AllPostsUseCase.swift */; }; - 25897BBC1E58C25A00D3563C /* SavePostUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BB51E58C25A00D3563C /* SavePostUseCase.swift */; }; - 25897BBD1E58C25A00D3563C /* ServiceLocator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BB61E58C25A00D3563C /* ServiceLocator.swift */; }; - 25897BC61E58C42D00D3563C /* AllPostsUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BBF1E58C42D00D3563C /* AllPostsUseCase.swift */; }; - 25897BC81E58C42D00D3563C /* SavePostUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BC11E58C42D00D3563C /* SavePostUseCase.swift */; }; - 25897BC91E58C42D00D3563C /* Location.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BC31E58C42D00D3563C /* Location.swift */; }; - 25897BCA1E58C42D00D3563C /* Media.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BC41E58C42D00D3563C /* Media.swift */; }; - 25897BCB1E58C42D00D3563C /* Post.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BC51E58C42D00D3563C /* Post.swift */; }; - 25897BCC1E58C74E00D3563C /* Domain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25897B281E58BF0D00D3563C /* Domain.framework */; }; - 25897BCD1E58C75400D3563C /* Domain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25897B281E58BF0D00D3563C /* Domain.framework */; }; - 25897BF21E58CB8E00D3563C /* Application.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BE21E58CB8E00D3563C /* Application.swift */; }; - 25897BF71E58CB8F00D3563C /* ActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BE91E58CB8E00D3563C /* ActivityIndicator.swift */; }; - 25897BF91E58CB8F00D3563C /* Observable+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BEB1E58CB8E00D3563C /* Observable+Ext.swift */; }; - 25897BFB1E58CB8F00D3563C /* Reusable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BED1E58CB8E00D3563C /* Reusable.swift */; }; - 25897BFC1E58CB8F00D3563C /* ViewModelType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BEF1E58CB8E00D3563C /* ViewModelType.swift */; }; - 25897BFF1E58CE8B00D3563C /* ServiceLocator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25897BFE1E58CE8B00D3563C /* ServiceLocator.swift */; }; - 2DEEE5268D97F40515D1C542 /* Pods_DomainTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5764703F1E249BEDFC31014 /* Pods_DomainTests.framework */; }; - 4171B21201FC20FD72A143D0 /* Pods_CoreDataPlatformTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C03758DD874CBFB48A52CE5 /* Pods_CoreDataPlatformTests.framework */; }; - 514BA3A92A644232F50ED1A8 /* Pods_Domain.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 771F87FDB28A5E6EC32A9841 /* Pods_Domain.framework */; }; - 515F903E97C00DCE9EAEBF4D /* RMMedia.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F93C79FEF71E526BD363E /* RMMedia.swift */; }; - 515F9083DB52FEDFEE97A5E6 /* PostsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F93CEB3B316E01CDACEA7 /* PostsViewModel.swift */; }; - 515F926E776E33924F53A7F6 /* SavePostUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F9E409750F3D40CB814AE /* SavePostUseCase.swift */; }; - 515F94802804A5FEB69837C8 /* AllPostsUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F9359DD575F7E65FE22AF /* AllPostsUseCase.swift */; }; - 515F94853EF21BD13D636584 /* PostsNavigator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F94C9D806D051CFBCC327 /* PostsNavigator.swift */; }; - 515F9503C6F079D663CD9072 /* Repository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F92C7826B9C51A1FB4BED /* Repository.swift */; }; - 515F9590146BEE2A0626CFF1 /* PostTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F9AF2348793558FE0CAA7 /* PostTableViewCell.swift */; }; - 515F95A32860E22D7CB9563C /* EditPostViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F9ACD2D474324015B691C /* EditPostViewModel.swift */; }; - 515F95CFED58045AB6B168A4 /* CreatePostViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F948FEF12E0E3120DF351 /* CreatePostViewController.swift */; }; - 515F9625B58BCFB77F4AF678 /* CreatePostNavigator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F96DA0B9857BF87D2F2F0 /* CreatePostNavigator.swift */; }; - 515F96794273284723F2848D /* DomainConvertibleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F9FD5076F041EE00D7E14 /* DomainConvertibleType.swift */; }; - 515F973B5AA08DB9C2277A8C /* ServiceLocator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F92E54A4D816781F20A3B /* ServiceLocator.swift */; }; - 515F977483234BB090F6D704 /* PostsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F92B305125A2C9E279E71 /* PostsViewController.swift */; }; - 515F978F1DBE7C45646004F1 /* Observable+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F955A785CC73C958268BC /* Observable+Ext.swift */; }; - 515F9850E701F4ECCC669D9B /* CreatePostViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F92E2318F810E8AE29AB7 /* CreatePostViewModel.swift */; }; - 515F9A39814357F9E05282CD /* RunLoopThreadScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F92201894E6338A4BABFA /* RunLoopThreadScheduler.swift */; }; - 515F9B4D6A3BD831B9D4FB8C /* RealmRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F9C13ADD3B42F3CE8A593 /* RealmRepresentable.swift */; }; - 515F9BD6155258BD0C04DF36 /* RMLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F96DF719A053AEF410368 /* RMLocation.swift */; }; - 515F9CD8F2B13D0328B77B6C /* Realm+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F977CB3763872350F7874 /* Realm+Ext.swift */; }; - 515F9DBB950E2ABDB8D7895B /* RMPost.swift in Sources */ = {isa = PBXBuildFile; fileRef = 515F988220373D06226F4EDE /* RMPost.swift */; }; - 7DFB155E3444551C4DB34AAC /* Pods_CleanArchitectureRxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09A6B74019E724CAD9CA96DC /* Pods_CleanArchitectureRxSwift.framework */; }; - 8B0507E0C0AB1064B7372844 /* Pods_RealmPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 006BDFA0A26FDD0EBA50E777 /* Pods_RealmPlatform.framework */; }; - 9CBC9DB91790C744BC17C099 /* Pods_CleanArchitectureRxSwiftTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 550BE321D44EC009D885BBE1 /* Pods_CleanArchitectureRxSwiftTests.framework */; }; - DE96287CF168CFC64A0DE642 /* Pods_RealmPlatformTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BA0D3602A9ABB65C8AF19365 /* Pods_RealmPlatformTests.framework */; }; - F19EF3D1A8721CEAEA65EE12 /* Pods_CoreDataPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C9A3A93769D5899CBDCA89F /* Pods_CoreDataPlatform.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 25897B151E58BD9100D3563C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 25897AF81E58BD9100D3563C /* Project object */; - proxyType = 1; - remoteGlobalIDString = 25897AFF1E58BD9100D3563C; - remoteInfo = CleanArchitectureRxSwift; - }; - 25897B321E58BF0D00D3563C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 25897AF81E58BD9100D3563C /* Project object */; - proxyType = 1; - remoteGlobalIDString = 25897B271E58BF0D00D3563C; - remoteInfo = Domain; - }; - 25897B341E58BF0D00D3563C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 25897AF81E58BD9100D3563C /* Project object */; - proxyType = 1; - remoteGlobalIDString = 25897AFF1E58BD9100D3563C; - remoteInfo = CleanArchitectureRxSwift; - }; - 25897B3B1E58BF0D00D3563C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 25897AF81E58BD9100D3563C /* Project object */; - proxyType = 1; - remoteGlobalIDString = 25897B271E58BF0D00D3563C; - remoteInfo = Domain; - }; - 25897B551E58BF3600D3563C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 25897AF81E58BD9100D3563C /* Project object */; - proxyType = 1; - remoteGlobalIDString = 25897B4A1E58BF3600D3563C; - remoteInfo = CoreDataPlatform; - }; - 25897B571E58BF3600D3563C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 25897AF81E58BD9100D3563C /* Project object */; - proxyType = 1; - remoteGlobalIDString = 25897AFF1E58BD9100D3563C; - remoteInfo = CleanArchitectureRxSwift; - }; - 25897B5E1E58BF3600D3563C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 25897AF81E58BD9100D3563C /* Project object */; - proxyType = 1; - remoteGlobalIDString = 25897B4A1E58BF3600D3563C; - remoteInfo = CoreDataPlatform; - }; - 25897B771E58BF4600D3563C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 25897AF81E58BD9100D3563C /* Project object */; - proxyType = 1; - remoteGlobalIDString = 25897B6C1E58BF4600D3563C; - remoteInfo = RealmPlatform; - }; - 25897B791E58BF4600D3563C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 25897AF81E58BD9100D3563C /* Project object */; - proxyType = 1; - remoteGlobalIDString = 25897AFF1E58BD9100D3563C; - remoteInfo = CleanArchitectureRxSwift; - }; - 25897B801E58BF4600D3563C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 25897AF81E58BD9100D3563C /* Project object */; - proxyType = 1; - remoteGlobalIDString = 25897B6C1E58BF4600D3563C; - remoteInfo = RealmPlatform; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 25897B421E58BF0D00D3563C /* Embed Frameworks */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - 25897B831E58BF4600D3563C /* RealmPlatform.framework in Embed Frameworks */, - 25897B611E58BF3600D3563C /* CoreDataPlatform.framework in Embed Frameworks */, - 25897B3E1E58BF0D00D3563C /* Domain.framework in Embed Frameworks */, - ); - name = "Embed Frameworks"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 006BDFA0A26FDD0EBA50E777 /* Pods_RealmPlatform.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RealmPlatform.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 07BECD54B799E689F7DF0941 /* Pods-Domain.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Domain.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Domain/Pods-Domain.debug.xcconfig"; sourceTree = ""; }; - 081D23F2DCF9DBA930AB0FE7 /* Pods-RealmPlatform.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmPlatform.release.xcconfig"; path = "Pods/Target Support Files/Pods-RealmPlatform/Pods-RealmPlatform.release.xcconfig"; sourceTree = ""; }; - 09A6B74019E724CAD9CA96DC /* Pods_CleanArchitectureRxSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CleanArchitectureRxSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 0D4A3B45078CD8ACCC1314EC /* Pods-RealmPlatformTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmPlatformTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RealmPlatformTests/Pods-RealmPlatformTests.release.xcconfig"; sourceTree = ""; }; - 2526A7131E59F8260078870E /* ErrorTracker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ErrorTracker.swift; sourceTree = ""; }; - 2526A7151E5A2CD30078870E /* EditPostViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditPostViewController.swift; sourceTree = ""; }; - 25897B001E58BD9100D3563C /* CleanArchitectureRxSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CleanArchitectureRxSwift.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 25897B031E58BD9100D3563C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 25897B081E58BD9100D3563C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; - 25897B0A1E58BD9100D3563C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - 25897B0D1E58BD9100D3563C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; - 25897B0F1E58BD9100D3563C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 25897B141E58BD9100D3563C /* CleanArchitectureRxSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CleanArchitectureRxSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 25897B181E58BD9100D3563C /* CleanArchitectureRxSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CleanArchitectureRxSwiftTests.swift; sourceTree = ""; }; - 25897B1A1E58BD9100D3563C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 25897B281E58BF0D00D3563C /* Domain.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Domain.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 25897B2A1E58BF0D00D3563C /* Domain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Domain.h; sourceTree = ""; }; - 25897B2B1E58BF0D00D3563C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 25897B301E58BF0D00D3563C /* DomainTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DomainTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 25897B371E58BF0D00D3563C /* DomainTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DomainTests.swift; sourceTree = ""; }; - 25897B391E58BF0D00D3563C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 25897B4B1E58BF3600D3563C /* CoreDataPlatform.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreDataPlatform.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 25897B4D1E58BF3600D3563C /* CoreDataPlatform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoreDataPlatform.h; sourceTree = ""; }; - 25897B4E1E58BF3600D3563C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 25897B531E58BF3600D3563C /* CoreDataPlatformTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CoreDataPlatformTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 25897B5A1E58BF3600D3563C /* CoreDataPlatformTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataPlatformTests.swift; sourceTree = ""; }; - 25897B5C1E58BF3600D3563C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 25897B6D1E58BF4600D3563C /* RealmPlatform.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RealmPlatform.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 25897B6F1E58BF4600D3563C /* RealmPlatform.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RealmPlatform.h; sourceTree = ""; }; - 25897B701E58BF4600D3563C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 25897B751E58BF4600D3563C /* RealmPlatformTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RealmPlatformTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 25897B7C1E58BF4600D3563C /* RealmPlatformTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RealmPlatformTests.swift; sourceTree = ""; }; - 25897B7E1E58BF4600D3563C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 25897B8B1E58C24500D3563C /* CoreDataStack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataStack.swift; sourceTree = ""; }; - 25897B8E1E58C24B00D3563C /* CDLocation+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CDLocation+CoreDataClass.swift"; sourceTree = ""; }; - 25897B8F1E58C24B00D3563C /* CDLocation+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CDLocation+CoreDataProperties.swift"; sourceTree = ""; }; - 25897B901E58C24B00D3563C /* CDLocation+Ext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CDLocation+Ext.swift"; sourceTree = ""; }; - 25897B911E58C24B00D3563C /* CDMedia+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CDMedia+CoreDataClass.swift"; sourceTree = ""; }; - 25897B921E58C24B00D3563C /* CDMedia+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CDMedia+CoreDataProperties.swift"; sourceTree = ""; }; - 25897B931E58C24B00D3563C /* CDMedia+Ext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CDMedia+Ext.swift"; sourceTree = ""; }; - 25897B941E58C24B00D3563C /* CDPost+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CDPost+CoreDataClass.swift"; sourceTree = ""; }; - 25897B951E58C24B00D3563C /* CDPost+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CDPost+CoreDataProperties.swift"; sourceTree = ""; }; - 25897B961E58C24B00D3563C /* CDPost+Ext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CDPost+Ext.swift"; sourceTree = ""; }; - 25897B981E58C24B00D3563C /* DomainConvertibleType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DomainConvertibleType.swift; sourceTree = ""; }; - 25897B991E58C24B00D3563C /* Persistable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Persistable.swift; sourceTree = ""; }; - 25897BA61E58C25000D3563C /* NSManagedObjectContext+Ext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Ext.swift"; sourceTree = ""; }; - 25897BA71E58C25000D3563C /* Observable+Ext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+Ext.swift"; sourceTree = ""; }; - 25897BAB1E58C25500D3563C /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = ""; }; - 25897BAE1E58C25A00D3563C /* Repository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Repository.swift; sourceTree = ""; }; - 25897BB01E58C25A00D3563C /* ContextScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContextScheduler.swift; sourceTree = ""; }; - 25897BB11E58C25A00D3563C /* FetchedResultsControllerEntityObserver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FetchedResultsControllerEntityObserver.swift; sourceTree = ""; }; - 25897BB21E58C25A00D3563C /* NSManagedObjectContext+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObjectContext+Rx.swift"; sourceTree = ""; }; - 25897BB41E58C25A00D3563C /* AllPostsUseCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AllPostsUseCase.swift; sourceTree = ""; }; - 25897BB51E58C25A00D3563C /* SavePostUseCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SavePostUseCase.swift; sourceTree = ""; }; - 25897BB61E58C25A00D3563C /* ServiceLocator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceLocator.swift; sourceTree = ""; }; - 25897BBF1E58C42D00D3563C /* AllPostsUseCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AllPostsUseCase.swift; sourceTree = ""; }; - 25897BC11E58C42D00D3563C /* SavePostUseCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SavePostUseCase.swift; sourceTree = ""; }; - 25897BC31E58C42D00D3563C /* Location.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Location.swift; sourceTree = ""; }; - 25897BC41E58C42D00D3563C /* Media.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Media.swift; sourceTree = ""; }; - 25897BC51E58C42D00D3563C /* Post.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Post.swift; sourceTree = ""; }; - 25897BE21E58CB8E00D3563C /* Application.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Application.swift; sourceTree = ""; }; - 25897BE91E58CB8E00D3563C /* ActivityIndicator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActivityIndicator.swift; sourceTree = ""; }; - 25897BEB1E58CB8E00D3563C /* Observable+Ext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+Ext.swift"; sourceTree = ""; }; - 25897BED1E58CB8E00D3563C /* Reusable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reusable.swift; sourceTree = ""; }; - 25897BEF1E58CB8E00D3563C /* ViewModelType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewModelType.swift; sourceTree = ""; }; - 25897BFE1E58CE8B00D3563C /* ServiceLocator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceLocator.swift; sourceTree = ""; }; - 2BBB44DCB902E459F05D68B0 /* Pods-CoreDataPlatformTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreDataPlatformTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CoreDataPlatformTests/Pods-CoreDataPlatformTests.release.xcconfig"; sourceTree = ""; }; - 2C03758DD874CBFB48A52CE5 /* Pods_CoreDataPlatformTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CoreDataPlatformTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 3058945350D99DC786F3CDC3 /* Pods-CoreDataPlatform.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreDataPlatform.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CoreDataPlatform/Pods-CoreDataPlatform.debug.xcconfig"; sourceTree = ""; }; - 3D9EA43A0DD207CAFEADD07C /* Pods-CleanArchitectureRxSwiftTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CleanArchitectureRxSwiftTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CleanArchitectureRxSwiftTests/Pods-CleanArchitectureRxSwiftTests.debug.xcconfig"; sourceTree = ""; }; - 3F5B77FEC1EA2332323A0EB9 /* Pods-CleanArchitectureRxSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CleanArchitectureRxSwift.release.xcconfig"; path = "Pods/Target Support Files/Pods-CleanArchitectureRxSwift/Pods-CleanArchitectureRxSwift.release.xcconfig"; sourceTree = ""; }; - 4C9D6A2833A962FEF238F391 /* Pods-RealmPlatform.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmPlatform.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RealmPlatform/Pods-RealmPlatform.debug.xcconfig"; sourceTree = ""; }; - 515F92201894E6338A4BABFA /* RunLoopThreadScheduler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RunLoopThreadScheduler.swift; sourceTree = ""; }; - 515F92B305125A2C9E279E71 /* PostsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostsViewController.swift; sourceTree = ""; }; - 515F92C7826B9C51A1FB4BED /* Repository.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Repository.swift; sourceTree = ""; }; - 515F92E2318F810E8AE29AB7 /* CreatePostViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreatePostViewModel.swift; sourceTree = ""; }; - 515F92E54A4D816781F20A3B /* ServiceLocator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceLocator.swift; sourceTree = ""; }; - 515F9359DD575F7E65FE22AF /* AllPostsUseCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AllPostsUseCase.swift; sourceTree = ""; }; - 515F93C79FEF71E526BD363E /* RMMedia.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RMMedia.swift; sourceTree = ""; }; - 515F93CEB3B316E01CDACEA7 /* PostsViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostsViewModel.swift; sourceTree = ""; }; - 515F948FEF12E0E3120DF351 /* CreatePostViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreatePostViewController.swift; sourceTree = ""; }; - 515F94C9D806D051CFBCC327 /* PostsNavigator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostsNavigator.swift; sourceTree = ""; }; - 515F955A785CC73C958268BC /* Observable+Ext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Observable+Ext.swift"; sourceTree = ""; }; - 515F96DA0B9857BF87D2F2F0 /* CreatePostNavigator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreatePostNavigator.swift; sourceTree = ""; }; - 515F96DF719A053AEF410368 /* RMLocation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RMLocation.swift; sourceTree = ""; }; - 515F977CB3763872350F7874 /* Realm+Ext.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Realm+Ext.swift"; sourceTree = ""; }; - 515F988220373D06226F4EDE /* RMPost.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RMPost.swift; sourceTree = ""; }; - 515F9ACD2D474324015B691C /* EditPostViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditPostViewModel.swift; sourceTree = ""; }; - 515F9AF2348793558FE0CAA7 /* PostTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PostTableViewCell.swift; sourceTree = ""; }; - 515F9C13ADD3B42F3CE8A593 /* RealmRepresentable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealmRepresentable.swift; sourceTree = ""; }; - 515F9E409750F3D40CB814AE /* SavePostUseCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SavePostUseCase.swift; sourceTree = ""; }; - 515F9FD5076F041EE00D7E14 /* DomainConvertibleType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DomainConvertibleType.swift; sourceTree = ""; }; - 550BE321D44EC009D885BBE1 /* Pods_CleanArchitectureRxSwiftTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CleanArchitectureRxSwiftTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 71C4CC5892A6E3601D801729 /* Pods-CoreDataPlatform.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreDataPlatform.release.xcconfig"; path = "Pods/Target Support Files/Pods-CoreDataPlatform/Pods-CoreDataPlatform.release.xcconfig"; sourceTree = ""; }; - 771F87FDB28A5E6EC32A9841 /* Pods_Domain.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Domain.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 84A5797E91E6FA5FA24A4896 /* Pods-CleanArchitectureRxSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CleanArchitectureRxSwift.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CleanArchitectureRxSwift/Pods-CleanArchitectureRxSwift.debug.xcconfig"; sourceTree = ""; }; - 9B6A26BB04BBAABE85CB9EDC /* Pods-DomainTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DomainTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-DomainTests/Pods-DomainTests.release.xcconfig"; sourceTree = ""; }; - 9C9A3A93769D5899CBDCA89F /* Pods_CoreDataPlatform.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CoreDataPlatform.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - A6A063DE6BDC13E3B800BB80 /* Pods-CleanArchitectureRxSwiftTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CleanArchitectureRxSwiftTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-CleanArchitectureRxSwiftTests/Pods-CleanArchitectureRxSwiftTests.release.xcconfig"; sourceTree = ""; }; - A8E1F5AE93A531609690A036 /* Pods-RealmPlatformTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RealmPlatformTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-RealmPlatformTests/Pods-RealmPlatformTests.debug.xcconfig"; sourceTree = ""; }; - B0092014AEC057C48B9745EA /* Pods-DomainTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DomainTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DomainTests/Pods-DomainTests.debug.xcconfig"; sourceTree = ""; }; - B5764703F1E249BEDFC31014 /* Pods_DomainTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DomainTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BA0D3602A9ABB65C8AF19365 /* Pods_RealmPlatformTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RealmPlatformTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - F1F89859FF9197F25DB915C7 /* Pods-CoreDataPlatformTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CoreDataPlatformTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CoreDataPlatformTests/Pods-CoreDataPlatformTests.debug.xcconfig"; sourceTree = ""; }; - FA1AB793DF561BEEC8C591F7 /* Pods-Domain.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Domain.release.xcconfig"; path = "Pods/Target Support Files/Pods-Domain/Pods-Domain.release.xcconfig"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 25897AFD1E58BD9100D3563C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B821E58BF4600D3563C /* RealmPlatform.framework in Frameworks */, - 25897B601E58BF3600D3563C /* CoreDataPlatform.framework in Frameworks */, - 25897B3D1E58BF0D00D3563C /* Domain.framework in Frameworks */, - 7DFB155E3444551C4DB34AAC /* Pods_CleanArchitectureRxSwift.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B111E58BD9100D3563C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9CBC9DB91790C744BC17C099 /* Pods_CleanArchitectureRxSwiftTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B241E58BF0D00D3563C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 514BA3A92A644232F50ED1A8 /* Pods_Domain.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B2D1E58BF0D00D3563C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B311E58BF0D00D3563C /* Domain.framework in Frameworks */, - 2DEEE5268D97F40515D1C542 /* Pods_DomainTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B471E58BF3600D3563C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897BCC1E58C74E00D3563C /* Domain.framework in Frameworks */, - F19EF3D1A8721CEAEA65EE12 /* Pods_CoreDataPlatform.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B501E58BF3600D3563C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B541E58BF3600D3563C /* CoreDataPlatform.framework in Frameworks */, - 4171B21201FC20FD72A143D0 /* Pods_CoreDataPlatformTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B691E58BF4600D3563C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897BCD1E58C75400D3563C /* Domain.framework in Frameworks */, - 8B0507E0C0AB1064B7372844 /* Pods_RealmPlatform.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B721E58BF4600D3563C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B761E58BF4600D3563C /* RealmPlatform.framework in Frameworks */, - DE96287CF168CFC64A0DE642 /* Pods_RealmPlatformTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 23C0DA07B3F46EB59E072F7E /* Frameworks */ = { - isa = PBXGroup; - children = ( - 09A6B74019E724CAD9CA96DC /* Pods_CleanArchitectureRxSwift.framework */, - 550BE321D44EC009D885BBE1 /* Pods_CleanArchitectureRxSwiftTests.framework */, - 9C9A3A93769D5899CBDCA89F /* Pods_CoreDataPlatform.framework */, - 2C03758DD874CBFB48A52CE5 /* Pods_CoreDataPlatformTests.framework */, - 771F87FDB28A5E6EC32A9841 /* Pods_Domain.framework */, - B5764703F1E249BEDFC31014 /* Pods_DomainTests.framework */, - 006BDFA0A26FDD0EBA50E777 /* Pods_RealmPlatform.framework */, - BA0D3602A9ABB65C8AF19365 /* Pods_RealmPlatformTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 25897AF71E58BD9100D3563C = { - isa = PBXGroup; - children = ( - 25897B021E58BD9100D3563C /* CleanArchitectureRxSwift */, - 25897B171E58BD9100D3563C /* CleanArchitectureRxSwiftTests */, - 25897B291E58BF0D00D3563C /* Domain */, - 25897B361E58BF0D00D3563C /* DomainTests */, - 25897B4C1E58BF3600D3563C /* CoreDataPlatform */, - 25897B591E58BF3600D3563C /* CoreDataPlatformTests */, - 25897B6E1E58BF4600D3563C /* RealmPlatform */, - 25897B7B1E58BF4600D3563C /* RealmPlatformTests */, - 25897B011E58BD9100D3563C /* Products */, - A3C0A06A8E4F121C929B96B4 /* Pods */, - 23C0DA07B3F46EB59E072F7E /* Frameworks */, - ); - sourceTree = ""; - }; - 25897B011E58BD9100D3563C /* Products */ = { - isa = PBXGroup; - children = ( - 25897B001E58BD9100D3563C /* CleanArchitectureRxSwift.app */, - 25897B141E58BD9100D3563C /* CleanArchitectureRxSwiftTests.xctest */, - 25897B281E58BF0D00D3563C /* Domain.framework */, - 25897B301E58BF0D00D3563C /* DomainTests.xctest */, - 25897B4B1E58BF3600D3563C /* CoreDataPlatform.framework */, - 25897B531E58BF3600D3563C /* CoreDataPlatformTests.xctest */, - 25897B6D1E58BF4600D3563C /* RealmPlatform.framework */, - 25897B751E58BF4600D3563C /* RealmPlatformTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; - 25897B021E58BD9100D3563C /* CleanArchitectureRxSwift */ = { - isa = PBXGroup; - children = ( - 25897BE11E58CB8E00D3563C /* Application */, - 25897BE81E58CB8E00D3563C /* Utility */, - 25897BEE1E58CB8E00D3563C /* Common */, - 25897B031E58BD9100D3563C /* AppDelegate.swift */, - 25897B071E58BD9100D3563C /* Main.storyboard */, - 25897B0A1E58BD9100D3563C /* Assets.xcassets */, - 25897B0C1E58BD9100D3563C /* LaunchScreen.storyboard */, - 25897B0F1E58BD9100D3563C /* Info.plist */, - 515F903025B664C6A43D7962 /* Scenes */, - ); - path = CleanArchitectureRxSwift; - sourceTree = ""; - }; - 25897B171E58BD9100D3563C /* CleanArchitectureRxSwiftTests */ = { - isa = PBXGroup; - children = ( - 25897B181E58BD9100D3563C /* CleanArchitectureRxSwiftTests.swift */, - 25897B1A1E58BD9100D3563C /* Info.plist */, - ); - path = CleanArchitectureRxSwiftTests; - sourceTree = ""; - }; - 25897B291E58BF0D00D3563C /* Domain */ = { - isa = PBXGroup; - children = ( - 25897BFE1E58CE8B00D3563C /* ServiceLocator.swift */, - 25897BBE1E58C42D00D3563C /* UseCases */, - 25897BC21E58C42D00D3563C /* Entries */, - 25897B2A1E58BF0D00D3563C /* Domain.h */, - 25897B2B1E58BF0D00D3563C /* Info.plist */, - ); - path = Domain; - sourceTree = ""; - }; - 25897B361E58BF0D00D3563C /* DomainTests */ = { - isa = PBXGroup; - children = ( - 25897B371E58BF0D00D3563C /* DomainTests.swift */, - 25897B391E58BF0D00D3563C /* Info.plist */, - ); - path = DomainTests; - sourceTree = ""; - }; - 25897B4C1E58BF3600D3563C /* CoreDataPlatform */ = { - isa = PBXGroup; - children = ( - 25897BA51E58C25000D3563C /* Extensions */, - 25897B8D1E58C24B00D3563C /* Entities */, - 25897B8A1E58C24500D3563C /* CoreDataStack */, - 25897BAD1E58C25A00D3563C /* Repository */, - 25897BAF1E58C25A00D3563C /* RxCoreData */, - 25897BB31E58C25A00D3563C /* UseCases */, - 25897BAA1E58C25500D3563C /* Model.xcdatamodeld */, - 25897B4D1E58BF3600D3563C /* CoreDataPlatform.h */, - 25897B4E1E58BF3600D3563C /* Info.plist */, - ); - path = CoreDataPlatform; - sourceTree = ""; - }; - 25897B591E58BF3600D3563C /* CoreDataPlatformTests */ = { - isa = PBXGroup; - children = ( - 25897B5A1E58BF3600D3563C /* CoreDataPlatformTests.swift */, - 25897B5C1E58BF3600D3563C /* Info.plist */, - ); - path = CoreDataPlatformTests; - sourceTree = ""; - }; - 25897B6E1E58BF4600D3563C /* RealmPlatform */ = { - isa = PBXGroup; - children = ( - 25897B6F1E58BF4600D3563C /* RealmPlatform.h */, - 25897B701E58BF4600D3563C /* Info.plist */, - 515F921AB2989DB17DD621B6 /* Entities */, - 515F96C0E02DA60D7AC0B94B /* Utility */, - 515F988DB4ECDA46B682145C /* Repository */, - 515F94D09679E59029EB0F24 /* UseCases */, - ); - path = RealmPlatform; - sourceTree = ""; - }; - 25897B7B1E58BF4600D3563C /* RealmPlatformTests */ = { - isa = PBXGroup; - children = ( - 25897B7C1E58BF4600D3563C /* RealmPlatformTests.swift */, - 25897B7E1E58BF4600D3563C /* Info.plist */, - ); - path = RealmPlatformTests; - sourceTree = ""; - }; - 25897B8A1E58C24500D3563C /* CoreDataStack */ = { - isa = PBXGroup; - children = ( - 25897B8B1E58C24500D3563C /* CoreDataStack.swift */, - ); - path = CoreDataStack; - sourceTree = ""; - }; - 25897B8D1E58C24B00D3563C /* Entities */ = { - isa = PBXGroup; - children = ( - 25897B8E1E58C24B00D3563C /* CDLocation+CoreDataClass.swift */, - 25897B8F1E58C24B00D3563C /* CDLocation+CoreDataProperties.swift */, - 25897B901E58C24B00D3563C /* CDLocation+Ext.swift */, - 25897B911E58C24B00D3563C /* CDMedia+CoreDataClass.swift */, - 25897B921E58C24B00D3563C /* CDMedia+CoreDataProperties.swift */, - 25897B931E58C24B00D3563C /* CDMedia+Ext.swift */, - 25897B941E58C24B00D3563C /* CDPost+CoreDataClass.swift */, - 25897B951E58C24B00D3563C /* CDPost+CoreDataProperties.swift */, - 25897B961E58C24B00D3563C /* CDPost+Ext.swift */, - 25897B971E58C24B00D3563C /* Convertion */, - ); - path = Entities; - sourceTree = ""; - }; - 25897B971E58C24B00D3563C /* Convertion */ = { - isa = PBXGroup; - children = ( - 25897B981E58C24B00D3563C /* DomainConvertibleType.swift */, - 25897B991E58C24B00D3563C /* Persistable.swift */, - ); - path = Convertion; - sourceTree = ""; - }; - 25897BA51E58C25000D3563C /* Extensions */ = { - isa = PBXGroup; - children = ( - 25897BA61E58C25000D3563C /* NSManagedObjectContext+Ext.swift */, - 25897BA71E58C25000D3563C /* Observable+Ext.swift */, - ); - path = Extensions; - sourceTree = ""; - }; - 25897BAD1E58C25A00D3563C /* Repository */ = { - isa = PBXGroup; - children = ( - 25897BAE1E58C25A00D3563C /* Repository.swift */, - ); - path = Repository; - sourceTree = ""; - }; - 25897BAF1E58C25A00D3563C /* RxCoreData */ = { - isa = PBXGroup; - children = ( - 25897BB01E58C25A00D3563C /* ContextScheduler.swift */, - 25897BB11E58C25A00D3563C /* FetchedResultsControllerEntityObserver.swift */, - 25897BB21E58C25A00D3563C /* NSManagedObjectContext+Rx.swift */, - ); - path = RxCoreData; - sourceTree = ""; - }; - 25897BB31E58C25A00D3563C /* UseCases */ = { - isa = PBXGroup; - children = ( - 25897BB41E58C25A00D3563C /* AllPostsUseCase.swift */, - 25897BB51E58C25A00D3563C /* SavePostUseCase.swift */, - 25897BB61E58C25A00D3563C /* ServiceLocator.swift */, - ); - path = UseCases; - sourceTree = ""; - }; - 25897BBE1E58C42D00D3563C /* UseCases */ = { - isa = PBXGroup; - children = ( - 25897BBF1E58C42D00D3563C /* AllPostsUseCase.swift */, - 25897BC11E58C42D00D3563C /* SavePostUseCase.swift */, - ); - path = UseCases; - sourceTree = ""; - }; - 25897BC21E58C42D00D3563C /* Entries */ = { - isa = PBXGroup; - children = ( - 25897BC31E58C42D00D3563C /* Location.swift */, - 25897BC41E58C42D00D3563C /* Media.swift */, - 25897BC51E58C42D00D3563C /* Post.swift */, - ); - path = Entries; - sourceTree = ""; - }; - 25897BE11E58CB8E00D3563C /* Application */ = { - isa = PBXGroup; - children = ( - 25897BE21E58CB8E00D3563C /* Application.swift */, - ); - path = Application; - sourceTree = ""; - }; - 25897BE81E58CB8E00D3563C /* Utility */ = { - isa = PBXGroup; - children = ( - 2526A7131E59F8260078870E /* ErrorTracker.swift */, - 25897BE91E58CB8E00D3563C /* ActivityIndicator.swift */, - 25897BEB1E58CB8E00D3563C /* Observable+Ext.swift */, - 25897BED1E58CB8E00D3563C /* Reusable.swift */, - ); - path = Utility; - sourceTree = ""; - }; - 25897BEE1E58CB8E00D3563C /* Common */ = { - isa = PBXGroup; - children = ( - 25897BEF1E58CB8E00D3563C /* ViewModelType.swift */, - ); - path = Common; - sourceTree = ""; - }; - 515F903025B664C6A43D7962 /* Scenes */ = { - isa = PBXGroup; - children = ( - 515F94479B9C0EF5329F9428 /* AllPosts */, - 515F9B161E41C7D130E180EF /* CreatePost */, - 515F9401ED57113EEF898228 /* EditPost */, - ); - path = Scenes; - sourceTree = ""; - }; - 515F921AB2989DB17DD621B6 /* Entities */ = { - isa = PBXGroup; - children = ( - 515F93C28B4316E9B2F00D42 /* Convertion */, - 515F988220373D06226F4EDE /* RMPost.swift */, - 515F93C79FEF71E526BD363E /* RMMedia.swift */, - 515F96DF719A053AEF410368 /* RMLocation.swift */, - ); - path = Entities; - sourceTree = ""; - }; - 515F93C28B4316E9B2F00D42 /* Convertion */ = { - isa = PBXGroup; - children = ( - 515F9FD5076F041EE00D7E14 /* DomainConvertibleType.swift */, - 515F9C13ADD3B42F3CE8A593 /* RealmRepresentable.swift */, - ); - path = Convertion; - sourceTree = ""; - }; - 515F9401ED57113EEF898228 /* EditPost */ = { - isa = PBXGroup; - children = ( - 2526A7151E5A2CD30078870E /* EditPostViewController.swift */, - 515F9ACD2D474324015B691C /* EditPostViewModel.swift */, - ); - path = EditPost; - sourceTree = ""; - }; - 515F94479B9C0EF5329F9428 /* AllPosts */ = { - isa = PBXGroup; - children = ( - 515F94C9D806D051CFBCC327 /* PostsNavigator.swift */, - 515F92B305125A2C9E279E71 /* PostsViewController.swift */, - 515F93CEB3B316E01CDACEA7 /* PostsViewModel.swift */, - 515F9AF2348793558FE0CAA7 /* PostTableViewCell.swift */, - ); - path = AllPosts; - sourceTree = ""; - }; - 515F94D09679E59029EB0F24 /* UseCases */ = { - isa = PBXGroup; - children = ( - 515F9359DD575F7E65FE22AF /* AllPostsUseCase.swift */, - 515F9E409750F3D40CB814AE /* SavePostUseCase.swift */, - 515F92E54A4D816781F20A3B /* ServiceLocator.swift */, - ); - path = UseCases; - sourceTree = ""; - }; - 515F96C0E02DA60D7AC0B94B /* Utility */ = { - isa = PBXGroup; - children = ( - 515F9F0B54EB33278403FD4D /* Extensions */, - 515F9A9E07211156210A87C6 /* RxUnits */, - ); - path = Utility; - sourceTree = ""; - }; - 515F988DB4ECDA46B682145C /* Repository */ = { - isa = PBXGroup; - children = ( - 515F92C7826B9C51A1FB4BED /* Repository.swift */, - ); - path = Repository; - sourceTree = ""; - }; - 515F9A9E07211156210A87C6 /* RxUnits */ = { - isa = PBXGroup; - children = ( - 515F92201894E6338A4BABFA /* RunLoopThreadScheduler.swift */, - ); - path = RxUnits; - sourceTree = ""; - }; - 515F9B161E41C7D130E180EF /* CreatePost */ = { - isa = PBXGroup; - children = ( - 515F948FEF12E0E3120DF351 /* CreatePostViewController.swift */, - 515F96DA0B9857BF87D2F2F0 /* CreatePostNavigator.swift */, - 515F92E2318F810E8AE29AB7 /* CreatePostViewModel.swift */, - ); - path = CreatePost; - sourceTree = ""; - }; - 515F9F0B54EB33278403FD4D /* Extensions */ = { - isa = PBXGroup; - children = ( - 515F977CB3763872350F7874 /* Realm+Ext.swift */, - 515F955A785CC73C958268BC /* Observable+Ext.swift */, - ); - path = Extensions; - sourceTree = ""; - }; - A3C0A06A8E4F121C929B96B4 /* Pods */ = { - isa = PBXGroup; - children = ( - 84A5797E91E6FA5FA24A4896 /* Pods-CleanArchitectureRxSwift.debug.xcconfig */, - 3F5B77FEC1EA2332323A0EB9 /* Pods-CleanArchitectureRxSwift.release.xcconfig */, - 3D9EA43A0DD207CAFEADD07C /* Pods-CleanArchitectureRxSwiftTests.debug.xcconfig */, - A6A063DE6BDC13E3B800BB80 /* Pods-CleanArchitectureRxSwiftTests.release.xcconfig */, - 3058945350D99DC786F3CDC3 /* Pods-CoreDataPlatform.debug.xcconfig */, - 71C4CC5892A6E3601D801729 /* Pods-CoreDataPlatform.release.xcconfig */, - F1F89859FF9197F25DB915C7 /* Pods-CoreDataPlatformTests.debug.xcconfig */, - 2BBB44DCB902E459F05D68B0 /* Pods-CoreDataPlatformTests.release.xcconfig */, - 07BECD54B799E689F7DF0941 /* Pods-Domain.debug.xcconfig */, - FA1AB793DF561BEEC8C591F7 /* Pods-Domain.release.xcconfig */, - B0092014AEC057C48B9745EA /* Pods-DomainTests.debug.xcconfig */, - 9B6A26BB04BBAABE85CB9EDC /* Pods-DomainTests.release.xcconfig */, - 4C9D6A2833A962FEF238F391 /* Pods-RealmPlatform.debug.xcconfig */, - 081D23F2DCF9DBA930AB0FE7 /* Pods-RealmPlatform.release.xcconfig */, - A8E1F5AE93A531609690A036 /* Pods-RealmPlatformTests.debug.xcconfig */, - 0D4A3B45078CD8ACCC1314EC /* Pods-RealmPlatformTests.release.xcconfig */, - ); - name = Pods; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 25897B251E58BF0D00D3563C /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B3A1E58BF0D00D3563C /* Domain.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B481E58BF3600D3563C /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B5D1E58BF3600D3563C /* CoreDataPlatform.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B6A1E58BF4600D3563C /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B7F1E58BF4600D3563C /* RealmPlatform.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 25897AFF1E58BD9100D3563C /* CleanArchitectureRxSwift */ = { - isa = PBXNativeTarget; - buildConfigurationList = 25897B1D1E58BD9100D3563C /* Build configuration list for PBXNativeTarget "CleanArchitectureRxSwift" */; - buildPhases = ( - 4D40437EE66B816D743E97B5 /* [CP] Check Pods Manifest.lock */, - 25897AFC1E58BD9100D3563C /* Sources */, - 25897AFD1E58BD9100D3563C /* Frameworks */, - 25897AFE1E58BD9100D3563C /* Resources */, - 25897B421E58BF0D00D3563C /* Embed Frameworks */, - 17B07EE7C6E1F9585169BCEF /* [CP] Embed Pods Frameworks */, - 28CFE5669B8AE9607DF2856C /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - 25897B3C1E58BF0D00D3563C /* PBXTargetDependency */, - 25897B5F1E58BF3600D3563C /* PBXTargetDependency */, - 25897B811E58BF4600D3563C /* PBXTargetDependency */, - ); - name = CleanArchitectureRxSwift; - productName = CleanArchitectureRxSwift; - productReference = 25897B001E58BD9100D3563C /* CleanArchitectureRxSwift.app */; - productType = "com.apple.product-type.application"; - }; - 25897B131E58BD9100D3563C /* CleanArchitectureRxSwiftTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 25897B201E58BD9100D3563C /* Build configuration list for PBXNativeTarget "CleanArchitectureRxSwiftTests" */; - buildPhases = ( - 015131BB381CBD181905CBC2 /* [CP] Check Pods Manifest.lock */, - 25897B101E58BD9100D3563C /* Sources */, - 25897B111E58BD9100D3563C /* Frameworks */, - 25897B121E58BD9100D3563C /* Resources */, - 99D05AF51EAFBA63AB33FF1A /* [CP] Embed Pods Frameworks */, - 006C7C1FF46E3DB893CDE540 /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - 25897B161E58BD9100D3563C /* PBXTargetDependency */, - ); - name = CleanArchitectureRxSwiftTests; - productName = CleanArchitectureRxSwiftTests; - productReference = 25897B141E58BD9100D3563C /* CleanArchitectureRxSwiftTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 25897B271E58BF0D00D3563C /* Domain */ = { - isa = PBXNativeTarget; - buildConfigurationList = 25897B3F1E58BF0D00D3563C /* Build configuration list for PBXNativeTarget "Domain" */; - buildPhases = ( - 9DDCC75CAD78374C078CD054 /* [CP] Check Pods Manifest.lock */, - 25897B231E58BF0D00D3563C /* Sources */, - 25897B241E58BF0D00D3563C /* Frameworks */, - 25897B251E58BF0D00D3563C /* Headers */, - 25897B261E58BF0D00D3563C /* Resources */, - 9B4B5981DAB42ED042081A6C /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Domain; - productName = Domain; - productReference = 25897B281E58BF0D00D3563C /* Domain.framework */; - productType = "com.apple.product-type.framework"; - }; - 25897B2F1E58BF0D00D3563C /* DomainTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 25897B431E58BF0D00D3563C /* Build configuration list for PBXNativeTarget "DomainTests" */; - buildPhases = ( - D0775CFF21514545A5358821 /* [CP] Check Pods Manifest.lock */, - 25897B2C1E58BF0D00D3563C /* Sources */, - 25897B2D1E58BF0D00D3563C /* Frameworks */, - 25897B2E1E58BF0D00D3563C /* Resources */, - 203BDCA1039B7C197B857E89 /* [CP] Embed Pods Frameworks */, - A171EA0E053336EE692B913D /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - 25897B331E58BF0D00D3563C /* PBXTargetDependency */, - 25897B351E58BF0D00D3563C /* PBXTargetDependency */, - ); - name = DomainTests; - productName = DomainTests; - productReference = 25897B301E58BF0D00D3563C /* DomainTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 25897B4A1E58BF3600D3563C /* CoreDataPlatform */ = { - isa = PBXNativeTarget; - buildConfigurationList = 25897B621E58BF3600D3563C /* Build configuration list for PBXNativeTarget "CoreDataPlatform" */; - buildPhases = ( - 5E2552E63A43C10038965F18 /* [CP] Check Pods Manifest.lock */, - 25897B461E58BF3600D3563C /* Sources */, - 25897B471E58BF3600D3563C /* Frameworks */, - 25897B481E58BF3600D3563C /* Headers */, - 25897B491E58BF3600D3563C /* Resources */, - 3B8B3FB51316DF1979F12E2F /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = CoreDataPlatform; - productName = CoreDataPlatform; - productReference = 25897B4B1E58BF3600D3563C /* CoreDataPlatform.framework */; - productType = "com.apple.product-type.framework"; - }; - 25897B521E58BF3600D3563C /* CoreDataPlatformTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 25897B651E58BF3600D3563C /* Build configuration list for PBXNativeTarget "CoreDataPlatformTests" */; - buildPhases = ( - F6F2EEDD7AAC48A1BC11CD4B /* [CP] Check Pods Manifest.lock */, - 25897B4F1E58BF3600D3563C /* Sources */, - 25897B501E58BF3600D3563C /* Frameworks */, - 25897B511E58BF3600D3563C /* Resources */, - 7E130B3F8A11A4D1B94AA921 /* [CP] Embed Pods Frameworks */, - 3747AA0E918E4480A0E286E4 /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - 25897B561E58BF3600D3563C /* PBXTargetDependency */, - 25897B581E58BF3600D3563C /* PBXTargetDependency */, - ); - name = CoreDataPlatformTests; - productName = CoreDataPlatformTests; - productReference = 25897B531E58BF3600D3563C /* CoreDataPlatformTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 25897B6C1E58BF4600D3563C /* RealmPlatform */ = { - isa = PBXNativeTarget; - buildConfigurationList = 25897B841E58BF4600D3563C /* Build configuration list for PBXNativeTarget "RealmPlatform" */; - buildPhases = ( - 2D5A32A95B40355B4FA7628D /* [CP] Check Pods Manifest.lock */, - 25897B681E58BF4600D3563C /* Sources */, - 25897B691E58BF4600D3563C /* Frameworks */, - 25897B6A1E58BF4600D3563C /* Headers */, - 25897B6B1E58BF4600D3563C /* Resources */, - C595C3DED753CDD92CD22D17 /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RealmPlatform; - productName = RealmPlatform; - productReference = 25897B6D1E58BF4600D3563C /* RealmPlatform.framework */; - productType = "com.apple.product-type.framework"; - }; - 25897B741E58BF4600D3563C /* RealmPlatformTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 25897B871E58BF4600D3563C /* Build configuration list for PBXNativeTarget "RealmPlatformTests" */; - buildPhases = ( - B5E1898DADCA47342737CBEF /* [CP] Check Pods Manifest.lock */, - 25897B711E58BF4600D3563C /* Sources */, - 25897B721E58BF4600D3563C /* Frameworks */, - 25897B731E58BF4600D3563C /* Resources */, - BCF36B73A0784820E1EB47E1 /* [CP] Embed Pods Frameworks */, - F6C51612A3FD768B19019D61 /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - 25897B781E58BF4600D3563C /* PBXTargetDependency */, - 25897B7A1E58BF4600D3563C /* PBXTargetDependency */, - ); - name = RealmPlatformTests; - productName = RealmPlatformTests; - productReference = 25897B751E58BF4600D3563C /* RealmPlatformTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 25897AF81E58BD9100D3563C /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 0820; - ORGANIZATIONNAME = sergdort; - TargetAttributes = { - 25897AFF1E58BD9100D3563C = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - }; - 25897B131E58BD9100D3563C = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - TestTargetID = 25897AFF1E58BD9100D3563C; - }; - 25897B271E58BF0D00D3563C = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - }; - 25897B2F1E58BF0D00D3563C = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - TestTargetID = 25897AFF1E58BD9100D3563C; - }; - 25897B4A1E58BF3600D3563C = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - }; - 25897B521E58BF3600D3563C = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - TestTargetID = 25897AFF1E58BD9100D3563C; - }; - 25897B6C1E58BF4600D3563C = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - }; - 25897B741E58BF4600D3563C = { - CreatedOnToolsVersion = 8.2.1; - ProvisioningStyle = Automatic; - TestTargetID = 25897AFF1E58BD9100D3563C; - }; - }; - }; - buildConfigurationList = 25897AFB1E58BD9100D3563C /* Build configuration list for PBXProject "CleanArchitectureRxSwift" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 25897AF71E58BD9100D3563C; - productRefGroup = 25897B011E58BD9100D3563C /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 25897AFF1E58BD9100D3563C /* CleanArchitectureRxSwift */, - 25897B131E58BD9100D3563C /* CleanArchitectureRxSwiftTests */, - 25897B271E58BF0D00D3563C /* Domain */, - 25897B2F1E58BF0D00D3563C /* DomainTests */, - 25897B4A1E58BF3600D3563C /* CoreDataPlatform */, - 25897B521E58BF3600D3563C /* CoreDataPlatformTests */, - 25897B6C1E58BF4600D3563C /* RealmPlatform */, - 25897B741E58BF4600D3563C /* RealmPlatformTests */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 25897AFE1E58BD9100D3563C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B0E1E58BD9100D3563C /* LaunchScreen.storyboard in Resources */, - 25897B0B1E58BD9100D3563C /* Assets.xcassets in Resources */, - 25897B091E58BD9100D3563C /* Main.storyboard in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B121E58BD9100D3563C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B261E58BF0D00D3563C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B2E1E58BF0D00D3563C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B491E58BF3600D3563C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B511E58BF3600D3563C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B6B1E58BF4600D3563C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B731E58BF4600D3563C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 006C7C1FF46E3DB893CDE540 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CleanArchitectureRxSwiftTests/Pods-CleanArchitectureRxSwiftTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 015131BB381CBD181905CBC2 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - 17B07EE7C6E1F9585169BCEF /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CleanArchitectureRxSwift/Pods-CleanArchitectureRxSwift-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 203BDCA1039B7C197B857E89 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DomainTests/Pods-DomainTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 28CFE5669B8AE9607DF2856C /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CleanArchitectureRxSwift/Pods-CleanArchitectureRxSwift-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 2D5A32A95B40355B4FA7628D /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - 3747AA0E918E4480A0E286E4 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CoreDataPlatformTests/Pods-CoreDataPlatformTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 3B8B3FB51316DF1979F12E2F /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CoreDataPlatform/Pods-CoreDataPlatform-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 4D40437EE66B816D743E97B5 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - 5E2552E63A43C10038965F18 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - 7E130B3F8A11A4D1B94AA921 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CoreDataPlatformTests/Pods-CoreDataPlatformTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 99D05AF51EAFBA63AB33FF1A /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-CleanArchitectureRxSwiftTests/Pods-CleanArchitectureRxSwiftTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - 9B4B5981DAB42ED042081A6C /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Domain/Pods-Domain-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - 9DDCC75CAD78374C078CD054 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - A171EA0E053336EE692B913D /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-DomainTests/Pods-DomainTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - B5E1898DADCA47342737CBEF /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - BCF36B73A0784820E1EB47E1 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RealmPlatformTests/Pods-RealmPlatformTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - C595C3DED753CDD92CD22D17 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RealmPlatform/Pods-RealmPlatform-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - D0775CFF21514545A5358821 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; - F6C51612A3FD768B19019D61 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-RealmPlatformTests/Pods-RealmPlatformTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; - F6F2EEDD7AAC48A1BC11CD4B /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Check Pods Manifest.lock"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; - showEnvVarsInLog = 0; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 25897AFC1E58BD9100D3563C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897BFB1E58CB8F00D3563C /* Reusable.swift in Sources */, - 25897BF21E58CB8E00D3563C /* Application.swift in Sources */, - 25897BF91E58CB8F00D3563C /* Observable+Ext.swift in Sources */, - 25897BF71E58CB8F00D3563C /* ActivityIndicator.swift in Sources */, - 25897B041E58BD9100D3563C /* AppDelegate.swift in Sources */, - 2526A7141E59F8260078870E /* ErrorTracker.swift in Sources */, - 25897BFC1E58CB8F00D3563C /* ViewModelType.swift in Sources */, - 515F94853EF21BD13D636584 /* PostsNavigator.swift in Sources */, - 515F977483234BB090F6D704 /* PostsViewController.swift in Sources */, - 515F9083DB52FEDFEE97A5E6 /* PostsViewModel.swift in Sources */, - 515F9590146BEE2A0626CFF1 /* PostTableViewCell.swift in Sources */, - 515F95CFED58045AB6B168A4 /* CreatePostViewController.swift in Sources */, - 515F9625B58BCFB77F4AF678 /* CreatePostNavigator.swift in Sources */, - 2526A7161E5A2CD30078870E /* EditPostViewController.swift in Sources */, - 515F9850E701F4ECCC669D9B /* CreatePostViewModel.swift in Sources */, - 515F95A32860E22D7CB9563C /* EditPostViewModel.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B101E58BD9100D3563C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B191E58BD9100D3563C /* CleanArchitectureRxSwiftTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B231E58BF0D00D3563C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897BC61E58C42D00D3563C /* AllPostsUseCase.swift in Sources */, - 25897BC81E58C42D00D3563C /* SavePostUseCase.swift in Sources */, - 25897BC91E58C42D00D3563C /* Location.swift in Sources */, - 25897BCB1E58C42D00D3563C /* Post.swift in Sources */, - 25897BCA1E58C42D00D3563C /* Media.swift in Sources */, - 25897BFF1E58CE8B00D3563C /* ServiceLocator.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B2C1E58BF0D00D3563C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B381E58BF0D00D3563C /* DomainTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B461E58BF3600D3563C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897BBA1E58C25A00D3563C /* NSManagedObjectContext+Rx.swift in Sources */, - 25897BB81E58C25A00D3563C /* ContextScheduler.swift in Sources */, - 25897B9E1E58C24B00D3563C /* CDMedia+CoreDataProperties.swift in Sources */, - 25897B8C1E58C24500D3563C /* CoreDataStack.swift in Sources */, - 25897BAC1E58C25500D3563C /* Model.xcdatamodeld in Sources */, - 25897BA21E58C24B00D3563C /* CDPost+Ext.swift in Sources */, - 25897B9A1E58C24B00D3563C /* CDLocation+CoreDataClass.swift in Sources */, - 25897B9B1E58C24B00D3563C /* CDLocation+CoreDataProperties.swift in Sources */, - 25897B9D1E58C24B00D3563C /* CDMedia+CoreDataClass.swift in Sources */, - 25897BA81E58C25000D3563C /* NSManagedObjectContext+Ext.swift in Sources */, - 25897BA41E58C24B00D3563C /* Persistable.swift in Sources */, - 25897BA11E58C24B00D3563C /* CDPost+CoreDataProperties.swift in Sources */, - 25897B9C1E58C24B00D3563C /* CDLocation+Ext.swift in Sources */, - 25897BB71E58C25A00D3563C /* Repository.swift in Sources */, - 25897BBD1E58C25A00D3563C /* ServiceLocator.swift in Sources */, - 25897BB91E58C25A00D3563C /* FetchedResultsControllerEntityObserver.swift in Sources */, - 25897BA01E58C24B00D3563C /* CDPost+CoreDataClass.swift in Sources */, - 25897B9F1E58C24B00D3563C /* CDMedia+Ext.swift in Sources */, - 25897BA91E58C25000D3563C /* Observable+Ext.swift in Sources */, - 25897BA31E58C24B00D3563C /* DomainConvertibleType.swift in Sources */, - 25897BBC1E58C25A00D3563C /* SavePostUseCase.swift in Sources */, - 25897BBB1E58C25A00D3563C /* AllPostsUseCase.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B4F1E58BF3600D3563C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B5B1E58BF3600D3563C /* CoreDataPlatformTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B681E58BF4600D3563C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 515F9B4D6A3BD831B9D4FB8C /* RealmRepresentable.swift in Sources */, - 515F96794273284723F2848D /* DomainConvertibleType.swift in Sources */, - 515F9DBB950E2ABDB8D7895B /* RMPost.swift in Sources */, - 515F903E97C00DCE9EAEBF4D /* RMMedia.swift in Sources */, - 515F9BD6155258BD0C04DF36 /* RMLocation.swift in Sources */, - 515F9CD8F2B13D0328B77B6C /* Realm+Ext.swift in Sources */, - 515F9503C6F079D663CD9072 /* Repository.swift in Sources */, - 515F94802804A5FEB69837C8 /* AllPostsUseCase.swift in Sources */, - 515F978F1DBE7C45646004F1 /* Observable+Ext.swift in Sources */, - 515F926E776E33924F53A7F6 /* SavePostUseCase.swift in Sources */, - 515F973B5AA08DB9C2277A8C /* ServiceLocator.swift in Sources */, - 515F9A39814357F9E05282CD /* RunLoopThreadScheduler.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 25897B711E58BF4600D3563C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 25897B7D1E58BF4600D3563C /* RealmPlatformTests.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 25897B161E58BD9100D3563C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 25897AFF1E58BD9100D3563C /* CleanArchitectureRxSwift */; - targetProxy = 25897B151E58BD9100D3563C /* PBXContainerItemProxy */; - }; - 25897B331E58BF0D00D3563C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 25897B271E58BF0D00D3563C /* Domain */; - targetProxy = 25897B321E58BF0D00D3563C /* PBXContainerItemProxy */; - }; - 25897B351E58BF0D00D3563C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 25897AFF1E58BD9100D3563C /* CleanArchitectureRxSwift */; - targetProxy = 25897B341E58BF0D00D3563C /* PBXContainerItemProxy */; - }; - 25897B3C1E58BF0D00D3563C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 25897B271E58BF0D00D3563C /* Domain */; - targetProxy = 25897B3B1E58BF0D00D3563C /* PBXContainerItemProxy */; - }; - 25897B561E58BF3600D3563C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 25897B4A1E58BF3600D3563C /* CoreDataPlatform */; - targetProxy = 25897B551E58BF3600D3563C /* PBXContainerItemProxy */; - }; - 25897B581E58BF3600D3563C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 25897AFF1E58BD9100D3563C /* CleanArchitectureRxSwift */; - targetProxy = 25897B571E58BF3600D3563C /* PBXContainerItemProxy */; - }; - 25897B5F1E58BF3600D3563C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 25897B4A1E58BF3600D3563C /* CoreDataPlatform */; - targetProxy = 25897B5E1E58BF3600D3563C /* PBXContainerItemProxy */; - }; - 25897B781E58BF4600D3563C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 25897B6C1E58BF4600D3563C /* RealmPlatform */; - targetProxy = 25897B771E58BF4600D3563C /* PBXContainerItemProxy */; - }; - 25897B7A1E58BF4600D3563C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 25897AFF1E58BD9100D3563C /* CleanArchitectureRxSwift */; - targetProxy = 25897B791E58BF4600D3563C /* PBXContainerItemProxy */; - }; - 25897B811E58BF4600D3563C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 25897B6C1E58BF4600D3563C /* RealmPlatform */; - targetProxy = 25897B801E58BF4600D3563C /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin PBXVariantGroup section */ - 25897B071E58BD9100D3563C /* Main.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 25897B081E58BD9100D3563C /* Base */, - ); - name = Main.storyboard; - sourceTree = ""; - }; - 25897B0C1E58BD9100D3563C /* LaunchScreen.storyboard */ = { - isa = PBXVariantGroup; - children = ( - 25897B0D1E58BD9100D3563C /* Base */, - ); - name = LaunchScreen.storyboard; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 25897B1B1E58BD9100D3563C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - 25897B1C1E58BD9100D3563C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 25897B1E1E58BD9100D3563C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 84A5797E91E6FA5FA24A4896 /* Pods-CleanArchitectureRxSwift.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = CleanArchitectureRxSwift/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.CleanArchitectureRxSwift; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Debug; - }; - 25897B1F1E58BD9100D3563C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3F5B77FEC1EA2332323A0EB9 /* Pods-CleanArchitectureRxSwift.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - INFOPLIST_FILE = CleanArchitectureRxSwift/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.CleanArchitectureRxSwift; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - }; - name = Release; - }; - 25897B211E58BD9100D3563C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3D9EA43A0DD207CAFEADD07C /* Pods-CleanArchitectureRxSwiftTests.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - BUNDLE_LOADER = "$(TEST_HOST)"; - INFOPLIST_FILE = CleanArchitectureRxSwiftTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.CleanArchitectureRxSwiftTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CleanArchitectureRxSwift.app/CleanArchitectureRxSwift"; - }; - name = Debug; - }; - 25897B221E58BD9100D3563C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A6A063DE6BDC13E3B800BB80 /* Pods-CleanArchitectureRxSwiftTests.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - BUNDLE_LOADER = "$(TEST_HOST)"; - INFOPLIST_FILE = CleanArchitectureRxSwiftTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.CleanArchitectureRxSwiftTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CleanArchitectureRxSwift.app/CleanArchitectureRxSwift"; - }; - name = Release; - }; - 25897B401E58BF0D00D3563C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 07BECD54B799E689F7DF0941 /* Pods-Domain.debug.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Domain/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.Domain; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 25897B411E58BF0D00D3563C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FA1AB793DF561BEEC8C591F7 /* Pods-Domain.release.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = Domain/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.Domain; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 25897B441E58BF0D00D3563C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = B0092014AEC057C48B9745EA /* Pods-DomainTests.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - INFOPLIST_FILE = DomainTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.DomainTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CleanArchitectureRxSwift.app/CleanArchitectureRxSwift"; - }; - name = Debug; - }; - 25897B451E58BF0D00D3563C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9B6A26BB04BBAABE85CB9EDC /* Pods-DomainTests.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - INFOPLIST_FILE = DomainTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.DomainTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CleanArchitectureRxSwift.app/CleanArchitectureRxSwift"; - }; - name = Release; - }; - 25897B631E58BF3600D3563C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3058945350D99DC786F3CDC3 /* Pods-CoreDataPlatform.debug.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = CoreDataPlatform/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.CoreDataPlatform; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 25897B641E58BF3600D3563C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 71C4CC5892A6E3601D801729 /* Pods-CoreDataPlatform.release.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = CoreDataPlatform/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.CoreDataPlatform; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 25897B661E58BF3600D3563C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = F1F89859FF9197F25DB915C7 /* Pods-CoreDataPlatformTests.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - INFOPLIST_FILE = CoreDataPlatformTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.CoreDataPlatformTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CleanArchitectureRxSwift.app/CleanArchitectureRxSwift"; - }; - name = Debug; - }; - 25897B671E58BF3600D3563C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 2BBB44DCB902E459F05D68B0 /* Pods-CoreDataPlatformTests.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - INFOPLIST_FILE = CoreDataPlatformTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.CoreDataPlatformTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CleanArchitectureRxSwift.app/CleanArchitectureRxSwift"; - }; - name = Release; - }; - 25897B851E58BF4600D3563C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 4C9D6A2833A962FEF238F391 /* Pods-RealmPlatform.debug.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = RealmPlatform/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.RealmPlatform; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 25897B861E58BF4600D3563C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 081D23F2DCF9DBA930AB0FE7 /* Pods-RealmPlatform.release.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = RealmPlatform/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.RealmPlatform; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 25897B881E58BF4600D3563C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = A8E1F5AE93A531609690A036 /* Pods-RealmPlatformTests.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - INFOPLIST_FILE = RealmPlatformTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.RealmPlatformTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CleanArchitectureRxSwift.app/CleanArchitectureRxSwift"; - }; - name = Debug; - }; - 25897B891E58BF4600D3563C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 0D4A3B45078CD8ACCC1314EC /* Pods-RealmPlatformTests.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - INFOPLIST_FILE = RealmPlatformTests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.sergdort.RealmPlatformTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CleanArchitectureRxSwift.app/CleanArchitectureRxSwift"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 25897AFB1E58BD9100D3563C /* Build configuration list for PBXProject "CleanArchitectureRxSwift" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 25897B1B1E58BD9100D3563C /* Debug */, - 25897B1C1E58BD9100D3563C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 25897B1D1E58BD9100D3563C /* Build configuration list for PBXNativeTarget "CleanArchitectureRxSwift" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 25897B1E1E58BD9100D3563C /* Debug */, - 25897B1F1E58BD9100D3563C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 25897B201E58BD9100D3563C /* Build configuration list for PBXNativeTarget "CleanArchitectureRxSwiftTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 25897B211E58BD9100D3563C /* Debug */, - 25897B221E58BD9100D3563C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 25897B3F1E58BF0D00D3563C /* Build configuration list for PBXNativeTarget "Domain" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 25897B401E58BF0D00D3563C /* Debug */, - 25897B411E58BF0D00D3563C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 25897B431E58BF0D00D3563C /* Build configuration list for PBXNativeTarget "DomainTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 25897B441E58BF0D00D3563C /* Debug */, - 25897B451E58BF0D00D3563C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 25897B621E58BF3600D3563C /* Build configuration list for PBXNativeTarget "CoreDataPlatform" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 25897B631E58BF3600D3563C /* Debug */, - 25897B641E58BF3600D3563C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 25897B651E58BF3600D3563C /* Build configuration list for PBXNativeTarget "CoreDataPlatformTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 25897B661E58BF3600D3563C /* Debug */, - 25897B671E58BF3600D3563C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 25897B841E58BF4600D3563C /* Build configuration list for PBXNativeTarget "RealmPlatform" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 25897B851E58BF4600D3563C /* Debug */, - 25897B861E58BF4600D3563C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 25897B871E58BF4600D3563C /* Build configuration list for PBXNativeTarget "RealmPlatformTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 25897B881E58BF4600D3563C /* Debug */, - 25897B891E58BF4600D3563C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - -/* Begin XCVersionGroup section */ - 25897BAA1E58C25500D3563C /* Model.xcdatamodeld */ = { - isa = XCVersionGroup; - children = ( - 25897BAB1E58C25500D3563C /* Model.xcdatamodel */, - ); - currentVersion = 25897BAB1E58C25500D3563C /* Model.xcdatamodel */; - path = Model.xcdatamodeld; - sourceTree = ""; - versionGroupType = wrapper.xcdatamodel; - }; -/* End XCVersionGroup section */ - }; - rootObject = 25897AF81E58BD9100D3563C /* Project object */; -} diff --git a/CleanArchitectureRxSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/CleanArchitectureRxSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index cf3944af..00000000 --- a/CleanArchitectureRxSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/CleanArchitectureRxSwift.xcscheme b/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/CleanArchitectureRxSwift.xcscheme deleted file mode 100644 index 0924ee99..00000000 --- a/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/CleanArchitectureRxSwift.xcscheme +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/CoreDataPlatform.xcscheme b/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/CoreDataPlatform.xcscheme deleted file mode 100644 index 4670e5c3..00000000 --- a/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/CoreDataPlatform.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/Domain.xcscheme b/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/Domain.xcscheme deleted file mode 100644 index dd17b099..00000000 --- a/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/Domain.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/RealmPlatform.xcscheme b/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/RealmPlatform.xcscheme deleted file mode 100644 index 6be9eba8..00000000 --- a/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/RealmPlatform.xcscheme +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/xcschememanagement.plist b/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 6c16dd64..00000000 --- a/CleanArchitectureRxSwift.xcodeproj/xcuserdata/sergdort.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,72 +0,0 @@ - - - - - SchemeUserState - - CleanArchitectureRxSwift.xcscheme - - orderHint - 0 - - CoreDataPlatform.xcscheme - - orderHint - 2 - - Domain.xcscheme - - orderHint - 1 - - RealmPlatform.xcscheme - - orderHint - 3 - - - SuppressBuildableAutocreation - - 25897AFF1E58BD9100D3563C - - primary - - - 25897B131E58BD9100D3563C - - primary - - - 25897B271E58BF0D00D3563C - - primary - - - 25897B2F1E58BF0D00D3563C - - primary - - - 25897B4A1E58BF3600D3563C - - primary - - - 25897B521E58BF3600D3563C - - primary - - - 25897B6C1E58BF4600D3563C - - primary - - - 25897B741E58BF4600D3563C - - primary - - - - - diff --git a/CleanArchitectureRxSwift.xcworkspace/contents.xcworkspacedata b/CleanArchitectureRxSwift.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index b790726c..00000000 --- a/CleanArchitectureRxSwift.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - diff --git a/CleanArchitectureRxSwift.xcworkspace/xcuserdata/sergdort.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/CleanArchitectureRxSwift.xcworkspace/xcuserdata/sergdort.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index e2573a59..00000000 --- a/CleanArchitectureRxSwift.xcworkspace/xcuserdata/sergdort.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/CleanArchitectureRxSwift.xcworkspace/xcuserdata/sergdort.xcuserdatad/xcschemes/xcschememanagement.plist b/CleanArchitectureRxSwift.xcworkspace/xcuserdata/sergdort.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index ee3458dd..00000000 --- a/CleanArchitectureRxSwift.xcworkspace/xcuserdata/sergdort.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/CleanArchitectureRxSwift/AppDelegate.swift b/CleanArchitectureRxSwift/AppDelegate.swift deleted file mode 100644 index f9b92c83..00000000 --- a/CleanArchitectureRxSwift/AppDelegate.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// AppDelegate.swift -// CleanArchitectureRxSwift -// -// Created by sergdort on 18/02/2017. -// Copyright © 2017 sergdort. All rights reserved. -// - -import UIKit - -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - var window: UIWindow? - - - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { - let window = UIWindow(frame: UIScreen.main.bounds) - - Application.shared.configureMainInterface(in: window) - - self.window = window - return true - } - -} diff --git a/CleanArchitectureRxSwift/Application/Application.swift b/CleanArchitectureRxSwift/Application/Application.swift deleted file mode 100644 index 5b9601c8..00000000 --- a/CleanArchitectureRxSwift/Application/Application.swift +++ /dev/null @@ -1,38 +0,0 @@ -import Foundation -import Domain -import CoreDataPlatform -import RealmPlatform - -final class Application { - static let shared = Application() - - private let coreDataServiceLocator: Domain.ServiceLocator - private let realmServiceLocator: Domain.ServiceLocator - - private init() { - self.coreDataServiceLocator = CoreDataPlatform.ServiceLocator.shared - self.realmServiceLocator = RealmPlatform.ServiceLocator.shared - } - - func configureMainInterface(in window: UIWindow) { - let storyboard = UIStoryboard(name: "Main", bundle: nil) - let cdNavigationController = UINavigationController() - cdNavigationController.tabBarItem = UITabBarItem(title: "CoreData", image: nil, selectedImage: nil) - let cdNavigator = DefaultPostsNavigator(services: coreDataServiceLocator, - navigationController: cdNavigationController, - storyBoard: storyboard) - - let rmNavigationController = UINavigationController() - rmNavigationController.tabBarItem = UITabBarItem(title: "Realm", image: nil, selectedImage: nil) - let rmNavigator = DefaultPostsNavigator(services: realmServiceLocator, - navigationController: rmNavigationController, - storyBoard: storyboard) - - let tabBarController = UITabBarController() - tabBarController.viewControllers = [cdNavigationController, rmNavigationController] - window.rootViewController = tabBarController - - cdNavigator.toPosts() - rmNavigator.toPosts() - } -} diff --git a/CleanArchitectureRxSwift/Assets.xcassets/AppIcon.appiconset/Contents.json b/CleanArchitectureRxSwift/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 118c98f7..00000000 --- a/CleanArchitectureRxSwift/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "images" : [ - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/CleanArchitectureRxSwift/Base.lproj/LaunchScreen.storyboard b/CleanArchitectureRxSwift/Base.lproj/LaunchScreen.storyboard deleted file mode 100644 index fdf3f97d..00000000 --- a/CleanArchitectureRxSwift/Base.lproj/LaunchScreen.storyboard +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CleanArchitectureRxSwift/Base.lproj/Main.storyboard b/CleanArchitectureRxSwift/Base.lproj/Main.storyboard deleted file mode 100644 index 8bb57ecf..00000000 --- a/CleanArchitectureRxSwift/Base.lproj/Main.storyboard +++ /dev/null @@ -1,240 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/CleanArchitectureRxSwift/Common/ViewModelType.swift b/CleanArchitectureRxSwift/Common/ViewModelType.swift deleted file mode 100644 index 1c3d691e..00000000 --- a/CleanArchitectureRxSwift/Common/ViewModelType.swift +++ /dev/null @@ -1,8 +0,0 @@ -import Foundation - -protocol ViewModelType { - associatedtype Input - associatedtype Output - - func transform(input: Input) -> Output -} diff --git a/CleanArchitectureRxSwift/Info.plist b/CleanArchitectureRxSwift/Info.plist deleted file mode 100644 index 38e98af2..00000000 --- a/CleanArchitectureRxSwift/Info.plist +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - LSRequiresIPhoneOS - - UILaunchStoryboardName - LaunchScreen - UIMainStoryboardFile - Main - UIRequiredDeviceCapabilities - - armv7 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - - diff --git a/CleanArchitectureRxSwift/Scenes/AllPosts/PostTableViewCell.swift b/CleanArchitectureRxSwift/Scenes/AllPosts/PostTableViewCell.swift deleted file mode 100644 index 42a319d3..00000000 --- a/CleanArchitectureRxSwift/Scenes/AllPosts/PostTableViewCell.swift +++ /dev/null @@ -1,6 +0,0 @@ -import UIKit - -final class PostTableViewCell: UITableViewCell { - @IBOutlet weak var titleLabel: UILabel! - @IBOutlet weak var detailsLabel: UILabel! -} diff --git a/CleanArchitectureRxSwift/Scenes/AllPosts/PostsNavigator.swift b/CleanArchitectureRxSwift/Scenes/AllPosts/PostsNavigator.swift deleted file mode 100644 index d9ce3cf9..00000000 --- a/CleanArchitectureRxSwift/Scenes/AllPosts/PostsNavigator.swift +++ /dev/null @@ -1,46 +0,0 @@ -import UIKit -import Domain - -protocol PostsNavigator { - func toCreatePost() - func toPost(_ post: Post) - func toPosts() -} - -class DefaultPostsNavigator: PostsNavigator { - private let storyBoard: UIStoryboard - private let navigationController: UINavigationController - private let services: ServiceLocator - - init(services: ServiceLocator, - navigationController: UINavigationController, - storyBoard: UIStoryboard) { - self.services = services - self.navigationController = navigationController - self.storyBoard = storyBoard - } - - func toPosts() { - let vc = storyBoard.instantiateViewController(ofType: PostsViewController.self) - vc.viewModel = PostsViewModel(useCase: services.getAllPostsUseCase(), - navigator: self) - navigationController.pushViewController(vc, animated: true) - } - - func toCreatePost() { - let navigator = DefaultCreatePostNavigator(navigationController: navigationController) - let viewModel = CreatePostViewModel(createPostUseCase: services.getCreatePostUseCase(), - navigator: navigator) - let vc = storyBoard.instantiateViewController(ofType: CreatePostViewController.self) - vc.viewModel = viewModel - let nc = UINavigationController(rootViewController: vc) - navigationController.present(nc, animated: true, completion: nil) - } - - func toPost(_ post: Post) { - let vc = storyBoard.instantiateViewController(ofType: EditPostViewController.self) - let viewModel = EditPostViewModel(post: post, useCase: services.getCreatePostUseCase()) - vc.viewModel = viewModel - navigationController.pushViewController(vc, animated: true) - } -} diff --git a/CleanArchitectureRxSwift/Scenes/AllPosts/PostsViewController.swift b/CleanArchitectureRxSwift/Scenes/AllPosts/PostsViewController.swift deleted file mode 100644 index 464a0f9d..00000000 --- a/CleanArchitectureRxSwift/Scenes/AllPosts/PostsViewController.swift +++ /dev/null @@ -1,44 +0,0 @@ -import UIKit -import Domain -import RxSwift -import RxCocoa - -class PostsViewController: UIViewController { - private let disposeBag = DisposeBag() - - var viewModel: PostsViewModel! - @IBOutlet weak var tableView: UITableView! - @IBOutlet weak var createPostButton: UIBarButtonItem! - - override func viewDidLoad() { - super.viewDidLoad() - configureTableView() - bindViewModel() - } - - private func configureTableView() { - tableView.refreshControl = UIRefreshControl() - tableView.estimatedRowHeight = 64 - tableView.rowHeight = UITableViewAutomaticDimension - } - - private func bindViewModel() { - assert(viewModel != nil) - - let input = PostsViewModel.Input(trigger: Driver.just(), - createPostTrigger: createPostButton.rx.tap.asDriver(), - selection: tableView.rx.itemSelected.asDriver()) - let output = viewModel.transform(input: input) - //Bind Posts to UITableView - output.posts.drive(tableView.rx.items(cellIdentifier: PostTableViewCell.reuseID, cellType: PostTableViewCell.self)) { tv, item, cell in - cell.titleLabel.text = item.title - cell.detailsLabel.text = item.content - }.addDisposableTo(disposeBag) - //Connect Create Post to UI - output.createPost.drive().addDisposableTo(disposeBag) - output.selectedPost.drive().addDisposableTo(disposeBag) - } -} - - - diff --git a/CleanArchitectureRxSwift/Scenes/AllPosts/PostsViewModel.swift b/CleanArchitectureRxSwift/Scenes/AllPosts/PostsViewModel.swift deleted file mode 100644 index 27e9809b..00000000 --- a/CleanArchitectureRxSwift/Scenes/AllPosts/PostsViewModel.swift +++ /dev/null @@ -1,54 +0,0 @@ -import Foundation -import Domain -import RxSwift -import RxCocoa - -final class PostsViewModel: ViewModelType { - struct Input { - let trigger: Driver - let createPostTrigger: Driver - let selection: Driver - } - struct Output { - let fetching: Driver - let posts: Driver<[Post]> - let createPost: Driver - let selectedPost: Driver - let error: Driver - } - - private let useCase: AllPostsUseCase - private let navigator: PostsNavigator - - init(useCase: AllPostsUseCase, navigator: PostsNavigator) { - self.useCase = useCase - self.navigator = navigator - } - - func transform(input: Input) -> Output { - let activityIndicator = ActivityIndicator() - let errorTracker = ErrorTracker() - let posts = input.trigger.flatMapLatest { - return self.useCase.posts() - .trackActivity(activityIndicator) - .trackError(errorTracker) - .asDriver(onErrorJustReturn: []) - } - - let fetching = activityIndicator.asDriver() - let errors = errorTracker.asDriver() - let selectedPost = input.selection - .withLatestFrom(posts) { (indexPath, posts) -> Post in - return posts[indexPath.row] - } - .do(onNext: navigator.toPost) - let createPost = input.createPostTrigger - .do(onNext: navigator.toCreatePost) - - return Output(fetching: fetching, - posts: posts, - createPost: createPost, - selectedPost: selectedPost, - error: errors) - } -} diff --git a/CleanArchitectureRxSwift/Scenes/CreatePost/CreatePostNavigator.swift b/CleanArchitectureRxSwift/Scenes/CreatePost/CreatePostNavigator.swift deleted file mode 100644 index 511e0094..00000000 --- a/CleanArchitectureRxSwift/Scenes/CreatePost/CreatePostNavigator.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// Created by sergdort on 19/02/2017. -// Copyright (c) 2017 sergdort. All rights reserved. -// - - -import Foundation -import UIKit -import Domain - -protocol CreatePostNavigator { - - func toPosts() -} - -final class DefaultCreatePostNavigator: CreatePostNavigator { - private let navigationController: UINavigationController - - init(navigationController: UINavigationController) { - self.navigationController = navigationController - } - - func toPosts() { - navigationController.dismiss(animated: true) - } -} diff --git a/CleanArchitectureRxSwift/Scenes/CreatePost/CreatePostViewController.swift b/CleanArchitectureRxSwift/Scenes/CreatePost/CreatePostViewController.swift deleted file mode 100644 index fdb92215..00000000 --- a/CleanArchitectureRxSwift/Scenes/CreatePost/CreatePostViewController.swift +++ /dev/null @@ -1,30 +0,0 @@ -import UIKit -import Domain -import RxSwift -import RxCocoa - -final class CreatePostViewController: UIViewController { - private let disposeBag = DisposeBag() - - var viewModel: CreatePostViewModel! - - @IBOutlet weak var cancelButton: UIBarButtonItem! - @IBOutlet weak var saveButton: UIBarButtonItem! - @IBOutlet weak var titleTextField: UITextField! - @IBOutlet weak var detailsTextView: UITextView! - - override func viewDidLoad() { - super.viewDidLoad() - let input = CreatePostViewModel.Input(cancelTrigger: cancelButton.rx.tap.asDriver(), - saveTrigger: saveButton.rx.tap.asDriver(), - title: titleTextField.rx.text.orEmpty.asDriver(), - details: detailsTextView.rx.text.orEmpty.asDriver()) - - let output = viewModel.transform(input: input) - - output.dismiss.drive() - .addDisposableTo(disposeBag) - output.saveEnabled.drive(saveButton.rx.isEnabled) - .addDisposableTo(disposeBag) - } -} diff --git a/CleanArchitectureRxSwift/Scenes/CreatePost/CreatePostViewModel.swift b/CleanArchitectureRxSwift/Scenes/CreatePost/CreatePostViewModel.swift deleted file mode 100644 index 0de0256a..00000000 --- a/CleanArchitectureRxSwift/Scenes/CreatePost/CreatePostViewModel.swift +++ /dev/null @@ -1,66 +0,0 @@ -// -// Created by sergdort on 19/02/2017. -// Copyright (c) 2017 sergdort. All rights reserved. -// - - -import Foundation -import RxSwift -import RxCocoa -import Domain - -final class CreatePostViewModel: ViewModelType { - private let createPostUseCase: SavePostUseCase - private let navigator: CreatePostNavigator - - init(createPostUseCase: SavePostUseCase, navigator: CreatePostNavigator) { - self.createPostUseCase = createPostUseCase - self.navigator = navigator - } - - func transform(input: Input) -> Output { - let titleAndDetails = Driver.combineLatest(input.title, input.details) { - $0 - } - let activityIndicator = ActivityIndicator() - - let canSave = Driver.combineLatest(titleAndDetails, activityIndicator.asDriver()) { - return !$0.0.isEmpty && !$0.1.isEmpty && !$1 - } - - - let save = input.saveTrigger.withLatestFrom(titleAndDetails) - .map { (title, content) in - return Post(uid: UUID().uuidString, - createDate: Date(), - updateDate: Date(), - title: title, - content: content) - } - .flatMapLatest { [unowned self] in - return self.createPostUseCase.save(post: $0) - .trackActivity(activityIndicator) - .asDriverOnErrorJustComplete() - } - - let dismiss = Driver.of(save, input.cancelTrigger) - .merge() - .do(onNext: navigator.toPosts) - - return Output(dismiss: dismiss, saveEnabled: canSave) - } -} - -extension CreatePostViewModel { - struct Input { - let cancelTrigger: Driver - let saveTrigger: Driver - let title: Driver - let details: Driver - } - - struct Output { - let dismiss: Driver - let saveEnabled: Driver - } -} diff --git a/CleanArchitectureRxSwift/Scenes/EditPost/EditPostViewController.swift b/CleanArchitectureRxSwift/Scenes/EditPost/EditPostViewController.swift deleted file mode 100644 index c6502f5d..00000000 --- a/CleanArchitectureRxSwift/Scenes/EditPost/EditPostViewController.swift +++ /dev/null @@ -1,63 +0,0 @@ -import UIKit -import RxSwift -import RxCocoa -import Domain - -final class EditPostViewController: UIViewController { - private let disposeBag = DisposeBag() - - @IBOutlet weak var editButton: UIBarButtonItem! - @IBOutlet weak var titleTextField: UITextField! - @IBOutlet weak var detailsTextView: UITextView! - - var viewModel: EditPostViewModel! - - override func viewDidLoad() { - super.viewDidLoad() - - let input = EditPostViewModel.Input(editTrigger: editButton.rx.tap.asDriver(), - title: titleTextField.rx.text.orEmpty.asDriver(), - details: detailsTextView.rx.text.orEmpty.asDriver()) - let output = viewModel.transform(input: input) - - output.editButtonTitle.drive(editButton.rx.title).addDisposableTo(disposeBag) - output.editing.drive(titleTextField.rx.isEnabled).addDisposableTo(disposeBag) - output.editing.drive(detailsTextView.rx.isEditable).addDisposableTo(disposeBag) - output.post.drive(postBinding).addDisposableTo(disposeBag) - output.save.drive().addDisposableTo(disposeBag) - output.error.drive(errorBinding).addDisposableTo(disposeBag) - } - - - var postBinding: UIBindingObserver { - return UIBindingObserver(UIElement: self, binding: { (vc, post) in - vc.titleTextField.text = post.title - vc.detailsTextView.text = post.content - vc.title = post.title - }) - } - - var errorBinding: UIBindingObserver { - return UIBindingObserver(UIElement: self, binding: { (vc, _) in - let alert = UIAlertController(title: "Save Error", - message: "Something went wrong", - preferredStyle: .alert) - let action = UIAlertAction(title: "Dismiss", - style: UIAlertActionStyle.cancel, - handler: nil) - alert.addAction(action) - vc.present(alert, animated: true, completion: nil) - }) - } -} - - - -extension Reactive where Base: UITextView { - var isEditable: UIBindingObserver { - return UIBindingObserver(UIElement: self.base, binding: { (textView, isEditable) in - textView.isEditable = isEditable - }) - } -} - diff --git a/CleanArchitectureRxSwift/Scenes/EditPost/EditPostViewModel.swift b/CleanArchitectureRxSwift/Scenes/EditPost/EditPostViewModel.swift deleted file mode 100644 index 055b85d7..00000000 --- a/CleanArchitectureRxSwift/Scenes/EditPost/EditPostViewModel.swift +++ /dev/null @@ -1,66 +0,0 @@ -import Domain -import RxSwift -import RxCocoa - -final class EditPostViewModel: ViewModelType { - private let post: Post - private let useCase: SavePostUseCase - - init(post: Post, useCase: SavePostUseCase) { - self.post = post - self.useCase = useCase - } - - func transform(input: Input) -> Output { - let errorTracker = ErrorTracker() - let editing = input.editTrigger.scan(false) { editing, _ in - return !editing - }.startWith(false) - - let saveTrigger = editing.skip(1) //we dont need initial state - .filter { $0 == false } - .mapToVoid() - let titleAndDetails = Driver.combineLatest(input.title, input.details) { - $0 - } - let post = Driver.combineLatest(Driver.just(self.post), titleAndDetails) { (post, titleAndDetails) -> Post in - return Post(uid: post.uid, - createDate: post.createDate, - updateDate: Date(), - title: titleAndDetails.0, - content: titleAndDetails.1, - media: post.media, - location: post.location) - }.startWith(self.post) - let editButtonTitle = editing.map { editing -> String in - return editing == true ? "Save" : "Edit" - } - let savePost = saveTrigger.withLatestFrom(post) - .flatMapLatest { post in - return self.useCase.save(post: post) - .trackError(errorTracker) - .asDriverOnErrorJustComplete() - } - return Output(editButtonTitle: editButtonTitle, - save: savePost, - editing: editing, - post: post, - error: errorTracker.asDriver()) - } -} - -extension EditPostViewModel { - struct Input { - let editTrigger: Driver - let title: Driver - let details: Driver - } - - struct Output { - let editButtonTitle: Driver - let save: Driver - let editing: Driver - let post: Driver - let error: Driver - } -} diff --git a/CleanArchitectureRxSwift/Utility/ActivityIndicator.swift b/CleanArchitectureRxSwift/Utility/ActivityIndicator.swift deleted file mode 100644 index 6a97bb3a..00000000 --- a/CleanArchitectureRxSwift/Utility/ActivityIndicator.swift +++ /dev/null @@ -1,73 +0,0 @@ -import Foundation -import RxSwift -import RxCocoa - -private struct ActivityToken : ObservableConvertibleType, Disposable { - private let _source: Observable - private let _dispose: Cancelable - - init(source: Observable, disposeAction: @escaping () -> ()) { - _source = source - _dispose = Disposables.create(with: disposeAction) - } - - func dispose() { - _dispose.dispose() - } - - func asObservable() -> Observable { - return _source - } -} - -/** -Enables monitoring of sequence computation. - -If there is at least one sequence computation in progress, `true` will be sent. -When all activities complete `false` will be sent. -*/ -public class ActivityIndicator : SharedSequenceConvertibleType { - public typealias E = Bool - public typealias SharingStrategy = DriverSharingStrategy - - private let _lock = NSRecursiveLock() - private let _variable = Variable(0) - private let _loading: SharedSequence - - public init() { - _loading = _variable.asDriver() - .map { $0 > 0 } - .distinctUntilChanged() - } - - fileprivate func trackActivityOfObservable(_ source: O) -> Observable { - return Observable.using({ () -> ActivityToken in - self.increment() - return ActivityToken(source: source.asObservable(), disposeAction: self.decrement) - }) { t in - return t.asObservable() - } - } - - private func increment() { - _lock.lock() - _variable.value = _variable.value + 1 - _lock.unlock() - } - - private func decrement() { - _lock.lock() - _variable.value = _variable.value - 1 - _lock.unlock() - } - - public func asSharedSequence() -> SharedSequence { - return _loading - } -} - -extension ObservableConvertibleType { - public func trackActivity(_ activityIndicator: ActivityIndicator) -> Observable { - return activityIndicator.trackActivityOfObservable(self) - } -} diff --git a/CleanArchitectureRxSwift/Utility/ErrorTracker.swift b/CleanArchitectureRxSwift/Utility/ErrorTracker.swift deleted file mode 100644 index 4dc5ee89..00000000 --- a/CleanArchitectureRxSwift/Utility/ErrorTracker.swift +++ /dev/null @@ -1,40 +0,0 @@ -// -// Created by sergdort on 03/02/2017. -// Copyright (c) 2017 sergdort. All rights reserved. -// - - -import Foundation -import RxSwift -import RxCocoa - -final class ErrorTracker: SharedSequenceConvertibleType { - typealias SharingStrategy = DriverSharingStrategy - private let _subject = PublishSubject() - - func trackError(from source: O) -> Observable { - return source.asObservable().do(onError: onError) - } - - func asSharedSequence() -> SharedSequence { - return _subject.asObservable().asDriverOnErrorJustComplete() - } - - func asObservable() -> Observable { - return _subject.asObservable() - } - - private func onError(_ error: Error) { - _subject.onNext(error) - } - - deinit { - _subject.onCompleted() - } -} - -extension ObservableConvertibleType { - func trackError(_ errorTracker: ErrorTracker) -> Observable { - return errorTracker.trackError(from: self) - } -} diff --git a/CleanArchitectureRxSwift/Utility/Observable+Ext.swift b/CleanArchitectureRxSwift/Utility/Observable+Ext.swift deleted file mode 100644 index 81023873..00000000 --- a/CleanArchitectureRxSwift/Utility/Observable+Ext.swift +++ /dev/null @@ -1,37 +0,0 @@ -import Foundation -import RxSwift -import RxCocoa - -extension ObservableType where E == Bool { - /// Boolean not operator - public func not() -> Observable { - return self.map(!) - } - -} - -extension SharedSequenceConvertibleType { - func mapToVoid() -> SharedSequence { - return map { _ in } - } -} - -extension ObservableType { - - func catchErrorJustComplete() -> Observable { - return catchError { _ in - return Observable.empty() - } - } - - func asDriverOnErrorJustComplete() -> Driver { - return asDriver { _ in - assertionFailure() - return Driver.empty() - } - } - - func mapToVoid() -> Observable { - return map { _ in } - } -} diff --git a/CleanArchitectureRxSwift/Utility/Reusable.swift b/CleanArchitectureRxSwift/Utility/Reusable.swift deleted file mode 100644 index b0db67c0..00000000 --- a/CleanArchitectureRxSwift/Utility/Reusable.swift +++ /dev/null @@ -1,34 +0,0 @@ -import UIKit - -protocol Reusable { - static var reuseID: String {get} -} - -extension Reusable { - static var reuseID: String { - return String(describing: self) - } -} - -extension UITableViewCell: Reusable {} - -extension UIViewController: Reusable {} - -extension UITableView { - func dequeueReusableCell(ofType cellType: T.Type = T.self, at indexPath: IndexPath) -> T where T: UITableViewCell { - guard let cell = dequeueReusableCell(withIdentifier: cellType.reuseID, - for: indexPath) as? T else { - fatalError() - } - return cell - } -} - -extension UIStoryboard { - func instantiateViewController(ofType type: T.Type = T.self) -> T where T: UIViewController { - guard let viewController = instantiateViewController(withIdentifier: type.reuseID) as? T else { - fatalError() - } - return viewController - } -} diff --git a/CleanArchitectureRxSwiftTests/CleanArchitectureRxSwiftTests.swift b/CleanArchitectureRxSwiftTests/CleanArchitectureRxSwiftTests.swift deleted file mode 100644 index 2d42896c..00000000 --- a/CleanArchitectureRxSwiftTests/CleanArchitectureRxSwiftTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// CleanArchitectureRxSwiftTests.swift -// CleanArchitectureRxSwiftTests -// -// Created by sergdort on 18/02/2017. -// Copyright © 2017 sergdort. All rights reserved. -// - -import XCTest -@testable import CleanArchitectureRxSwift - -class CleanArchitectureRxSwiftTests: XCTestCase { - - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/CleanArchitectureRxSwiftTests/Info.plist b/CleanArchitectureRxSwiftTests/Info.plist deleted file mode 100644 index 6c6c23c4..00000000 --- a/CleanArchitectureRxSwiftTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/CoreDataPlatform/CoreDataPlatform.h b/CoreDataPlatform/CoreDataPlatform.h deleted file mode 100644 index cd4adaa6..00000000 --- a/CoreDataPlatform/CoreDataPlatform.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// CoreDataPlatform.h -// CoreDataPlatform -// -// Created by sergdort on 18/02/2017. -// Copyright © 2017 sergdort. All rights reserved. -// - -#import - -//! Project version number for CoreDataPlatform. -FOUNDATION_EXPORT double CoreDataPlatformVersionNumber; - -//! Project version string for CoreDataPlatform. -FOUNDATION_EXPORT const unsigned char CoreDataPlatformVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/CoreDataPlatform/CoreDataStack/CoreDataStack.swift b/CoreDataPlatform/CoreDataStack/CoreDataStack.swift deleted file mode 100644 index 61f58885..00000000 --- a/CoreDataPlatform/CoreDataStack/CoreDataStack.swift +++ /dev/null @@ -1,34 +0,0 @@ -import Foundation -import CoreData - -final class CoreDataStack { - private let storeCoordinator: NSPersistentStoreCoordinator - let context: NSManagedObjectContext - - init() { - let bundle = Bundle(for: CoreDataStack.self) - guard let url = bundle.url(forResource: "Model", withExtension: "momd"), - let model = NSManagedObjectModel(contentsOf: url) else { - fatalError() - } - self.storeCoordinator = NSPersistentStoreCoordinator(managedObjectModel: model) - self.context = NSManagedObjectContext(concurrencyType: .privateQueueConcurrencyType) - self.context.persistentStoreCoordinator = self.storeCoordinator - self.migrateStore() - } - - private func migrateStore() { - guard let url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last else { - fatalError() - } - let storeUrl = url.appendingPathComponent("Model.sqlite") - do { - try storeCoordinator.addPersistentStore(ofType: NSSQLiteStoreType, - configurationName: nil, - at: storeUrl, - options: nil) - } catch { - fatalError("Error migrating store: \(error)") - } - } -} diff --git a/CoreDataPlatform/Entities/CDLocation+CoreDataClass.swift b/CoreDataPlatform/Entities/CDLocation+CoreDataClass.swift deleted file mode 100644 index bc00da8a..00000000 --- a/CoreDataPlatform/Entities/CDLocation+CoreDataClass.swift +++ /dev/null @@ -1,7 +0,0 @@ -import Foundation -import CoreData - - -internal final class CDLocation: NSManagedObject { - -} diff --git a/CoreDataPlatform/Entities/CDLocation+CoreDataProperties.swift b/CoreDataPlatform/Entities/CDLocation+CoreDataProperties.swift deleted file mode 100644 index 0185230a..00000000 --- a/CoreDataPlatform/Entities/CDLocation+CoreDataProperties.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// CDLocation+CoreDataProperties.swift -// NetworkAndSecurity -// -// Created by sergdort on 07/01/2017. -// Copyright © 2017 sergdort. All rights reserved. -// - -import Foundation -import CoreData - - -extension CDLocation { - - @nonobjc public class func fetchRequest() -> NSFetchRequest { - return NSFetchRequest(entityName: "CDLocation"); - } - - @NSManaged public var latitude: Double - @NSManaged public var longitude: Double - @NSManaged public var name: String? - @NSManaged public var uid: String? - @NSManaged public var post: CDPost? - -} diff --git a/CoreDataPlatform/Entities/CDLocation+Ext.swift b/CoreDataPlatform/Entities/CDLocation+Ext.swift deleted file mode 100644 index 075a7fe0..00000000 --- a/CoreDataPlatform/Entities/CDLocation+Ext.swift +++ /dev/null @@ -1,35 +0,0 @@ -import Foundation -import CoreData -import Domain -import QueryKit - -extension CDLocation { - static var latitude: Attribute { return Attribute("latitude")} - static var longitude: Attribute { return Attribute("longitude")} - static var name: Attribute { return Attribute("name")} - static var post: Attribute { return Attribute("post")} -} - -extension CDLocation: DomainConvertibleType { - func asDomain() -> Location { - return Location(uid: uid!, latitude: latitude, - longitude: longitude, - name: name ?? "") - } -} - -extension CDLocation: Persistable { - static var entityName: String { - return "CDLocation" - } -} - -extension Location: CoreDataRepresentable { - typealias CoreDataType = CDLocation - - func update(entity: CDLocation) { - entity.uid = uid - entity.latitude = latitude - entity.longitude = longitude - } -} diff --git a/CoreDataPlatform/Entities/CDMedia+CoreDataClass.swift b/CoreDataPlatform/Entities/CDMedia+CoreDataClass.swift deleted file mode 100644 index 7b26de07..00000000 --- a/CoreDataPlatform/Entities/CDMedia+CoreDataClass.swift +++ /dev/null @@ -1,7 +0,0 @@ -import Foundation -import CoreData - - -final class CDMedia: NSManagedObject { - -} diff --git a/CoreDataPlatform/Entities/CDMedia+CoreDataProperties.swift b/CoreDataPlatform/Entities/CDMedia+CoreDataProperties.swift deleted file mode 100644 index 0d8cc5a2..00000000 --- a/CoreDataPlatform/Entities/CDMedia+CoreDataProperties.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// CDMedia+CoreDataProperties.swift -// NetworkAndSecurity -// -// Created by sergdort on 07/01/2017. -// Copyright © 2017 sergdort. All rights reserved. -// - -import Foundation -import CoreData - - -extension CDMedia { - - @nonobjc public class func fetchRequest() -> NSFetchRequest { - return NSFetchRequest(entityName: "CDMedia"); - } - - @NSManaged public var type: String? - @NSManaged public var url: String? - @NSManaged public var uid: String? - @NSManaged public var post: CDPost? - -} diff --git a/CoreDataPlatform/Entities/CDMedia+Ext.swift b/CoreDataPlatform/Entities/CDMedia+Ext.swift deleted file mode 100644 index 478b2b61..00000000 --- a/CoreDataPlatform/Entities/CDMedia+Ext.swift +++ /dev/null @@ -1,34 +0,0 @@ -import Foundation -import CoreData -import QueryKit -import Domain -import RxSwift - - -extension CDMedia { - static var type: Attribute { return Attribute("type")} - static var url: Attribute { return Attribute("url")} - static var post: Attribute { return Attribute("post")} -} - -extension CDMedia: DomainConvertibleType { - func asDomain() -> Media { - return Media(uid: uid!, type: MediaType(rawValue: type!)!, url: URL(string: url!)!) - } -} - -extension CDMedia: Persistable { - static var entityName: String { - return "CDMedia" - } -} - -extension Media: CoreDataRepresentable { - typealias CoreDataType = CDMedia - - func update(entity: CDMedia) { - entity.uid = uid - entity.url = url.absoluteString - entity.type = type.rawValue - } -} diff --git a/CoreDataPlatform/Entities/CDPost+CoreDataClass.swift b/CoreDataPlatform/Entities/CDPost+CoreDataClass.swift deleted file mode 100644 index 30a139c5..00000000 --- a/CoreDataPlatform/Entities/CDPost+CoreDataClass.swift +++ /dev/null @@ -1,7 +0,0 @@ -import Foundation -import CoreData - - -final class CDPost: NSManagedObject { - -} diff --git a/CoreDataPlatform/Entities/CDPost+CoreDataProperties.swift b/CoreDataPlatform/Entities/CDPost+CoreDataProperties.swift deleted file mode 100644 index cac5bc39..00000000 --- a/CoreDataPlatform/Entities/CDPost+CoreDataProperties.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// CDPost+CoreDataProperties.swift -// NetworkAndSecurity -// -// Created by sergdort on 07/01/2017. -// Copyright © 2017 sergdort. All rights reserved. -// - -import Foundation -import CoreData - - -extension CDPost { - - @nonobjc public class func fetchRequest() -> NSFetchRequest { - return NSFetchRequest(entityName: "CDPost"); - } - - @NSManaged public var title: String? - @NSManaged public var content: String? - @NSManaged public var createDate: NSDate? - @NSManaged public var updateDate: NSDate? - @NSManaged public var uid: String? - @NSManaged public var media: CDMedia? - @NSManaged public var location: CDLocation? - -} diff --git a/CoreDataPlatform/Entities/CDPost+Ext.swift b/CoreDataPlatform/Entities/CDPost+Ext.swift deleted file mode 100644 index 86863517..00000000 --- a/CoreDataPlatform/Entities/CDPost+Ext.swift +++ /dev/null @@ -1,66 +0,0 @@ -// -// CDPost+CoreDataClass.swift -// NetworkAndSecurity -// -// Created by sergdort on 07/01/2017. -// Copyright © 2017 sergdort. All rights reserved. -// This file was automatically generated and should not be edited. -// - -import Foundation -import CoreData -import Domain -import QueryKit -import RxSwift - -extension CDPost { - static var title: Attribute { return Attribute("title")} - static var content: Attribute { return Attribute("content")} - static var createDate: Attribute { return Attribute("createDate")} - static var updateDate: Attribute { return Attribute("updateDate")} - static var media: Attribute { return Attribute("media")} - static var location: Attribute { return Attribute("location")} -} - -extension CDPost: DomainConvertibleType { - func asDomain() -> Post { - return Post(uid: uid!, - createDate: createDate! as Date, - updateDate: updateDate! as Date, - title: title!, - content: content!, - media: media?.asDomain(), - location: location?.asDomain()) - } -} - -extension CDPost: Persistable { - static var entityName: String { - return "CDPost" - } - - static func synced(post: CDPost, with media: CDMedia?, location: CDLocation?) -> CDPost { - post.media = media - post.location = location - return post - } -} - -extension Post: CoreDataRepresentable { - typealias CoreDataType = CDPost - - func sync(in context: NSManagedObjectContext) -> Observable { - let syncSelf = context.rx.sync(entity: self, update: update) - let syncMedia = media?.sync(in: context).map(Optional.init) ?? Observable.just(nil) - let syncLocation = location?.sync(in: context).map(Optional.init) ?? Observable.just(nil) - return Observable.zip(syncSelf, syncMedia, syncLocation, resultSelector: CDPost.synced) - } - - func update(entity: CDPost) { - entity.uid = uid - entity.createDate = createDate as NSDate - entity.updateDate = updateDate as NSDate - entity.title = title - entity.content = content - } -} diff --git a/CoreDataPlatform/Entities/Convertion/DomainConvertibleType.swift b/CoreDataPlatform/Entities/Convertion/DomainConvertibleType.swift deleted file mode 100644 index c866ef76..00000000 --- a/CoreDataPlatform/Entities/Convertion/DomainConvertibleType.swift +++ /dev/null @@ -1,26 +0,0 @@ -import Foundation -import CoreData -import RxSwift -import QueryKit - -protocol DomainConvertibleType { - associatedtype DomainType - - func asDomain() -> DomainType -} - - - -protocol CoreDataRepresentable { - associatedtype CoreDataType: Persistable - - var uid: String {get} - - func update(entity: CoreDataType) -} - -extension CoreDataRepresentable { - func sync(in context: NSManagedObjectContext) -> Observable { - return context.rx.sync(entity: self, update: update) - } -} diff --git a/CoreDataPlatform/Entities/Convertion/Persistable.swift b/CoreDataPlatform/Entities/Convertion/Persistable.swift deleted file mode 100644 index f0fc135e..00000000 --- a/CoreDataPlatform/Entities/Convertion/Persistable.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Foundation -import CoreData -import RxSwift -import QueryKit - -protocol Persistable: NSFetchRequestResult, DomainConvertibleType { - static var entityName: String {get} - static func fetchRequest() -> NSFetchRequest -} - -extension Persistable { - static var primaryAttribute: Attribute { - return Attribute("uid") - } -} diff --git a/CoreDataPlatform/Extensions/NSManagedObjectContext+Ext.swift b/CoreDataPlatform/Extensions/NSManagedObjectContext+Ext.swift deleted file mode 100644 index 76ab4627..00000000 --- a/CoreDataPlatform/Extensions/NSManagedObjectContext+Ext.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation -import CoreData - -extension NSManagedObjectContext { - func create() -> T { - guard let entity = NSEntityDescription.insertNewObject(forEntityName: String(describing: T.self), - into: self) as? T else { - fatalError() - } - return entity - } -} diff --git a/CoreDataPlatform/Extensions/Observable+Ext.swift b/CoreDataPlatform/Extensions/Observable+Ext.swift deleted file mode 100644 index 0c67daeb..00000000 --- a/CoreDataPlatform/Extensions/Observable+Ext.swift +++ /dev/null @@ -1,28 +0,0 @@ -import Foundation -import RxSwift - -extension ObservableType { - func mapToVoid() -> Observable { - return map { _ in } - } -} - - -extension Observable where Element: Sequence, Element.Iterator.Element: DomainConvertibleType { - typealias DomainType = Element.Iterator.Element.DomainType - - func mapToDomain() -> Observable<[DomainType]> { - return map { sequence -> [DomainType] in - return sequence.mapToDomain() - } - } -} - -extension Sequence where Iterator.Element: DomainConvertibleType { - typealias Element = Iterator.Element - func mapToDomain() -> [Element.DomainType] { - return map { - return $0.asDomain() - } - } -} diff --git a/CoreDataPlatform/Info.plist b/CoreDataPlatform/Info.plist deleted file mode 100644 index fbe1e6b3..00000000 --- a/CoreDataPlatform/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/CoreDataPlatform/Model.xcdatamodeld/Model.xcdatamodel/contents b/CoreDataPlatform/Model.xcdatamodeld/Model.xcdatamodel/contents deleted file mode 100644 index 089d6267..00000000 --- a/CoreDataPlatform/Model.xcdatamodeld/Model.xcdatamodel/contents +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CoreDataPlatform/Repository/Repository.swift b/CoreDataPlatform/Repository/Repository.swift deleted file mode 100644 index 64290fa7..00000000 --- a/CoreDataPlatform/Repository/Repository.swift +++ /dev/null @@ -1,45 +0,0 @@ -import Foundation -import CoreData -import RxSwift - -func abstractMethod() -> Never { - fatalError("abstract method") -} - -class AbstractRepository { - func query(with predicate: NSPredicate? = nil, - sortDescriptors: [NSSortDescriptor]? = nil) -> Observable<[T]> { - abstractMethod() - } - func save(entity: T) -> Observable { - abstractMethod() - } -} - -final class Repository: AbstractRepository where T == T.CoreDataType.DomainType { - private let context: NSManagedObjectContext - private let scheduler: ContextScheduler - - init(context: NSManagedObjectContext) { - self.context = context - self.scheduler = ContextScheduler(context: context) - } - - override func query(with predicate: NSPredicate? = nil, - sortDescriptors: [NSSortDescriptor]? = nil) -> Observable<[T]> { - let request = T.CoreDataType.fetchRequest() - request.predicate = predicate - request.sortDescriptors = sortDescriptors - return context.rx.entities(fetchRequest: request) - .mapToDomain() - .subscribeOn(scheduler) - } - - override func save(entity: T) -> Observable { - return entity.sync(in: context) - .mapToVoid() - .concat(context.rx.save()) - .skip(1) //We dont want to receive event for sync - .subscribeOn(scheduler) - } -} diff --git a/CoreDataPlatform/RxCoreData/ContextScheduler.swift b/CoreDataPlatform/RxCoreData/ContextScheduler.swift deleted file mode 100644 index 5113dc86..00000000 --- a/CoreDataPlatform/RxCoreData/ContextScheduler.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation -import CoreData -import RxSwift - -final class ContextScheduler: ImmediateSchedulerType { - private let context: NSManagedObjectContext - - init(context: NSManagedObjectContext) { - self.context = context - } - - func schedule(_ state: StateType, action: @escaping (StateType) -> Disposable) -> Disposable { - - let disposable = SingleAssignmentDisposable() - - context.perform { - if disposable.isDisposed { - return - } - disposable.setDisposable(action(state)) - } - - return disposable - } -} diff --git a/CoreDataPlatform/RxCoreData/FetchedResultsControllerEntityObserver.swift b/CoreDataPlatform/RxCoreData/FetchedResultsControllerEntityObserver.swift deleted file mode 100644 index 2106c6c4..00000000 --- a/CoreDataPlatform/RxCoreData/FetchedResultsControllerEntityObserver.swift +++ /dev/null @@ -1,55 +0,0 @@ -import Foundation -import CoreData -import RxSwift - -final class FetchedResultsControllerEntityObserver : NSObject, NSFetchedResultsControllerDelegate { - - typealias Observer = AnyObserver<[T]> - - fileprivate let observer: Observer - fileprivate let disposeBag = DisposeBag() - fileprivate let frc: NSFetchedResultsController - - - init(observer: Observer, fetchRequest: NSFetchRequest, managedObjectContext context: NSManagedObjectContext, sectionNameKeyPath: String?, cacheName: String?) { - self.observer = observer - - - self.frc = NSFetchedResultsController(fetchRequest: fetchRequest, - managedObjectContext: context, - sectionNameKeyPath: sectionNameKeyPath, - cacheName: cacheName) - super.init() - - context.perform { - self.frc.delegate = self - - do { - try self.frc.performFetch() - } catch let e { - observer.on(.error(e)) - } - - self.sendNextElement() - } - } - - fileprivate func sendNextElement() { - self.frc.managedObjectContext.perform { - let entities = self.frc.fetchedObjects ?? [] - self.observer.on(.next(entities)) - } - } - - public func controllerDidChangeContent(_ controller: NSFetchedResultsController) { - sendNextElement() - } -} - -extension FetchedResultsControllerEntityObserver : Disposable { - - public func dispose() { - frc.delegate = nil - } - -} diff --git a/CoreDataPlatform/RxCoreData/NSManagedObjectContext+Rx.swift b/CoreDataPlatform/RxCoreData/NSManagedObjectContext+Rx.swift deleted file mode 100644 index 001000ae..00000000 --- a/CoreDataPlatform/RxCoreData/NSManagedObjectContext+Rx.swift +++ /dev/null @@ -1,65 +0,0 @@ -import Foundation -import CoreData -import RxSwift -import QueryKit - -extension Reactive where Base: NSManagedObjectContext { - - /** - Executes a fetch request and returns the fetched objects as an `Observable` array of `NSManagedObjects`. - - parameter fetchRequest: an instance of `NSFetchRequest` to describe the search criteria used to retrieve data from a persistent store - - parameter sectionNameKeyPath: the key path on the fetched objects used to determine the section they belong to; defaults to `nil` - - parameter cacheName: the name of the file used to cache section information; defaults to `nil` - - returns: An `Observable` array of `NSManagedObjects` objects that can be bound to a table view. - */ - func entities(fetchRequest: NSFetchRequest, - sectionNameKeyPath: String? = nil, - cacheName: String? = nil) -> Observable<[T]> { - return Observable.create { observer in - - let observerAdapter = FetchedResultsControllerEntityObserver(observer: observer, fetchRequest: fetchRequest, managedObjectContext: self.base, sectionNameKeyPath: sectionNameKeyPath, cacheName: cacheName) - - return Disposables.create { - observerAdapter.dispose() - } - } - } - - func save() -> Observable { - return Observable.create { observer in - do { - try self.base.save() - observer.onNext() - } catch { - observer.onError(error) - } - return Disposables.create() - } - } - - func first(ofType: T.Type = T.self, with predicate: NSPredicate) -> Observable { - return Observable.deferred { - let entityName = String(describing: T.self) - let request = NSFetchRequest(entityName: entityName) - request.predicate = predicate - do { - let result = try self.base.fetch(request).first - return Observable.just(result) - } catch { - return Observable.error(error) - } - } - } - - func sync(entity: C, - update: @escaping (P) -> Void) -> Observable

where C.CoreDataType == P { - let predicate: NSPredicate = P.primaryAttribute == entity.uid - return first(ofType: P.self, with: predicate) - .flatMap { obj -> Observable

in - let object = obj ?? self.base.create() - update(object) - return Observable.just(object) - } - } -} - diff --git a/CoreDataPlatform/UseCases/AllPostsUseCase.swift b/CoreDataPlatform/UseCases/AllPostsUseCase.swift deleted file mode 100644 index ce0a98e8..00000000 --- a/CoreDataPlatform/UseCases/AllPostsUseCase.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Foundation -import Domain -import RxSwift - -final class CDAllPostsUseCase: AllPostsUseCase { - private let repository: AbstractRepository - - init(repository: AbstractRepository) { - self.repository = repository - } - - func posts() -> Observable<[Post]> { - return repository.query(sortDescriptors: [Post.CoreDataType.createDate.descending()]) - } -} diff --git a/CoreDataPlatform/UseCases/SavePostUseCase.swift b/CoreDataPlatform/UseCases/SavePostUseCase.swift deleted file mode 100644 index 164b9ee3..00000000 --- a/CoreDataPlatform/UseCases/SavePostUseCase.swift +++ /dev/null @@ -1,15 +0,0 @@ -import Foundation -import Domain -import RxSwift - -final class CDSavePostUseCase: SavePostUseCase { - private let repository: AbstractRepository - - init(repository: AbstractRepository) { - self.repository = repository - } - - func save(post: Post) -> Observable { - return repository.save(entity: post) - } -} diff --git a/CoreDataPlatform/UseCases/ServiceLocator.swift b/CoreDataPlatform/UseCases/ServiceLocator.swift deleted file mode 100644 index 60c718e3..00000000 --- a/CoreDataPlatform/UseCases/ServiceLocator.swift +++ /dev/null @@ -1,21 +0,0 @@ -import Foundation -import Domain - -public final class ServiceLocator: Domain.ServiceLocator { - public static let shared = ServiceLocator() - - private let coreDataStack = CoreDataStack() - private let postRepository: Repository - - private init() { - postRepository = Repository(context: coreDataStack.context) - } - - public func getAllPostsUseCase() -> AllPostsUseCase { - return CDAllPostsUseCase(repository: postRepository) - } - - public func getCreatePostUseCase() -> SavePostUseCase { - return CDSavePostUseCase(repository: postRepository) - } -} diff --git a/CoreDataPlatformTests/CoreDataPlatformTests.swift b/CoreDataPlatformTests/CoreDataPlatformTests.swift deleted file mode 100644 index 814f33e8..00000000 --- a/CoreDataPlatformTests/CoreDataPlatformTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// CoreDataPlatformTests.swift -// CoreDataPlatformTests -// -// Created by sergdort on 18/02/2017. -// Copyright © 2017 sergdort. All rights reserved. -// - -import XCTest -@testable import CoreDataPlatform - -class CoreDataPlatformTests: XCTestCase { - - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/CoreDataPlatformTests/Info.plist b/CoreDataPlatformTests/Info.plist deleted file mode 100644 index 6c6c23c4..00000000 --- a/CoreDataPlatformTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/Domain/Domain.h b/Domain/Domain.h deleted file mode 100644 index 5c82e384..00000000 --- a/Domain/Domain.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// Domain.h -// Domain -// -// Created by sergdort on 18/02/2017. -// Copyright © 2017 sergdort. All rights reserved. -// - -#import - -//! Project version number for Domain. -FOUNDATION_EXPORT double DomainVersionNumber; - -//! Project version string for Domain. -FOUNDATION_EXPORT const unsigned char DomainVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/Domain/Entries/Location.swift b/Domain/Entries/Location.swift deleted file mode 100644 index 958f832e..00000000 --- a/Domain/Entries/Location.swift +++ /dev/null @@ -1,27 +0,0 @@ -import Foundation - -public struct Location { - public let uid: String - public let latitude: Double - public let longitude: Double - public let name: String - - public init(uid: String, - latitude: Double, - longitude: Double, - name: String) { - self.uid = uid - self.latitude = latitude - self.longitude = longitude - self.name = name - } -} - -extension Location: Equatable { - public static func == (lhs: Location, rhs: Location) -> Bool { - return lhs.uid == rhs.uid && - lhs.latitude == rhs.latitude && - lhs.longitude == rhs.longitude && - lhs.name == rhs.name - } -} diff --git a/Domain/Entries/Media.swift b/Domain/Entries/Media.swift deleted file mode 100644 index fbde47a5..00000000 --- a/Domain/Entries/Media.swift +++ /dev/null @@ -1,26 +0,0 @@ -import Foundation - -public struct Media { - public let uid: String - public let type: MediaType - public let url: URL - - public init(uid: String, type: MediaType, url: URL) { - self.uid = uid - self.type = type - self.url = url - } -} - -public enum MediaType: String { - case photo = "photo" - case video = "video" -} - -extension Media: Equatable { - public static func == (lhs: Media, rhs: Media) -> Bool { - return lhs.uid == rhs.uid && - lhs.type == rhs.type && - lhs.url == rhs.url - } -} diff --git a/Domain/Entries/Post.swift b/Domain/Entries/Post.swift deleted file mode 100644 index bf53e3d1..00000000 --- a/Domain/Entries/Post.swift +++ /dev/null @@ -1,39 +0,0 @@ -import Foundation - -public struct Post { - public let uid: String - public let createDate: Date - public let updateDate: Date - public let title: String - public let content: String - public let media: Media? - public let location: Location? - - public init(uid: String, - createDate: Date, - updateDate: Date, - title: String, - content: String, - media: Media? = nil, - location: Location? = nil) { - self.uid = uid - self.createDate = createDate - self.updateDate = updateDate - self.title = title - self.content = content - self.media = media - self.location = location - } -} - -extension Post: Equatable { - public static func == (lhs: Post, rhs: Post) -> Bool { - return lhs.uid == rhs.uid && - lhs.createDate == rhs.createDate && - lhs.updateDate == rhs.updateDate && - lhs.title == rhs.title && - lhs.content == rhs.content && - lhs.media == rhs.media && - lhs.location == rhs.location - } -} diff --git a/Domain/Info.plist b/Domain/Info.plist deleted file mode 100644 index fbe1e6b3..00000000 --- a/Domain/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Domain/ServiceLocator.swift b/Domain/ServiceLocator.swift deleted file mode 100644 index ff4062db..00000000 --- a/Domain/ServiceLocator.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// ServiceLocator.swift -// CleanArchitectureRxSwift -// -// Created by sergdort on 18/02/2017. -// Copyright © 2017 sergdort. All rights reserved. -// - -import Foundation - -public protocol ServiceLocator { - - func getAllPostsUseCase() -> AllPostsUseCase - - func getCreatePostUseCase() -> SavePostUseCase -} diff --git a/Domain/UseCases/AllPostsUseCase.swift b/Domain/UseCases/AllPostsUseCase.swift deleted file mode 100644 index 91d81239..00000000 --- a/Domain/UseCases/AllPostsUseCase.swift +++ /dev/null @@ -1,6 +0,0 @@ -import Foundation -import RxSwift - -public protocol AllPostsUseCase { - func posts() -> Observable<[Post]> -} diff --git a/Domain/UseCases/SavePostUseCase.swift b/Domain/UseCases/SavePostUseCase.swift deleted file mode 100644 index bd626a6a..00000000 --- a/Domain/UseCases/SavePostUseCase.swift +++ /dev/null @@ -1,6 +0,0 @@ -import Foundation -import RxSwift - -public protocol SavePostUseCase { - func save(post: Post) -> Observable -} diff --git a/DomainTests/DomainTests.swift b/DomainTests/DomainTests.swift deleted file mode 100644 index 96ac37e7..00000000 --- a/DomainTests/DomainTests.swift +++ /dev/null @@ -1,36 +0,0 @@ -// -// DomainTests.swift -// DomainTests -// -// Created by sergdort on 18/02/2017. -// Copyright © 2017 sergdort. All rights reserved. -// - -import XCTest -@testable import Domain - -class DomainTests: XCTestCase { - - override func setUp() { - super.setUp() - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - - func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testPerformanceExample() { - // This is an example of a performance test case. - self.measure { - // Put the code you want to measure the time of here. - } - } - -} diff --git a/DomainTests/Info.plist b/DomainTests/Info.plist deleted file mode 100644 index 6c6c23c4..00000000 --- a/DomainTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/Podfile b/Podfile deleted file mode 100644 index 2a7b1501..00000000 --- a/Podfile +++ /dev/null @@ -1,70 +0,0 @@ -# Uncomment the next line to define a global platform for your project -# platform :ios, '9.0' - -def rx_swift - pod 'RxSwift', '~> 3.0' -end - -def rx_cocoa - pod 'RxCocoa', '~> 3.0' -end - -def test_pods - pod 'RxTest', '~> 3.0' - pod 'RxBlocking', '~> 3.0' - pod 'Nimble' -end - - -target 'CleanArchitectureRxSwift' do - # Comment the next line if you're not using Swift and don't want to use dynamic frameworks - use_frameworks! - rx_cocoa - rx_swift - pod 'QueryKit' - target 'CleanArchitectureRxSwiftTests' do - inherit! :search_paths - test_pods - end - -end - -target 'CoreDataPlatform' do - # Comment the next line if you're not using Swift and don't want to use dynamic frameworks - use_frameworks! - rx_swift - pod 'QueryKit' - target 'CoreDataPlatformTests' do - inherit! :search_paths - test_pods - end - -end - -target 'Domain' do - # Comment the next line if you're not using Swift and don't want to use dynamic frameworks - use_frameworks! - rx_swift - - target 'DomainTests' do - inherit! :search_paths - test_pods - end - -end - -target 'RealmPlatform' do - # Comment the next line if you're not using Swift and don't want to use dynamic frameworks - use_frameworks! - rx_swift - pod 'RxRealm' - pod 'QueryKit' - pod 'RealmSwift' - pod 'Realm' - - target 'RealmPlatformTests' do - inherit! :search_paths - test_pods - end - -end diff --git a/Podfile.lock b/Podfile.lock deleted file mode 100644 index c3dcb104..00000000 --- a/Podfile.lock +++ /dev/null @@ -1,44 +0,0 @@ -PODS: - - Nimble (6.0.1) - - QueryKit (0.13.0) - - Realm (2.4.2): - - Realm/Headers (= 2.4.2) - - Realm/Headers (2.4.2) - - RealmSwift (2.4.2): - - Realm (= 2.4.2) - - RxBlocking (3.2.0): - - RxSwift (~> 3.1) - - RxCocoa (3.2.0): - - RxSwift (~> 3.1) - - RxRealm (0.5.1): - - RealmSwift (~> 2.2) - - RxSwift (~> 3.1) - - RxSwift (3.2.0) - - RxTest (3.2.0): - - RxSwift (~> 3.0) - -DEPENDENCIES: - - Nimble - - QueryKit - - Realm - - RealmSwift - - RxBlocking (~> 3.0) - - RxCocoa (~> 3.0) - - RxRealm - - RxSwift (~> 3.0) - - RxTest (~> 3.0) - -SPEC CHECKSUMS: - Nimble: 1527fd1bd2b4cf0636251a36bc8ab37e81da8347 - QueryKit: 406c42b9b4eb5f8dab380a9e5bd9ef656542d1f4 - Realm: d27b758e12d62a3371879a065d4c40aa212c5a54 - RealmSwift: 9556c0fe0f0cfecacfb755ae9e68ff379fc6bead - RxBlocking: ec8ed471ba77b4fb98a2d60f1f8419b0b46eaa23 - RxCocoa: ccdf43101a70407097a29082f648ba1676075b30 - RxRealm: c80d17d42fc362f4d8af4ac62de360b014be5c3f - RxSwift: 46574f70d416b7923c237195939cc488a7fbf3a0 - RxTest: 85fdd6f753e8e62635a58d37bbdd3ce7d5abbef3 - -PODFILE CHECKSUM: 44b58a7705c97e5d8788cf48eeb29b9dd4bcb205 - -COCOAPODS: 1.2.0 diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock deleted file mode 100644 index c3dcb104..00000000 --- a/Pods/Manifest.lock +++ /dev/null @@ -1,44 +0,0 @@ -PODS: - - Nimble (6.0.1) - - QueryKit (0.13.0) - - Realm (2.4.2): - - Realm/Headers (= 2.4.2) - - Realm/Headers (2.4.2) - - RealmSwift (2.4.2): - - Realm (= 2.4.2) - - RxBlocking (3.2.0): - - RxSwift (~> 3.1) - - RxCocoa (3.2.0): - - RxSwift (~> 3.1) - - RxRealm (0.5.1): - - RealmSwift (~> 2.2) - - RxSwift (~> 3.1) - - RxSwift (3.2.0) - - RxTest (3.2.0): - - RxSwift (~> 3.0) - -DEPENDENCIES: - - Nimble - - QueryKit - - Realm - - RealmSwift - - RxBlocking (~> 3.0) - - RxCocoa (~> 3.0) - - RxRealm - - RxSwift (~> 3.0) - - RxTest (~> 3.0) - -SPEC CHECKSUMS: - Nimble: 1527fd1bd2b4cf0636251a36bc8ab37e81da8347 - QueryKit: 406c42b9b4eb5f8dab380a9e5bd9ef656542d1f4 - Realm: d27b758e12d62a3371879a065d4c40aa212c5a54 - RealmSwift: 9556c0fe0f0cfecacfb755ae9e68ff379fc6bead - RxBlocking: ec8ed471ba77b4fb98a2d60f1f8419b0b46eaa23 - RxCocoa: ccdf43101a70407097a29082f648ba1676075b30 - RxRealm: c80d17d42fc362f4d8af4ac62de360b014be5c3f - RxSwift: 46574f70d416b7923c237195939cc488a7fbf3a0 - RxTest: 85fdd6f753e8e62635a58d37bbdd3ce7d5abbef3 - -PODFILE CHECKSUM: 44b58a7705c97e5d8788cf48eeb29b9dd4bcb205 - -COCOAPODS: 1.2.0 diff --git a/Pods/Nimble/LICENSE b/Pods/Nimble/LICENSE deleted file mode 100644 index 82b84bf1..00000000 --- a/Pods/Nimble/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2016 Quick Team - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/Pods/Nimble/README.md b/Pods/Nimble/README.md deleted file mode 100644 index ecf9501e..00000000 --- a/Pods/Nimble/README.md +++ /dev/null @@ -1,1443 +0,0 @@ -# Nimble - -Use Nimble to express the expected outcomes of Swift -or Objective-C expressions. Inspired by -[Cedar](https://github.com/pivotal/cedar). - -```swift -// Swift -expect(1 + 1).to(equal(2)) -expect(1.2).to(beCloseTo(1.1, within: 0.1)) -expect(3) > 2 -expect("seahorse").to(contain("sea")) -expect(["Atlantic", "Pacific"]).toNot(contain("Mississippi")) -expect(ocean.isClean).toEventually(beTruthy()) -``` - -# How to Use Nimble - - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Some Background: Expressing Outcomes Using Assertions in XCTest](#some-background-expressing-outcomes-using-assertions-in-xctest) -- [Nimble: Expectations Using `expect(...).to`](#nimble-expectations-using-expectto) - - [Custom Failure Messages](#custom-failure-messages) - - [Type Safety](#type-safety) - - [Operator Overloads](#operator-overloads) - - [Lazily Computed Values](#lazily-computed-values) - - [C Primitives](#c-primitives) - - [Asynchronous Expectations](#asynchronous-expectations) - - [Objective-C Support](#objective-c-support) - - [Disabling Objective-C Shorthand](#disabling-objective-c-shorthand) -- [Built-in Matcher Functions](#built-in-matcher-functions) - - [Type Checking](#type-checking) - - [Equivalence](#equivalence) - - [Identity](#identity) - - [Comparisons](#comparisons) - - [Types/Classes](#typesclasses) - - [Truthiness](#truthiness) - - [Swift Assertions](#swift-assertions) - - [Swift Error Handling](#swift-error-handling) - - [Exceptions](#exceptions) - - [Collection Membership](#collection-membership) - - [Strings](#strings) - - [Checking if all elements of a collection pass a condition](#checking-if-all-elements-of-a-collection-pass-a-condition) - - [Verify collection count](#verify-collection-count) - - [Verify a notification was posted](#verifying-a-notification-was-posted) - - [Matching a value to any of a group of matchers](#matching-a-value-to-any-of-a-group-of-matchers) -- [Writing Your Own Matchers](#writing-your-own-matchers) - - [Lazy Evaluation](#lazy-evaluation) - - [Type Checking via Swift Generics](#type-checking-via-swift-generics) - - [Customizing Failure Messages](#customizing-failure-messages) - - [Supporting Objective-C](#supporting-objective-c) - - [Properly Handling `nil` in Objective-C Matchers](#properly-handling-nil-in-objective-c-matchers) -- [Installing Nimble](#installing-nimble) - - [Installing Nimble as a Submodule](#installing-nimble-as-a-submodule) - - [Installing Nimble via CocoaPods](#installing-nimble-via-cocoapods) - - [Using Nimble without XCTest](#using-nimble-without-xctest) - - - -# Some Background: Expressing Outcomes Using Assertions in XCTest - -Apple's Xcode includes the XCTest framework, which provides -assertion macros to test whether code behaves properly. -For example, to assert that `1 + 1 = 2`, XCTest has you write: - -```swift -// Swift - -XCTAssertEqual(1 + 1, 2, "expected one plus one to equal two") -``` - -Or, in Objective-C: - -```objc -// Objective-C - -XCTAssertEqual(1 + 1, 2, @"expected one plus one to equal two"); -``` - -XCTest assertions have a couple of drawbacks: - -1. **Not enough macros.** There's no easy way to assert that a string - contains a particular substring, or that a number is less than or - equal to another. -2. **It's hard to write asynchronous tests.** XCTest forces you to write - a lot of boilerplate code. - -Nimble addresses these concerns. - -# Nimble: Expectations Using `expect(...).to` - -Nimble allows you to express expectations using a natural, -easily understood language: - -```swift -// Swift - -import Nimble - -expect(seagull.squawk).to(equal("Squee!")) -``` - -```objc -// Objective-C - -@import Nimble; - -expect(seagull.squawk).to(equal(@"Squee!")); -``` - -> The `expect` function autocompletes to include `file:` and `line:`, - but these parameters are optional. Use the default values to have - Xcode highlight the correct line when an expectation is not met. - -To perform the opposite expectation--to assert something is *not* -equal--use `toNot` or `notTo`: - -```swift -// Swift - -import Nimble - -expect(seagull.squawk).toNot(equal("Oh, hello there!")) -expect(seagull.squawk).notTo(equal("Oh, hello there!")) -``` - -```objc -// Objective-C - -@import Nimble; - -expect(seagull.squawk).toNot(equal(@"Oh, hello there!")); -expect(seagull.squawk).notTo(equal(@"Oh, hello there!")); -``` - -## Custom Failure Messages - -Would you like to add more information to the test's failure messages? Use the `description` optional argument to add your own text: - -```swift -// Swift - -expect(1 + 1).to(equal(3)) -// failed - expected to equal <3>, got <2> - -expect(1 + 1).to(equal(3), description: "Make sure libKindergartenMath is loaded") -// failed - Make sure libKindergartenMath is loaded -// expected to equal <3>, got <2> -``` - -Or the *WithDescription version in Objective-C: - -```objc -// Objective-C - -@import Nimble; - -expect(@(1+1)).to(equal(@3)); -// failed - expected to equal <3.0000>, got <2.0000> - -expect(@(1+1)).toWithDescription(equal(@3), @"Make sure libKindergartenMath is loaded"); -// failed - Make sure libKindergartenMath is loaded -// expected to equal <3.0000>, got <2.0000> -``` - -## Type Safety - -Nimble makes sure you don't compare two types that don't match: - -```swift -// Swift - -// Does not compile: -expect(1 + 1).to(equal("Squee!")) -``` - -> Nimble uses generics--only available in Swift--to ensure - type correctness. That means type checking is - not available when using Nimble in Objective-C. :sob: - -## Operator Overloads - -Tired of so much typing? With Nimble, you can use overloaded operators -like `==` for equivalence, or `>` for comparisons: - -```swift -// Swift - -// Passes if squawk does not equal "Hi!": -expect(seagull.squawk) != "Hi!" - -// Passes if 10 is greater than 2: -expect(10) > 2 -``` - -> Operator overloads are only available in Swift, so you won't be able - to use this syntax in Objective-C. :broken_heart: - -## Lazily Computed Values - -The `expect` function doesn't evaluate the value it's given until it's -time to match. So Nimble can test whether an expression raises an -exception once evaluated: - -```swift -// Swift - -// Note: Swift currently doesn't have exceptions. -// Only Objective-C code can raise exceptions -// that Nimble will catch. -// (see https://github.com/Quick/Nimble/issues/220#issuecomment-172667064) -let exception = NSException( - name: NSInternalInconsistencyException, - reason: "Not enough fish in the sea.", - userInfo: ["something": "is fishy"]) -expect { exception.raise() }.to(raiseException()) - -// Also, you can customize raiseException to be more specific -expect { exception.raise() }.to(raiseException(named: NSInternalInconsistencyException)) -expect { exception.raise() }.to(raiseException( - named: NSInternalInconsistencyException, - reason: "Not enough fish in the sea")) -expect { exception.raise() }.to(raiseException( - named: NSInternalInconsistencyException, - reason: "Not enough fish in the sea", - userInfo: ["something": "is fishy"])) -``` - -Objective-C works the same way, but you must use the `expectAction` -macro when making an expectation on an expression that has no return -value: - -```objc -// Objective-C - -NSException *exception = [NSException exceptionWithName:NSInternalInconsistencyException - reason:@"Not enough fish in the sea." - userInfo:nil]; -expectAction(^{ [exception raise]; }).to(raiseException()); - -// Use the property-block syntax to be more specific. -expectAction(^{ [exception raise]; }).to(raiseException().named(NSInternalInconsistencyException)); -expectAction(^{ [exception raise]; }).to(raiseException(). - named(NSInternalInconsistencyException). - reason("Not enough fish in the sea")); -expectAction(^{ [exception raise]; }).to(raiseException(). - named(NSInternalInconsistencyException). - reason("Not enough fish in the sea"). - userInfo(@{@"something": @"is fishy"})); - -// You can also pass a block for custom matching of the raised exception -expectAction(exception.raise()).to(raiseException().satisfyingBlock(^(NSException *exception) { - expect(exception.name).to(beginWith(NSInternalInconsistencyException)); -})); -``` - -## C Primitives - -Some testing frameworks make it hard to test primitive C values. -In Nimble, it just works: - -```swift -// Swift - -let actual: CInt = 1 -let expectedValue: CInt = 1 -expect(actual).to(equal(expectedValue)) -``` - -In fact, Nimble uses type inference, so you can write the above -without explicitly specifying both types: - -```swift -// Swift - -expect(1 as CInt).to(equal(1)) -``` - -> In Objective-C, Nimble only supports Objective-C objects. To - make expectations on primitive C values, wrap then in an object - literal: - - ```objc - expect(@(1 + 1)).to(equal(@2)); - ``` - -## Asynchronous Expectations - -In Nimble, it's easy to make expectations on values that are updated -asynchronously. Just use `toEventually` or `toEventuallyNot`: - -```swift -// Swift - -dispatch_async(dispatch_get_main_queue()) { - ocean.add("dolphins") - ocean.add("whales") -} -expect(ocean).toEventually(contain("dolphins", "whales")) -``` - - -```objc -// Objective-C -dispatch_async(dispatch_get_main_queue(), ^{ - [ocean add:@"dolphins"]; - [ocean add:@"whales"]; -}); -expect(ocean).toEventually(contain(@"dolphins", @"whales")); -``` - -Note: toEventually triggers its polls on the main thread. Blocking the main -thread will cause Nimble to stop the run loop. This can cause test pollution -for whatever incomplete code that was running on the main thread. Blocking the -main thread can be caused by blocking IO, calls to sleep(), deadlocks, and -synchronous IPC. - -In the above example, `ocean` is constantly re-evaluated. If it ever -contains dolphins and whales, the expectation passes. If `ocean` still -doesn't contain them, even after being continuously re-evaluated for one -whole second, the expectation fails. - -Sometimes it takes more than a second for a value to update. In those -cases, use the `timeout` parameter: - -```swift -// Swift - -// Waits three seconds for ocean to contain "starfish": -expect(ocean).toEventually(contain("starfish"), timeout: 3) - -// Evaluate someValue every 0.2 seconds repeatedly until it equals 100, or fails if it timeouts after 5.5 seconds. -expect(someValue).toEventually(equal(100), timeout: 5.5, pollInterval: 0.2) -``` - -```objc -// Objective-C - -// Waits three seconds for ocean to contain "starfish": -expect(ocean).withTimeout(3).toEventually(contain(@"starfish")); -``` - -You can also provide a callback by using the `waitUntil` function: - -```swift -// Swift - -waitUntil { done in - // do some stuff that takes a while... - NSThread.sleepForTimeInterval(0.5) - done() -} -``` - -```objc -// Objective-C - -waitUntil(^(void (^done)(void)){ - // do some stuff that takes a while... - [NSThread sleepForTimeInterval:0.5]; - done(); -}); -``` - -`waitUntil` also optionally takes a timeout parameter: - -```swift -// Swift - -waitUntil(timeout: 10) { done in - // do some stuff that takes a while... - NSThread.sleepForTimeInterval(1) - done() -} -``` - -```objc -// Objective-C - -waitUntilTimeout(10, ^(void (^done)(void)){ - // do some stuff that takes a while... - [NSThread sleepForTimeInterval:1]; - done(); -}); -``` - -Note: waitUntil triggers its timeout code on the main thread. Blocking the main -thread will cause Nimble to stop the run loop to continue. This can cause test -pollution for whatever incomplete code that was running on the main thread. -Blocking the main thread can be caused by blocking IO, calls to sleep(), -deadlocks, and synchronous IPC. - -In some cases (e.g. when running on slower machines) it can be useful to modify -the default timeout and poll interval values. This can be done as follows: - -```swift -// Swift - -// Increase the global timeout to 5 seconds: -Nimble.AsyncDefaults.Timeout = 5 - -// Slow the polling interval to 0.1 seconds: -Nimble.AsyncDefaults.PollInterval = 0.1 -``` - -## Objective-C Support - -Nimble has full support for Objective-C. However, there are two things -to keep in mind when using Nimble in Objective-C: - -1. All parameters passed to the `expect` function, as well as matcher - functions like `equal`, must be Objective-C objects or can be converted into - an `NSObject` equivalent: - - ```objc - // Objective-C - - @import Nimble; - - expect(@(1 + 1)).to(equal(@2)); - expect(@"Hello world").to(contain(@"world")); - - // Boxed as NSNumber * - expect(2).to(equal(2)); - expect(1.2).to(beLessThan(2.0)); - expect(true).to(beTruthy()); - - // Boxed as NSString * - expect("Hello world").to(equal("Hello world")); - - // Boxed as NSRange - expect(NSMakeRange(1, 10)).to(equal(NSMakeRange(1, 10))); - ``` - -2. To make an expectation on an expression that does not return a value, - such as `-[NSException raise]`, use `expectAction` instead of - `expect`: - - ```objc - // Objective-C - - expectAction(^{ [exception raise]; }).to(raiseException()); - ``` - -The following types are currently converted to an `NSObject` type: - - - **C Numeric types** are converted to `NSNumber *` - - `NSRange` is converted to `NSValue *` - - `char *` is converted to `NSString *` - -For the following matchers: - -- `equal` -- `beGreaterThan` -- `beGreaterThanOrEqual` -- `beLessThan` -- `beLessThanOrEqual` -- `beCloseTo` -- `beTrue` -- `beFalse` -- `beTruthy` -- `beFalsy` -- `haveCount` - -If you would like to see more, [file an issue](https://github.com/Quick/Nimble/issues). - -## Disabling Objective-C Shorthand - -Nimble provides a shorthand for expressing expectations using the -`expect` function. To disable this shorthand in Objective-C, define the -`NIMBLE_DISABLE_SHORT_SYNTAX` macro somewhere in your code before -importing Nimble: - -```objc -#define NIMBLE_DISABLE_SHORT_SYNTAX 1 - -@import Nimble; - -NMB_expect(^{ return seagull.squawk; }, __FILE__, __LINE__).to(NMB_equal(@"Squee!")); -``` - -> Disabling the shorthand is useful if you're testing functions with - names that conflict with Nimble functions, such as `expect` or - `equal`. If that's not the case, there's no point in disabling the - shorthand. - -# Built-in Matcher Functions - -Nimble includes a wide variety of matcher functions. - -## Type Checking - -Nimble supports checking the type membership of any kind of object, whether -Objective-C conformant or not: - -```swift -// Swift - -protocol SomeProtocol{} -class SomeClassConformingToProtocol: SomeProtocol{} -struct SomeStructConformingToProtocol: SomeProtocol{} - -// The following tests pass -expect(1).to(beKindOf(Int.self)) -expect("turtle").to(beKindOf(String.self)) - -let classObject = SomeClassConformingToProtocol() -expect(classObject).to(beKindOf(SomeProtocol.self)) -expect(classObject).to(beKindOf(SomeClassConformingToProtocol.self)) -expect(classObject).toNot(beKindOf(SomeStructConformingToProtocol.self)) - -let structObject = SomeStructConformingToProtocol() -expect(structObject).to(beKindOf(SomeProtocol.self)) -expect(structObject).to(beKindOf(SomeStructConformingToProtocol.self)) -expect(structObject).toNot(beKindOf(SomeClassConformingToProtocol.self)) -``` - -```objc -// Objective-C - -// The following tests pass -NSMutableArray *array = [NSMutableArray array]; -expect(array).to(beAKindOf([NSArray class])); -expect(@1).toNot(beAKindOf([NSNull class])); -``` - -Objects can be tested for their exact types using the `beAnInstanceOf` matcher: -```swift -// Swift - -protocol SomeProtocol{} -class SomeClassConformingToProtocol: SomeProtocol{} -struct SomeStructConformingToProtocol: SomeProtocol{} - -// Unlike the 'beKindOf' matcher, the 'beAnInstanceOf' matcher only -// passes if the object is the EXACT type requested. The following -// tests pass -- note its behavior when working in an inheritance hierarchy. -expect(1).to(beAnInstanceOf(Int.self)) -expect("turtle").to(beAnInstanceOf(String.self)) - -let classObject = SomeClassConformingToProtocol() -expect(classObject).toNot(beAnInstanceOf(SomeProtocol.self)) -expect(classObject).to(beAnInstanceOf(SomeClassConformingToProtocol.self)) -expect(classObject).toNot(beAnInstanceOf(SomeStructConformingToProtocol.self)) - -let structObject = SomeStructConformingToProtocol() -expect(structObject).toNot(beAnInstanceOf(SomeProtocol.self)) -expect(structObject).to(beAnInstanceOf(SomeStructConformingToProtocol.self)) -expect(structObject).toNot(beAnInstanceOf(SomeClassConformingToProtocol.self)) -```` - -## Equivalence - -```swift -// Swift - -// Passes if actual is equivalent to expected: -expect(actual).to(equal(expected)) -expect(actual) == expected - -// Passes if actual is not equivalent to expected: -expect(actual).toNot(equal(expected)) -expect(actual) != expected -``` - -```objc -// Objective-C - -// Passes if actual is equivalent to expected: -expect(actual).to(equal(expected)) - -// Passes if actual is not equivalent to expected: -expect(actual).toNot(equal(expected)) -``` - -Values must be `Equatable`, `Comparable`, or subclasses of `NSObject`. -`equal` will always fail when used to compare one or more `nil` values. - -## Identity - -```swift -// Swift - -// Passes if actual has the same pointer address as expected: -expect(actual).to(beIdenticalTo(expected)) -expect(actual) === expected - -// Passes if actual does not have the same pointer address as expected: -expect(actual).toNot(beIdenticalTo(expected)) -expect(actual) !== expected -``` - -Its important to remember that `beIdenticalTo` only makes sense when comparing types with reference semantics, which have a notion of identity. In Swift, that means a `class`. This matcher will not work with types with value semantics such as `struct` or `enum`. If you need to compare two value types, you can either compare individual properties or if it makes sense to do so, make your type implement `Equatable` and use Nimble's equivalence matchers instead. - - -```objc -// Objective-C - -// Passes if actual has the same pointer address as expected: -expect(actual).to(beIdenticalTo(expected)); - -// Passes if actual does not have the same pointer address as expected: -expect(actual).toNot(beIdenticalTo(expected)); -``` - -## Comparisons - -```swift -// Swift - -expect(actual).to(beLessThan(expected)) -expect(actual) < expected - -expect(actual).to(beLessThanOrEqualTo(expected)) -expect(actual) <= expected - -expect(actual).to(beGreaterThan(expected)) -expect(actual) > expected - -expect(actual).to(beGreaterThanOrEqualTo(expected)) -expect(actual) >= expected -``` - -```objc -// Objective-C - -expect(actual).to(beLessThan(expected)); -expect(actual).to(beLessThanOrEqualTo(expected)); -expect(actual).to(beGreaterThan(expected)); -expect(actual).to(beGreaterThanOrEqualTo(expected)); -``` - -> Values given to the comparison matchers above must implement - `Comparable`. - -Because of how computers represent floating point numbers, assertions -that two floating point numbers be equal will sometimes fail. To express -that two numbers should be close to one another within a certain margin -of error, use `beCloseTo`: - -```swift -// Swift - -expect(actual).to(beCloseTo(expected, within: delta)) -``` - -```objc -// Objective-C - -expect(actual).to(beCloseTo(expected).within(delta)); -``` - -For example, to assert that `10.01` is close to `10`, you can write: - -```swift -// Swift - -expect(10.01).to(beCloseTo(10, within: 0.1)) -``` - -```objc -// Objective-C - -expect(@(10.01)).to(beCloseTo(@10).within(0.1)); -``` - -There is also an operator shortcut available in Swift: - -```swift -// Swift - -expect(actual) ≈ expected -expect(actual) ≈ (expected, delta) - -``` -(Type Option-x to get ≈ on a U.S. keyboard) - -The former version uses the default delta of 0.0001. Here is yet another way to do this: - -```swift -// Swift - -expect(actual) ≈ expected ± delta -expect(actual) == expected ± delta - -``` -(Type Option-Shift-= to get ± on a U.S. keyboard) - -If you are comparing arrays of floating point numbers, you'll find the following useful: - -```swift -// Swift - -expect([0.0, 2.0]) ≈ [0.0001, 2.0001] -expect([0.0, 2.0]).to(beCloseTo([0.1, 2.1], within: 0.1)) - -``` - -> Values given to the `beCloseTo` matcher must be coercable into a - `Double`. - -## Types/Classes - -```swift -// Swift - -// Passes if instance is an instance of aClass: -expect(instance).to(beAnInstanceOf(aClass)) - -// Passes if instance is an instance of aClass or any of its subclasses: -expect(instance).to(beAKindOf(aClass)) -``` - -```objc -// Objective-C - -// Passes if instance is an instance of aClass: -expect(instance).to(beAnInstanceOf(aClass)); - -// Passes if instance is an instance of aClass or any of its subclasses: -expect(instance).to(beAKindOf(aClass)); -``` - -> Instances must be Objective-C objects: subclasses of `NSObject`, - or Swift objects bridged to Objective-C with the `@objc` prefix. - -For example, to assert that `dolphin` is a kind of `Mammal`: - -```swift -// Swift - -expect(dolphin).to(beAKindOf(Mammal)) -``` - -```objc -// Objective-C - -expect(dolphin).to(beAKindOf([Mammal class])); -``` - -> `beAnInstanceOf` uses the `-[NSObject isMemberOfClass:]` method to - test membership. `beAKindOf` uses `-[NSObject isKindOfClass:]`. - -## Truthiness - -```swift -// Passes if actual is not nil, true, or an object with a boolean value of true: -expect(actual).to(beTruthy()) - -// Passes if actual is only true (not nil or an object conforming to Boolean true): -expect(actual).to(beTrue()) - -// Passes if actual is nil, false, or an object with a boolean value of false: -expect(actual).to(beFalsy()) - -// Passes if actual is only false (not nil or an object conforming to Boolean false): -expect(actual).to(beFalse()) - -// Passes if actual is nil: -expect(actual).to(beNil()) -``` - -```objc -// Objective-C - -// Passes if actual is not nil, true, or an object with a boolean value of true: -expect(actual).to(beTruthy()); - -// Passes if actual is only true (not nil or an object conforming to Boolean true): -expect(actual).to(beTrue()); - -// Passes if actual is nil, false, or an object with a boolean value of false: -expect(actual).to(beFalsy()); - -// Passes if actual is only false (not nil or an object conforming to Boolean false): -expect(actual).to(beFalse()); - -// Passes if actual is nil: -expect(actual).to(beNil()); -``` - -## Swift Assertions - -If you're using Swift, you can use the `throwAssertion` matcher to check if an assertion is thrown (e.g. `fatalError()`). This is made possible by [@mattgallagher](https://github.com/mattgallagher)'s [CwlPreconditionTesting](https://github.com/mattgallagher/CwlPreconditionTesting) library. - -```swift -// Swift - -// Passes if somethingThatThrows() throws an assertion, such as calling fatalError() or precondition fails: -expect { () -> Void in fatalError() }.to(throwAssertion()) -expect { precondition(false) }.to(throwAssertion()) - -// Passes if throwing a NSError is not equal to throwing an assertion: -expect { throw NSError(domain: "test", code: 0, userInfo: nil) }.toNot(throwAssertion()) - -// Passes if the post assertion code is not run: -var reachedPoint1 = false -var reachedPoint2 = false -expect { - reachedPoint1 = true - precondition(false, "condition message") - reachedPoint2 = true -}.to(throwAssertion()) - -expect(reachedPoint1) == true -expect(reachedPoint2) == false -``` - -Notes: - -* This feature is only available in Swift. -* It is only supported for `x86_64` binaries, meaning _you cannot run this matcher on iOS devices, only simulators_. -* The tvOS simulator is supported, but using a different mechanism, requiring you to turn off the `Debug executable` scheme setting for your tvOS scheme's Test configuration. - -## Swift Error Handling - -If you're using Swift 2.0+, you can use the `throwError` matcher to check if an error is thrown. - -```swift -// Swift - -// Passes if somethingThatThrows() throws an ErrorProtocol: -expect{ try somethingThatThrows() }.to(throwError()) - -// Passes if somethingThatThrows() throws an error with a given domain: -expect{ try somethingThatThrows() }.to(throwError { (error: ErrorProtocol) in - expect(error._domain).to(equal(NSCocoaErrorDomain)) -}) - -// Passes if somethingThatThrows() throws an error with a given case: -expect{ try somethingThatThrows() }.to(throwError(NSCocoaError.PropertyListReadCorruptError)) - -// Passes if somethingThatThrows() throws an error with a given type: -expect{ try somethingThatThrows() }.to(throwError(errorType: NimbleError.self)) -``` - -If you are working directly with `ErrorProtocol` values, as is sometimes the case when using `Result` or `Promise` types, you can use the `matchError` matcher to check if the error is the same error is is supposed to be, without requiring explicit casting. - -```swift -// Swift - -let actual: ErrorProtocol = 
 - -// Passes if actual contains any error value from the NimbleErrorEnum type: -expect(actual).to(matchError(NimbleErrorEnum)) - -// Passes if actual contains the Timeout value from the NimbleErrorEnum type: -expect(actual).to(matchError(NimbleErrorEnum.Timeout)) - -// Passes if actual contains an NSError equal to the given one: -expect(actual).to(matchError(NSError(domain: "err", code: 123, userInfo: nil))) -``` - -Note: This feature is only available in Swift. - -## Exceptions - -```swift -// Swift - -// Passes if actual, when evaluated, raises an exception: -expect(actual).to(raiseException()) - -// Passes if actual raises an exception with the given name: -expect(actual).to(raiseException(named: name)) - -// Passes if actual raises an exception with the given name and reason: -expect(actual).to(raiseException(named: name, reason: reason)) - -// Passes if actual raises an exception and it passes expectations in the block -// (in this case, if name begins with 'a r') -expect { exception.raise() }.to(raiseException { (exception: NSException) in - expect(exception.name).to(beginWith("a r")) -}) -``` - -```objc -// Objective-C - -// Passes if actual, when evaluated, raises an exception: -expect(actual).to(raiseException()) - -// Passes if actual raises an exception with the given name -expect(actual).to(raiseException().named(name)) - -// Passes if actual raises an exception with the given name and reason: -expect(actual).to(raiseException().named(name).reason(reason)) - -// Passes if actual raises an exception and it passes expectations in the block -// (in this case, if name begins with 'a r') -expect(actual).to(raiseException().satisfyingBlock(^(NSException *exception) { - expect(exception.name).to(beginWith(@"a r")); -})); -``` - -Note: Swift currently doesn't have exceptions (see [#220](https://github.com/Quick/Nimble/issues/220#issuecomment-172667064)). Only Objective-C code can raise -exceptions that Nimble will catch. - -## Collection Membership - -```swift -// Swift - -// Passes if all of the expected values are members of actual: -expect(actual).to(contain(expected...)) - -// Passes if actual is an empty collection (it contains no elements): -expect(actual).to(beEmpty()) -``` - -```objc -// Objective-C - -// Passes if expected is a member of actual: -expect(actual).to(contain(expected)); - -// Passes if actual is an empty collection (it contains no elements): -expect(actual).to(beEmpty()); -``` - -> In Swift `contain` takes any number of arguments. The expectation - passes if all of them are members of the collection. In Objective-C, - `contain` only takes one argument [for now](https://github.com/Quick/Nimble/issues/27). - -For example, to assert that a list of sea creature names contains -"dolphin" and "starfish": - -```swift -// Swift - -expect(["whale", "dolphin", "starfish"]).to(contain("dolphin", "starfish")) -``` - -```objc -// Objective-C - -expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"dolphin")); -expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"starfish")); -``` - -> `contain` and `beEmpty` expect collections to be instances of - `NSArray`, `NSSet`, or a Swift collection composed of `Equatable` elements. - -To test whether a set of elements is present at the beginning or end of -an ordered collection, use `beginWith` and `endWith`: - -```swift -// Swift - -// Passes if the elements in expected appear at the beginning of actual: -expect(actual).to(beginWith(expected...)) - -// Passes if the the elements in expected come at the end of actual: -expect(actual).to(endWith(expected...)) -``` - -```objc -// Objective-C - -// Passes if the elements in expected appear at the beginning of actual: -expect(actual).to(beginWith(expected)); - -// Passes if the the elements in expected come at the end of actual: -expect(actual).to(endWith(expected)); -``` - -> `beginWith` and `endWith` expect collections to be instances of - `NSArray`, or ordered Swift collections composed of `Equatable` - elements. - - Like `contain`, in Objective-C `beginWith` and `endWith` only support - a single argument [for now](https://github.com/Quick/Nimble/issues/27). - -For code that returns collections of complex objects without a strict -ordering, there is the `containElementSatisfying` matcher: - -```swift -struct Turtle { - var color: String! -} - -var turtles = functionThatReturnsSomeTurtlesInAnyOrder() - -// This set of matchers passes whether the array is [{color: "blue"}, {color: "green"}] -// or [{color: "green"}, {color: "blue"}] -expect(turtles).to(containElementSatisfying({ turtle in - return turtle.color == "green" -})) -expect(turtles).to(containElementSatisfying({ turtle in - return turtle.color == "blue" -}, "that is a turtle with color 'blue'")) - -// The second matcher will incorporate the provided string in the error message -// should it fail -``` - -```objc -@interface Turtle: NSObject -@property(nonatomic) NSString *color; -@end -@implementation Turtle @end - -NSArray *turtles = functionThatReturnsSomeTurtlesInAnyOrder(); - -// This set of matchers passes whether the array is [{color: "blue"}, {color: "green"}] -// or [{color: "green"}, {color: "blue"}] -expect(turtles).to(containElementSatisfying(^BOOL(id object) { - return [turtle.color isEqualToString:@"green"]; -})); -expect(turtles).to(containElementSatisfying(^BOOL(id object) { - return [turtle.color isEqualToString:@"blue"]; -})); -``` - -## Strings - -```swift -// Swift - -// Passes if actual contains substring expected: -expect(actual).to(contain(expected)) - -// Passes if actual begins with substring: -expect(actual).to(beginWith(expected)) - -// Passes if actual ends with substring: -expect(actual).to(endWith(expected)) - -// Passes if actual is an empty string, "": -expect(actual).to(beEmpty()) - -// Passes if actual matches the regular expression defined in expected: -expect(actual).to(match(expected)) -``` - -```objc -// Objective-C - -// Passes if actual contains substring expected: -expect(actual).to(contain(expected)); - -// Passes if actual begins with substring: -expect(actual).to(beginWith(expected)); - -// Passes if actual ends with substring: -expect(actual).to(endWith(expected)); - -// Passes if actual is an empty string, "": -expect(actual).to(beEmpty()); - -// Passes if actual matches the regular expression defined in expected: -expect(actual).to(match(expected)) -``` - -## Checking if all elements of a collection pass a condition - -```swift -// Swift - -// with a custom function: -expect([1,2,3,4]).to(allPass({$0 < 5})) - -// with another matcher: -expect([1,2,3,4]).to(allPass(beLessThan(5))) -``` - -```objc -// Objective-C - -expect(@[@1, @2, @3,@4]).to(allPass(beLessThan(@5))); -``` - -For Swift the actual value has to be a Sequence, e.g. an array, a set or a custom seqence type. - -For Objective-C the actual value has to be a NSFastEnumeration, e.g. NSArray and NSSet, of NSObjects and only the variant which -uses another matcher is available here. - -## Verify collection count - -```swift -// Swift - -// passes if actual collection's count is equal to expected -expect(actual).to(haveCount(expected)) - -// passes if actual collection's count is not equal to expected -expect(actual).notTo(haveCount(expected)) -``` - -```objc -// Objective-C - -// passes if actual collection's count is equal to expected -expect(actual).to(haveCount(expected)) - -// passes if actual collection's count is not equal to expected -expect(actual).notTo(haveCount(expected)) -``` - -For Swift the actual value must be a `Collection` such as array, dictionary or set. - -For Objective-C the actual value has to be one of the following classes `NSArray`, `NSDictionary`, `NSSet`, `NSHashTable` or one of their subclasses. - -## Foundation - -### Verifying a Notification was posted - -```swift -// Swift -let testNotification = Notification(name: "Foo", object: nil) - -// passes if the closure in expect { ... } posts a notification to the default -// notification center. -expect { - NotificationCenter.default.postNotification(testNotification) -}.to(postNotifications(equal([testNotification])) - -// passes if the closure in expect { ... } posts a notification to a given -// notification center -let notificationCenter = NotificationCenter() -expect { - notificationCenter.postNotification(testNotification) -}.to(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) -``` - -> This matcher is only available in Swift. - -## Matching a value to any of a group of matchers - -```swift -// passes if actual is either less than 10 or greater than 20 -expect(actual).to(satisfyAnyOf(beLessThan(10), beGreaterThan(20))) - -// can include any number of matchers -- the following will pass -// **be careful** -- too many matchers can be the sign of an unfocused test -expect(6).to(satisfyAnyOf(equal(2), equal(3), equal(4), equal(5), equal(6), equal(7))) - -// in Swift you also have the option to use the || operator to achieve a similar function -expect(82).to(beLessThan(50) || beGreaterThan(80)) -``` - -```objc -// passes if actual is either less than 10 or greater than 20 -expect(actual).to(satisfyAnyOf(beLessThan(@10), beGreaterThan(@20))) - -// can include any number of matchers -- the following will pass -// **be careful** -- too many matchers can be the sign of an unfocused test -expect(@6).to(satisfyAnyOf(equal(@2), equal(@3), equal(@4), equal(@5), equal(@6), equal(@7))) -``` - -Note: This matcher allows you to chain any number of matchers together. This provides flexibility, - but if you find yourself chaining many matchers together in one test, consider whether you - could instead refactor that single test into multiple, more precisely focused tests for - better coverage. - -# Writing Your Own Matchers - -In Nimble, matchers are Swift functions that take an expected -value and return a `MatcherFunc` closure. Take `equal`, for example: - -```swift -// Swift - -public func equal(expectedValue: T?) -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(expectedValue)>" - if let actualValue = try actualExpression.evaluate() { - return actualValue == expectedValue - } else { - return false - } - } -} -``` - -The return value of a `MatcherFunc` closure is a `Bool` that indicates -whether the actual value matches the expectation: `true` if it does, or -`false` if it doesn't. - -> The actual `equal` matcher function does not match when either - `actual` or `expected` are nil; the example above has been edited for - brevity. - -Since matchers are just Swift functions, you can define them anywhere: -at the top of your test file, in a file shared by all of your tests, or -in an Xcode project you distribute to others. - -> If you write a matcher you think everyone can use, consider adding it - to Nimble's built-in set of matchers by sending a pull request! Or - distribute it yourself via GitHub. - -For examples of how to write your own matchers, just check out the -[`Matchers` directory](https://github.com/Quick/Nimble/tree/master/Sources/Nimble/Matchers) -to see how Nimble's built-in set of matchers are implemented. You can -also check out the tips below. - -## Lazy Evaluation - -`actualExpression` is a lazy, memoized closure around the value provided to the -`expect` function. The expression can either be a closure or a value directly -passed to `expect(...)`. In order to determine whether that value matches, -custom matchers should call `actualExpression.evaluate()`: - -```swift -// Swift - -public func beNil() -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be nil" - return actualExpression.evaluate() == nil - } -} -``` - -In the above example, `actualExpression` is not `nil`--it is a closure -that returns a value. The value it returns, which is accessed via the -`evaluate()` method, may be `nil`. If that value is `nil`, the `beNil` -matcher function returns `true`, indicating that the expectation passed. - -Use `expression.isClosure` to determine if the expression will be invoking -a closure to produce its value. - -## Type Checking via Swift Generics - -Using Swift's generics, matchers can constrain the type of the actual value -passed to the `expect` function by modifying the return type. - -For example, the following matcher, `haveDescription`, only accepts actual -values that implement the `Printable` protocol. It checks their `description` -against the one provided to the matcher function, and passes if they are the same: - -```swift -// Swift - -public func haveDescription(description: String) -> MatcherFunc { - return MatcherFunc { actual, failureMessage in - return actual.evaluate().description == description - } -} -``` - -## Customizing Failure Messages - -By default, Nimble outputs the following failure message when an -expectation fails: - -``` -expected to match, got <\(actual)> -``` - -You can customize this message by modifying the `failureMessage` struct -from within your `MatcherFunc` closure. To change the verb "match" to -something else, update the `postfixMessage` property: - -```swift -// Swift - -// Outputs: expected to be under the sea, got <\(actual)> -failureMessage.postfixMessage = "be under the sea" -``` - -You can change how the `actual` value is displayed by updating -`failureMessage.actualValue`. Or, to remove it altogether, set it to -`nil`: - -```swift -// Swift - -// Outputs: expected to be under the sea -failureMessage.actualValue = nil -failureMessage.postfixMessage = "be under the sea" -``` - -## Supporting Objective-C - -To use a custom matcher written in Swift from Objective-C, you'll have -to extend the `NMBObjCMatcher` class, adding a new class method for your -custom matcher. The example below defines the class method -`+[NMBObjCMatcher beNilMatcher]`: - -```swift -// Swift - -extension NMBObjCMatcher { - public class func beNilMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualBlock, failureMessage, location in - let block = ({ actualBlock() as NSObject? }) - let expr = Expression(expression: block, location: location) - return beNil().matches(expr, failureMessage: failureMessage) - } - } -} -``` - -The above allows you to use the matcher from Objective-C: - -```objc -// Objective-C - -expect(actual).to([NMBObjCMatcher beNilMatcher]()); -``` - -To make the syntax easier to use, define a C function that calls the -class method: - -```objc -// Objective-C - -FOUNDATION_EXPORT id beNil() { - return [NMBObjCMatcher beNilMatcher]; -} -``` - -### Properly Handling `nil` in Objective-C Matchers - -When supporting Objective-C, make sure you handle `nil` appropriately. -Like [Cedar](https://github.com/pivotal/cedar/issues/100), -**most matchers do not match with nil**. This is to bring prevent test -writers from being surprised by `nil` values where they did not expect -them. - -Nimble provides the `beNil` matcher function for test writer that want -to make expectations on `nil` objects: - -```objc -// Objective-C - -expect(nil).to(equal(nil)); // fails -expect(nil).to(beNil()); // passes -``` - -If your matcher does not want to match with nil, you use `NonNilMatcherFunc` -and the `canMatchNil` constructor on `NMBObjCMatcher`. Using both types will -automatically generate expected value failure messages when they're nil. - -```swift - -public func beginWith(startingElement: T) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "begin with <\(startingElement)>" - if let actualValue = actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - return actualGenerator.next() == startingElement - } - return false - } -} - -extension NMBObjCMatcher { - public class func beginWithMatcher(expected: AnyObject) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = actualExpression.evaluate() - let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return beginWith(expected).matches(expr, failureMessage: failureMessage) - } - } -} -``` - -# Installing Nimble - -> Nimble can be used on its own, or in conjunction with its sister - project, [Quick](https://github.com/Quick/Quick). To install both - Quick and Nimble, follow [the installation instructions in the Quick - Documentation](https://github.com/Quick/Quick/blob/master/Documentation/en-us/InstallingQuick.md). - -Nimble can currently be installed in one of two ways: using CocoaPods, or with -git submodules. - -## Installing Nimble as a Submodule - -To use Nimble as a submodule to test your macOS, iOS or tvOS applications, follow -these 4 easy steps: - -1. Clone the Nimble repository -2. Add Nimble.xcodeproj to the Xcode workspace for your project -3. Link Nimble.framework to your test target -4. Start writing expectations! - -For more detailed instructions on each of these steps, -read [How to Install Quick](https://github.com/Quick/Quick#how-to-install-quick). -Ignore the steps involving adding Quick to your project in order to -install just Nimble. - -## Installing Nimble via CocoaPods - -To use Nimble in CocoaPods to test your macOS, iOS or tvOS applications, add -Nimble to your podfile and add the ```use_frameworks!``` line to enable Swift -support for CocoaPods. - -```ruby -platform :ios, '8.0' - -source 'https://github.com/CocoaPods/Specs.git' - -# Whatever pods you need for your app go here - -target 'YOUR_APP_NAME_HERE_Tests', :exclusive => true do - use_frameworks! - pod 'Nimble', '~> 5.0.0' -end -``` - -Finally run `pod install`. - -## Using Nimble without XCTest - -Nimble is integrated with XCTest to allow it work well when used in Xcode test -bundles, however it can also be used in a standalone app. After installing -Nimble using one of the above methods, there are two additional steps required -to make this work. - -1. Create a custom assertion handler and assign an instance of it to the - global `NimbleAssertionHandler` variable. For example: - -```swift -class MyAssertionHandler : AssertionHandler { - func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { - if (!assertion) { - print("Expectation failed: \(message.stringValue)") - } - } -} -``` -```swift -// Somewhere before you use any assertions -NimbleAssertionHandler = MyAssertionHandler() -``` - -2. Add a post-build action to fix an issue with the Swift XCTest support - library being unnecessarily copied into your app - * Edit your scheme in Xcode, and navigate to Build -> Post-actions - * Click the "+" icon and select "New Run Script Action" - * Open the "Provide build settings from" dropdown and select your target - * Enter the following script contents: -``` -rm "${SWIFT_STDLIB_TOOL_DESTINATION_DIR}/libswiftXCTest.dylib" -``` - -You can now use Nimble assertions in your code and handle failures as you see -fit. diff --git a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.h b/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.h deleted file mode 100644 index 6ec6a29f..00000000 --- a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// CwlCatchException.h -// CwlCatchException -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#import - -//! Project version number for CwlCatchException. -FOUNDATION_EXPORT double CwlCatchExceptionVersionNumber; - -//! Project version string for CwlCatchException. -FOUNDATION_EXPORT const unsigned char CwlCatchExceptionVersionString[]; - -__attribute__((visibility("hidden"))) -NSException* __nullable catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)()); diff --git a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.m b/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.m deleted file mode 100644 index 4f9772cf..00000000 --- a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.m +++ /dev/null @@ -1,35 +0,0 @@ -// -// CwlCatchException.m -// CwlAssertionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#import "CwlCatchException.h" - -__attribute__((visibility("hidden"))) -NSException* catchExceptionOfKind(Class __nonnull type, __attribute__((noescape)) void (^ __nonnull inBlock)()) { - @try { - inBlock(); - } @catch (NSException *exception) { - if ([exception isKindOfClass:type]) { - return exception; - } else { - @throw; - } - } - return nil; -} diff --git a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.swift b/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.swift deleted file mode 100644 index b44a232f..00000000 --- a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// CwlCatchException.swift -// CwlAssertionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -import Foundation - -// We can't simply cast to Self? in the catchInBlock method so we need this generic function wrapper to do the conversion for us. Mildly annoying. -private func catchReturnTypeConverter(_ type: T.Type, block: () -> Void) -> T? { - return catchExceptionOfKind(type, block) as? T -} - -extension NSException { - public static func catchException(in block: () -> Void) -> Self? { - return catchReturnTypeConverter(self, block: block) - } -} diff --git a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlBadInstructionException.swift b/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlBadInstructionException.swift deleted file mode 100644 index 5bf2794d..00000000 --- a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlBadInstructionException.swift +++ /dev/null @@ -1,76 +0,0 @@ -// -// CwlBadInstructionException.swift -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -import Foundation - -private func raiseBadInstructionException() { - BadInstructionException().raise() -} - -/// A simple NSException subclass. It's not required to subclass NSException (since the exception type is represented in the name) but this helps for identifying the exception through runtime type. -@objc public class BadInstructionException: NSException { - static var name: String = "com.cocoawithlove.BadInstruction" - - init() { - super.init(name: NSExceptionName(rawValue: BadInstructionException.name), reason: nil, userInfo: nil) - } - - required public init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - } - - /// An Objective-C callable function, invoked from the `mach_exc_server` callback function `catch_mach_exception_raise_state` to push the `raiseBadInstructionException` function onto the stack. - public class func catch_mach_exception_raise_state(_ exception_port: mach_port_t, exception: exception_type_t, code: UnsafePointer, codeCnt: mach_msg_type_number_t, flavor: UnsafeMutablePointer, old_state: UnsafePointer, old_stateCnt: mach_msg_type_number_t, new_state: thread_state_t, new_stateCnt: UnsafeMutablePointer) -> kern_return_t { - - #if arch(x86_64) - // Make sure we've been given enough memory - if old_stateCnt != x86_THREAD_STATE64_COUNT || new_stateCnt.pointee < x86_THREAD_STATE64_COUNT { - return KERN_INVALID_ARGUMENT - } - - // Read the old thread state - var state = old_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { return $0.pointee } - - // 1. Decrement the stack pointer - state.__rsp -= __uint64_t(MemoryLayout.size) - - // 2. Save the old Instruction Pointer to the stack. - if let pointer = UnsafeMutablePointer<__uint64_t>(bitPattern: UInt(state.__rsp)) { - pointer.pointee = state.__rip - } else { - return KERN_INVALID_ARGUMENT - } - - // 3. Set the Instruction Pointer to the new function's address - var f: @convention(c) () -> Void = raiseBadInstructionException - withUnsafePointer(to: &f) { - state.__rip = $0.withMemoryRebound(to: __uint64_t.self, capacity: 1) { return $0.pointee } - } - - // Write the new thread state - new_state.withMemoryRebound(to: x86_thread_state64_t.self, capacity: 1) { $0.pointee = state } - new_stateCnt.pointee = x86_THREAD_STATE64_COUNT - - return KERN_SUCCESS - #else - fatalError("Unavailable for this CPU architecture") - #endif - } -} diff --git a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.h b/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.h deleted file mode 100644 index 0333ed27..00000000 --- a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.h +++ /dev/null @@ -1,61 +0,0 @@ -// -// CwlCatchBadInstruction.h -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#if defined(__x86_64__) - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -// The request_mach_exception_raise_t struct is passed to mach_msg which assumes its exact layout. To avoid problems with different layouts, we keep the definition in C rather than Swift. -typedef struct -{ - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t thread; - mach_msg_port_descriptor_t task; - /* end of the kernel processed data */ - NDR_record_t NDR; - exception_type_t exception; - mach_msg_type_number_t codeCnt; - int64_t code[2]; - int flavor; - mach_msg_type_number_t old_stateCnt; - natural_t old_state[224]; -} request_mach_exception_raise_t; - -// The reply_mach_exception_raise_state_t struct is passed to mach_msg which assumes its exact layout. To avoid problems with different layouts, we keep the definition in C rather than Swift. -typedef struct -{ - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - int flavor; - mach_msg_type_number_t new_stateCnt; - natural_t new_state[224]; -} reply_mach_exception_raise_state_t; - -extern boolean_t mach_exc_server(mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); - -NS_ASSUME_NONNULL_END - -#endif diff --git a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.m b/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.m deleted file mode 100644 index 22c13775..00000000 --- a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.m +++ /dev/null @@ -1,50 +0,0 @@ -// -// CwlCatchBadInstruction.m -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -#if defined(__x86_64__) - -#import "CwlCatchBadInstruction.h" - -// Assuming the "PRODUCT_NAME" macro is defined, this will create the name of the Swift generated header file -#define STRINGIZE_NO_EXPANSION(A) #A -#define STRINGIZE_WITH_EXPANSION(A) STRINGIZE_NO_EXPANSION(A) -#define SWIFT_INCLUDE STRINGIZE_WITH_EXPANSION(PRODUCT_NAME-Swift.h) - -// Include the Swift generated header file -#import SWIFT_INCLUDE - -/// A basic function that receives callbacks from mach_exc_server and relays them to the Swift implemented BadInstructionException.catch_mach_exception_raise_state. -kern_return_t catch_mach_exception_raise_state(mach_port_t exception_port, exception_type_t exception, const mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, const thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { - return [BadInstructionException catch_mach_exception_raise_state:exception_port exception:exception code:code codeCnt:codeCnt flavor:flavor old_state:old_state old_stateCnt:old_stateCnt new_state:new_state new_stateCnt:new_stateCnt]; -} - -// The mach port should be configured so that this function is never used. -kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt) { - assert(false); - return KERN_FAILURE; -} - -// The mach port should be configured so that this function is never used. -kern_return_t catch_mach_exception_raise_state_identity(mach_port_t exception_port, mach_port_t thread, mach_port_t task, exception_type_t exception, mach_exception_data_t code, mach_msg_type_number_t codeCnt, int *flavor, thread_state_t old_state, mach_msg_type_number_t old_stateCnt, thread_state_t new_state, mach_msg_type_number_t *new_stateCnt) { - assert(false); - return KERN_FAILURE; -} - -#endif diff --git a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.swift b/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.swift deleted file mode 100644 index 4d82f7ae..00000000 --- a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.swift +++ /dev/null @@ -1,193 +0,0 @@ -// -// CwlCatchBadInstruction.swift -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -import Foundation - -#if arch(x86_64) - - private enum PthreadError: Error { case code(Int32) } - private enum MachExcServer: Error { case code(kern_return_t) } - - /// A quick function for converting Mach error results into Swift errors - private func kernCheck(_ f: () -> Int32) throws { - let r = f() - guard r == KERN_SUCCESS else { - throw NSError(domain: NSMachErrorDomain, code: Int(r), userInfo: nil) - } - } - - extension execTypesCountTuple { - mutating func pointer(in block: (UnsafeMutablePointer) -> R) -> R { - return withUnsafeMutablePointer(to: &self) { p -> R in - return p.withMemoryRebound(to: T.self, capacity: EXC_TYPES_COUNT) { ptr -> R in - return block(ptr) - } - } - } - } - - extension request_mach_exception_raise_t { - mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { - return withUnsafeMutablePointer(to: &self) { p -> R in - return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in - return block(ptr) - } - } - } - } - - extension reply_mach_exception_raise_state_t { - mutating func withMsgHeaderPointer(in block: (UnsafeMutablePointer) -> R) -> R { - return withUnsafeMutablePointer(to: &self) { p -> R in - return p.withMemoryRebound(to: mach_msg_header_t.self, capacity: 1) { ptr -> R in - return block(ptr) - } - } - } - } - - /// A structure used to store context associated with the Mach message port - private struct MachContext { - var masks = execTypesCountTuple() - var count: mach_msg_type_number_t = 0 - var ports = execTypesCountTuple() - var behaviors = execTypesCountTuple() - var flavors = execTypesCountTuple() - var currentExceptionPort: mach_port_t = 0 - var handlerThread: pthread_t? = nil - - mutating func withUnsafeMutablePointers(in block: (UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer, UnsafeMutablePointer) -> R) -> R { - return masks.pointer { masksPtr in - return ports.pointer { portsPtr in - return behaviors.pointer { behaviorsPtr in - return flavors.pointer { flavorsPtr in - return block(masksPtr, portsPtr, behaviorsPtr, flavorsPtr) - } - } - } - } - } - } - - /// A function for receiving mach messages and parsing the first with mach_exc_server (and if any others are received, throwing them away). - private func machMessageHandler(_ arg: UnsafeMutableRawPointer) -> UnsafeMutableRawPointer? { - let context = arg.assumingMemoryBound(to: MachContext.self).pointee - var request = request_mach_exception_raise_t() - var reply = reply_mach_exception_raise_state_t() - - var handledfirstException = false - repeat { do { - // Request the next mach message from the port - request.Head.msgh_local_port = context.currentExceptionPort - request.Head.msgh_size = UInt32(MemoryLayout.size) - try kernCheck { request.withMsgHeaderPointer { requestPtr in - mach_msg(requestPtr, MACH_RCV_MSG | MACH_RCV_INTERRUPT, 0, request.Head.msgh_size, context.currentExceptionPort, 0, UInt32(MACH_PORT_NULL)) - } } - - // Prepare the reply structure - reply.Head.msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(request.Head.msgh_bits), 0) - reply.Head.msgh_local_port = UInt32(MACH_PORT_NULL) - reply.Head.msgh_remote_port = request.Head.msgh_remote_port - reply.Head.msgh_size = UInt32(MemoryLayout.size) - reply.NDR = NDR_record - - if !handledfirstException { - // Use the MiG generated server to invoke our handler for the request and fill in the rest of the reply structure - guard request.withMsgHeaderPointer(in: { requestPtr in reply.withMsgHeaderPointer { replyPtr in - mach_exc_server(requestPtr, replyPtr) - } }) != 0 else { throw MachExcServer.code(reply.RetCode) } - - handledfirstException = true - } else { - // If multiple fatal errors occur, don't handle subsquent errors (let the program crash) - reply.RetCode = KERN_FAILURE - } - - // Send the reply - try kernCheck { reply.withMsgHeaderPointer { replyPtr in - mach_msg(replyPtr, MACH_SEND_MSG, reply.Head.msgh_size, 0, UInt32(MACH_PORT_NULL), 0, UInt32(MACH_PORT_NULL)) - } } - } catch let error as NSError where (error.domain == NSMachErrorDomain && (error.code == Int(MACH_RCV_PORT_CHANGED) || error.code == Int(MACH_RCV_INVALID_NAME))) { - // Port was already closed before we started or closed while we were listening. - // This means the controlling thread shut down. - return nil - } catch { - // Should never be reached but this is testing code, don't try to recover, just abort - fatalError("Mach message error: \(error)") - } } while true - } - - /// Run the provided block. If a mach "BAD_INSTRUCTION" exception is raised, catch it and return a BadInstructionException (which captures stack information about the throw site, if desired). Otherwise return nil. - /// NOTE: This function is only intended for use in test harnesses – use in a distributed build is almost certainly a bad choice. If a "BAD_INSTRUCTION" exception is raised, the block will be exited before completion via Objective-C exception. The risks associated with an Objective-C exception apply here: most Swift/Objective-C functions are *not* exception-safe. Memory may be leaked and the program will not necessarily be left in a safe state. - /// - parameter block: a function without parameters that will be run - /// - returns: if an EXC_BAD_INSTRUCTION is raised during the execution of `block` then a BadInstructionException will be returned, otherwise `nil`. - public func catchBadInstruction(in block: () -> Void) -> BadInstructionException? { - var context = MachContext() - var result: BadInstructionException? = nil - do { - var handlerThread: pthread_t? = nil - defer { - // 8. Wait for the thread to terminate *if* we actually made it to the creation point - // The mach port should be destroyed *before* calling pthread_join to avoid a deadlock. - if handlerThread != nil { - pthread_join(handlerThread!, nil) - } - } - - try kernCheck { - // 1. Create the mach port - mach_port_allocate(mach_task_self_, MACH_PORT_RIGHT_RECEIVE, &context.currentExceptionPort) - } - defer { - // 7. Cleanup the mach port - mach_port_destroy(mach_task_self_, context.currentExceptionPort) - } - - try kernCheck { - // 2. Configure the mach port - mach_port_insert_right(mach_task_self_, context.currentExceptionPort, context.currentExceptionPort, MACH_MSG_TYPE_MAKE_SEND) - } - - try kernCheck { context.withUnsafeMutablePointers { masksPtr, portsPtr, behaviorsPtr, flavorsPtr in - // 3. Apply the mach port as the handler for this thread - thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, context.currentExceptionPort, Int32(bitPattern: UInt32(EXCEPTION_STATE) | MACH_EXCEPTION_CODES), x86_THREAD_STATE64, masksPtr, &context.count, portsPtr, behaviorsPtr, flavorsPtr) - } } - - defer { context.withUnsafeMutablePointers { masksPtr, portsPtr, behaviorsPtr, flavorsPtr in - // 6. Unapply the mach port - _ = thread_swap_exception_ports(mach_thread_self(), EXC_MASK_BAD_INSTRUCTION, 0, EXCEPTION_DEFAULT, THREAD_STATE_NONE, masksPtr, &context.count, portsPtr, behaviorsPtr, flavorsPtr) - } } - - try withUnsafeMutablePointer(to: &context) { c throws in - // 4. Create the thread - let e = pthread_create(&handlerThread, nil, machMessageHandler, c) - guard e == 0 else { throw PthreadError.code(e) } - - // 5. Run the block - result = BadInstructionException.catchException(in: block) - } - } catch { - // Should never be reached but this is testing code, don't try to recover, just abort - fatalError("Mach port error: \(error)") - } - return result - } - -#endif diff --git a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlDarwinDefinitions.swift b/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlDarwinDefinitions.swift deleted file mode 100644 index 35e1ad55..00000000 --- a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlDarwinDefinitions.swift +++ /dev/null @@ -1,63 +0,0 @@ -// -// CwlDarwinDefinitions.swift -// CwlPreconditionTesting -// -// Created by Matt Gallagher on 2016/01/10. -// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved. -// -// Permission to use, copy, modify, and/or distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -// - -import Darwin - -#if arch(x86_64) - -// From /usr/include/mach/port.h -// #define MACH_PORT_RIGHT_RECEIVE ((mach_port_right_t) 1) -let MACH_PORT_RIGHT_RECEIVE: mach_port_right_t = 1 - -// From /usr/include/mach/message.h -// #define MACH_MSG_TYPE_MAKE_SEND 20 /* Must hold receive right */ -// #define MACH_MSGH_BITS_REMOTE(bits) \ -// ((bits) & MACH_MSGH_BITS_REMOTE_MASK) -// #define MACH_MSGH_BITS(remote, local) /* legacy */ \ -// ((remote) | ((local) << 8)) -let MACH_MSG_TYPE_MAKE_SEND: UInt32 = 20 -func MACH_MSGH_BITS_REMOTE(_ bits: UInt32) -> UInt32 { return bits & UInt32(MACH_MSGH_BITS_REMOTE_MASK) } -func MACH_MSGH_BITS(_ remote: UInt32, _ local: UInt32) -> UInt32 { return ((remote) | ((local) << 8)) } - -// From /usr/include/mach/exception_types.h -// #define EXC_BAD_INSTRUCTION 2 /* Instruction failed */ -// #define EXC_MASK_BAD_INSTRUCTION (1 << EXC_BAD_INSTRUCTION) -// #define EXCEPTION_DEFAULT 1 -let EXC_BAD_INSTRUCTION: UInt32 = 2 -let EXC_MASK_BAD_INSTRUCTION: UInt32 = 1 << EXC_BAD_INSTRUCTION -let EXCEPTION_DEFAULT: Int32 = 1 - -// From /usr/include/mach/i386/thread_status.h -// #define THREAD_STATE_NONE 13 -// #define x86_THREAD_STATE64_COUNT ((mach_msg_type_number_t) \ -// ( sizeof (x86_thread_state64_t) / sizeof (int) )) -let THREAD_STATE_NONE: Int32 = 13 -let x86_THREAD_STATE64_COUNT = UInt32(MemoryLayout.size / MemoryLayout.size) - -let EXC_TYPES_COUNT = 14 -struct execTypesCountTuple { - // From /usr/include/mach/i386/exception.h - // #define EXC_TYPES_COUNT 14 /* incl. illegal exception 0 */ - var value: (T, T, T, T, T, T, T, T, T, T, T, T, T, T) = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) - init() { - } -} - -#endif diff --git a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/mach_excServer.c b/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/mach_excServer.c deleted file mode 100644 index 23345385..00000000 --- a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/mach_excServer.c +++ /dev/null @@ -1,537 +0,0 @@ -/* - * IDENTIFICATION: - * stub generated Mon Jan 11 00:24:26 2016 - * with a MiG generated by bootstrap_cmds-93 - * OPTIONS: - */ - -/* Module mach_exc */ - -#if defined(__x86_64__) - -#define __MIG_check__Request__mach_exc_subsystem__ 1 - -#include "mach_excServer.h" - -#ifndef mig_internal -#define mig_internal static __inline__ -#endif /* mig_internal */ - -#ifndef mig_external -#define mig_external -#endif /* mig_external */ - -#if !defined(__MigTypeCheck) && defined(TypeCheck) -#define __MigTypeCheck TypeCheck /* Legacy setting */ -#endif /* !defined(__MigTypeCheck) */ - -#if !defined(__MigKernelSpecificCode) && defined(_MIG_KERNEL_SPECIFIC_CODE_) -#define __MigKernelSpecificCode _MIG_KERNEL_SPECIFIC_CODE_ /* Legacy setting */ -#endif /* !defined(__MigKernelSpecificCode) */ - -#ifndef LimitCheck -#define LimitCheck 0 -#endif /* LimitCheck */ - -#ifndef min -#define min(a,b) ( ((a) < (b))? (a): (b) ) -#endif /* min */ - -#if !defined(_WALIGN_) -#define _WALIGN_(x) (((x) + 3) & ~3) -#endif /* !defined(_WALIGN_) */ - -#if !defined(_WALIGNSZ_) -#define _WALIGNSZ_(x) _WALIGN_(sizeof(x)) -#endif /* !defined(_WALIGNSZ_) */ - -#ifndef UseStaticTemplates -#define UseStaticTemplates 0 -#endif /* UseStaticTemplates */ - -#ifndef __DeclareRcvRpc -#define __DeclareRcvRpc(_NUM_, _NAME_) -#endif /* __DeclareRcvRpc */ - -#ifndef __BeforeRcvRpc -#define __BeforeRcvRpc(_NUM_, _NAME_) -#endif /* __BeforeRcvRpc */ - -#ifndef __AfterRcvRpc -#define __AfterRcvRpc(_NUM_, _NAME_) -#endif /* __AfterRcvRpc */ - -#ifndef __DeclareRcvSimple -#define __DeclareRcvSimple(_NUM_, _NAME_) -#endif /* __DeclareRcvSimple */ - -#ifndef __BeforeRcvSimple -#define __BeforeRcvSimple(_NUM_, _NAME_) -#endif /* __BeforeRcvSimple */ - -#ifndef __AfterRcvSimple -#define __AfterRcvSimple(_NUM_, _NAME_) -#endif /* __AfterRcvSimple */ - -#define novalue void - -#define msgh_request_port msgh_local_port -#define MACH_MSGH_BITS_REQUEST(bits) MACH_MSGH_BITS_LOCAL(bits) -#define msgh_reply_port msgh_remote_port -#define MACH_MSGH_BITS_REPLY(bits) MACH_MSGH_BITS_REMOTE(bits) - -#define MIG_RETURN_ERROR(X, code) {\ - ((mig_reply_error_t *)X)->RetCode = code;\ - ((mig_reply_error_t *)X)->NDR = NDR_record;\ - return;\ - } - -/* Forward Declarations */ - - -mig_internal novalue _Xmach_exception_raise - (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); - -mig_internal novalue _Xmach_exception_raise_state - (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); - -mig_internal novalue _Xmach_exception_raise_state_identity - (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP); - - -#if ( __MigTypeCheck ) -#if __MIG_check__Request__mach_exc_subsystem__ -#if !defined(__MIG_check__Request__mach_exception_raise_t__defined) -#define __MIG_check__Request__mach_exception_raise_t__defined - -mig_internal kern_return_t __MIG_check__Request__mach_exception_raise_t(__attribute__((__unused__)) __Request__mach_exception_raise_t *In0P) -{ - - typedef __Request__mach_exception_raise_t __Request; -#if __MigTypeCheck - unsigned int msgh_size; -#endif /* __MigTypeCheck */ - -#if __MigTypeCheck - msgh_size = In0P->Head.msgh_size; - if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || - (In0P->msgh_body.msgh_descriptor_count != 2) || - (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 16)) || (msgh_size > (mach_msg_size_t)sizeof(__Request))) - return MIG_BAD_ARGUMENTS; -#endif /* __MigTypeCheck */ - -#if __MigTypeCheck - if (In0P->thread.type != MACH_MSG_PORT_DESCRIPTOR || - In0P->thread.disposition != 17) - return MIG_TYPE_ERROR; -#endif /* __MigTypeCheck */ - -#if __MigTypeCheck - if (In0P->task.type != MACH_MSG_PORT_DESCRIPTOR || - In0P->task.disposition != 17) - return MIG_TYPE_ERROR; -#endif /* __MigTypeCheck */ - -#if defined(__NDR_convert__int_rep__Request__mach_exception_raise_t__codeCnt__defined) - if (In0P->NDR.int_rep != NDR_record.int_rep) - __NDR_convert__int_rep__Request__mach_exception_raise_t__codeCnt(&In0P->codeCnt, In0P->NDR.int_rep); -#endif /* __NDR_convert__int_rep__Request__mach_exception_raise_t__codeCnt__defined */ -#if __MigTypeCheck - if ( In0P->codeCnt > 2 ) - return MIG_BAD_ARGUMENTS; - if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 16)) / 8 < In0P->codeCnt) || - (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 16) + (8 * In0P->codeCnt))) - return MIG_BAD_ARGUMENTS; -#endif /* __MigTypeCheck */ - - return MACH_MSG_SUCCESS; -} -#endif /* !defined(__MIG_check__Request__mach_exception_raise_t__defined) */ -#endif /* __MIG_check__Request__mach_exc_subsystem__ */ -#endif /* ( __MigTypeCheck ) */ - - -/* Routine mach_exception_raise */ -mig_internal novalue _Xmach_exception_raise - (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) -{ - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t thread; - mach_msg_port_descriptor_t task; - /* end of the kernel processed data */ - NDR_record_t NDR; - exception_type_t exception; - mach_msg_type_number_t codeCnt; - int64_t code[2]; - mach_msg_trailer_t trailer; - } Request __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack() -#endif - typedef __Request__mach_exception_raise_t __Request; - typedef __Reply__mach_exception_raise_t Reply __attribute__((unused)); - - /* - * typedef struct { - * mach_msg_header_t Head; - * NDR_record_t NDR; - * kern_return_t RetCode; - * } mig_reply_error_t; - */ - - Request *In0P = (Request *) InHeadP; - Reply *OutP = (Reply *) OutHeadP; -#ifdef __MIG_check__Request__mach_exception_raise_t__defined - kern_return_t check_result; -#endif /* __MIG_check__Request__mach_exception_raise_t__defined */ - - __DeclareRcvRpc(2405, "mach_exception_raise") - __BeforeRcvRpc(2405, "mach_exception_raise") - -#if defined(__MIG_check__Request__mach_exception_raise_t__defined) - check_result = __MIG_check__Request__mach_exception_raise_t((__Request *)In0P); - if (check_result != MACH_MSG_SUCCESS) - { MIG_RETURN_ERROR(OutP, check_result); } -#endif /* defined(__MIG_check__Request__mach_exception_raise_t__defined) */ - - OutP->RetCode = catch_mach_exception_raise(In0P->Head.msgh_request_port, In0P->thread.name, In0P->task.name, In0P->exception, In0P->code, In0P->codeCnt); - - OutP->NDR = NDR_record; - - - __AfterRcvRpc(2405, "mach_exception_raise") -} - -#if ( __MigTypeCheck ) -#if __MIG_check__Request__mach_exc_subsystem__ -#if !defined(__MIG_check__Request__mach_exception_raise_state_t__defined) -#define __MIG_check__Request__mach_exception_raise_state_t__defined - -mig_internal kern_return_t __MIG_check__Request__mach_exception_raise_state_t(__attribute__((__unused__)) __Request__mach_exception_raise_state_t *In0P, __attribute__((__unused__)) __Request__mach_exception_raise_state_t **In1PP) -{ - - typedef __Request__mach_exception_raise_state_t __Request; - __Request *In1P; -#if __MigTypeCheck - unsigned int msgh_size; -#endif /* __MigTypeCheck */ - unsigned int msgh_size_delta; - -#if __MigTypeCheck - msgh_size = In0P->Head.msgh_size; - if ((In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || - (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 912)) || (msgh_size > (mach_msg_size_t)sizeof(__Request))) - return MIG_BAD_ARGUMENTS; -#endif /* __MigTypeCheck */ - -#if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_t__codeCnt__defined) - if (In0P->NDR.int_rep != NDR_record.int_rep) - __NDR_convert__int_rep__Request__mach_exception_raise_state_t__codeCnt(&In0P->codeCnt, In0P->NDR.int_rep); -#endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_t__codeCnt__defined */ - msgh_size_delta = (8 * In0P->codeCnt); -#if __MigTypeCheck - if ( In0P->codeCnt > 2 ) - return MIG_BAD_ARGUMENTS; - if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 912)) / 8 < In0P->codeCnt) || - (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 912) + (8 * In0P->codeCnt))) - return MIG_BAD_ARGUMENTS; - msgh_size -= msgh_size_delta; -#endif /* __MigTypeCheck */ - - *In1PP = In1P = (__Request *) ((pointer_t) In0P + msgh_size_delta - 16); - -#if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_t__old_stateCnt__defined) - if (In0P->NDR.int_rep != NDR_record.int_rep) - __NDR_convert__int_rep__Request__mach_exception_raise_state_t__old_stateCnt(&In1P->old_stateCnt, In1P->NDR.int_rep); -#endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_t__old_stateCnt__defined */ -#if __MigTypeCheck - if ( In1P->old_stateCnt > 224 ) - return MIG_BAD_ARGUMENTS; - if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 912)) / 4 < In1P->old_stateCnt) || - (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 912) + (4 * In1P->old_stateCnt))) - return MIG_BAD_ARGUMENTS; -#endif /* __MigTypeCheck */ - - return MACH_MSG_SUCCESS; -} -#endif /* !defined(__MIG_check__Request__mach_exception_raise_state_t__defined) */ -#endif /* __MIG_check__Request__mach_exc_subsystem__ */ -#endif /* ( __MigTypeCheck ) */ - - -/* Routine mach_exception_raise_state */ -mig_internal novalue _Xmach_exception_raise_state - (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) -{ - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - exception_type_t exception; - mach_msg_type_number_t codeCnt; - int64_t code[2]; - int flavor; - mach_msg_type_number_t old_stateCnt; - natural_t old_state[224]; - mach_msg_trailer_t trailer; - } Request __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack() -#endif - typedef __Request__mach_exception_raise_state_t __Request; - typedef __Reply__mach_exception_raise_state_t Reply __attribute__((unused)); - - /* - * typedef struct { - * mach_msg_header_t Head; - * NDR_record_t NDR; - * kern_return_t RetCode; - * } mig_reply_error_t; - */ - - Request *In0P = (Request *) InHeadP; - Request *In1P; - Reply *OutP = (Reply *) OutHeadP; -#ifdef __MIG_check__Request__mach_exception_raise_state_t__defined - kern_return_t check_result; -#endif /* __MIG_check__Request__mach_exception_raise_state_t__defined */ - - __DeclareRcvRpc(2406, "mach_exception_raise_state") - __BeforeRcvRpc(2406, "mach_exception_raise_state") - -#if defined(__MIG_check__Request__mach_exception_raise_state_t__defined) - check_result = __MIG_check__Request__mach_exception_raise_state_t((__Request *)In0P, (__Request **)&In1P); - if (check_result != MACH_MSG_SUCCESS) - { MIG_RETURN_ERROR(OutP, check_result); } -#endif /* defined(__MIG_check__Request__mach_exception_raise_state_t__defined) */ - - OutP->new_stateCnt = 224; - - OutP->RetCode = catch_mach_exception_raise_state(In0P->Head.msgh_request_port, In0P->exception, In0P->code, In0P->codeCnt, &In1P->flavor, In1P->old_state, In1P->old_stateCnt, OutP->new_state, &OutP->new_stateCnt); - if (OutP->RetCode != KERN_SUCCESS) { - MIG_RETURN_ERROR(OutP, OutP->RetCode); - } - - OutP->NDR = NDR_record; - - - OutP->flavor = In1P->flavor; - OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply) - 896) + (((4 * OutP->new_stateCnt))); - - __AfterRcvRpc(2406, "mach_exception_raise_state") -} - -#if ( __MigTypeCheck ) -#if __MIG_check__Request__mach_exc_subsystem__ -#if !defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined) -#define __MIG_check__Request__mach_exception_raise_state_identity_t__defined - -mig_internal kern_return_t __MIG_check__Request__mach_exception_raise_state_identity_t(__attribute__((__unused__)) __Request__mach_exception_raise_state_identity_t *In0P, __attribute__((__unused__)) __Request__mach_exception_raise_state_identity_t **In1PP) -{ - - typedef __Request__mach_exception_raise_state_identity_t __Request; - __Request *In1P; -#if __MigTypeCheck - unsigned int msgh_size; -#endif /* __MigTypeCheck */ - unsigned int msgh_size_delta; - -#if __MigTypeCheck - msgh_size = In0P->Head.msgh_size; - if (!(In0P->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) || - (In0P->msgh_body.msgh_descriptor_count != 2) || - (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 912)) || (msgh_size > (mach_msg_size_t)sizeof(__Request))) - return MIG_BAD_ARGUMENTS; -#endif /* __MigTypeCheck */ - -#if __MigTypeCheck - if (In0P->thread.type != MACH_MSG_PORT_DESCRIPTOR || - In0P->thread.disposition != 17) - return MIG_TYPE_ERROR; -#endif /* __MigTypeCheck */ - -#if __MigTypeCheck - if (In0P->task.type != MACH_MSG_PORT_DESCRIPTOR || - In0P->task.disposition != 17) - return MIG_TYPE_ERROR; -#endif /* __MigTypeCheck */ - -#if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__codeCnt__defined) - if (In0P->NDR.int_rep != NDR_record.int_rep) - __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__codeCnt(&In0P->codeCnt, In0P->NDR.int_rep); -#endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__codeCnt__defined */ - msgh_size_delta = (8 * In0P->codeCnt); -#if __MigTypeCheck - if ( In0P->codeCnt > 2 ) - return MIG_BAD_ARGUMENTS; - if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 912)) / 8 < In0P->codeCnt) || - (msgh_size < (mach_msg_size_t)(sizeof(__Request) - 912) + (8 * In0P->codeCnt))) - return MIG_BAD_ARGUMENTS; - msgh_size -= msgh_size_delta; -#endif /* __MigTypeCheck */ - - *In1PP = In1P = (__Request *) ((pointer_t) In0P + msgh_size_delta - 16); - -#if defined(__NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__old_stateCnt__defined) - if (In0P->NDR.int_rep != NDR_record.int_rep) - __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__old_stateCnt(&In1P->old_stateCnt, In1P->NDR.int_rep); -#endif /* __NDR_convert__int_rep__Request__mach_exception_raise_state_identity_t__old_stateCnt__defined */ -#if __MigTypeCheck - if ( In1P->old_stateCnt > 224 ) - return MIG_BAD_ARGUMENTS; - if (((msgh_size - (mach_msg_size_t)(sizeof(__Request) - 912)) / 4 < In1P->old_stateCnt) || - (msgh_size != (mach_msg_size_t)(sizeof(__Request) - 912) + (4 * In1P->old_stateCnt))) - return MIG_BAD_ARGUMENTS; -#endif /* __MigTypeCheck */ - - return MACH_MSG_SUCCESS; -} -#endif /* !defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined) */ -#endif /* __MIG_check__Request__mach_exc_subsystem__ */ -#endif /* ( __MigTypeCheck ) */ - - -/* Routine mach_exception_raise_state_identity */ -mig_internal novalue _Xmach_exception_raise_state_identity - (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) -{ - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t thread; - mach_msg_port_descriptor_t task; - /* end of the kernel processed data */ - NDR_record_t NDR; - exception_type_t exception; - mach_msg_type_number_t codeCnt; - int64_t code[2]; - int flavor; - mach_msg_type_number_t old_stateCnt; - natural_t old_state[224]; - mach_msg_trailer_t trailer; - } Request __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack() -#endif - typedef __Request__mach_exception_raise_state_identity_t __Request; - typedef __Reply__mach_exception_raise_state_identity_t Reply __attribute__((unused)); - - /* - * typedef struct { - * mach_msg_header_t Head; - * NDR_record_t NDR; - * kern_return_t RetCode; - * } mig_reply_error_t; - */ - - Request *In0P = (Request *) InHeadP; - Request *In1P; - Reply *OutP = (Reply *) OutHeadP; -#ifdef __MIG_check__Request__mach_exception_raise_state_identity_t__defined - kern_return_t check_result; -#endif /* __MIG_check__Request__mach_exception_raise_state_identity_t__defined */ - - __DeclareRcvRpc(2407, "mach_exception_raise_state_identity") - __BeforeRcvRpc(2407, "mach_exception_raise_state_identity") - -#if defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined) - check_result = __MIG_check__Request__mach_exception_raise_state_identity_t((__Request *)In0P, (__Request **)&In1P); - if (check_result != MACH_MSG_SUCCESS) - { MIG_RETURN_ERROR(OutP, check_result); } -#endif /* defined(__MIG_check__Request__mach_exception_raise_state_identity_t__defined) */ - - OutP->new_stateCnt = 224; - - OutP->RetCode = catch_mach_exception_raise_state_identity(In0P->Head.msgh_request_port, In0P->thread.name, In0P->task.name, In0P->exception, In0P->code, In0P->codeCnt, &In1P->flavor, In1P->old_state, In1P->old_stateCnt, OutP->new_state, &OutP->new_stateCnt); - if (OutP->RetCode != KERN_SUCCESS) { - MIG_RETURN_ERROR(OutP, OutP->RetCode); - } - - OutP->NDR = NDR_record; - - - OutP->flavor = In1P->flavor; - OutP->Head.msgh_size = (mach_msg_size_t)(sizeof(Reply) - 896) + (((4 * OutP->new_stateCnt))); - - __AfterRcvRpc(2407, "mach_exception_raise_state_identity") -} - - - -/* Description of this subsystem, for use in direct RPC */ -const struct catch_mach_exc_subsystem catch_mach_exc_subsystem = { - mach_exc_server_routine, - 2405, - 2408, - (mach_msg_size_t)sizeof(union __ReplyUnion__catch_mach_exc_subsystem), - (vm_address_t)0, - { - { (mig_impl_routine_t) 0, - (mig_stub_routine_t) _Xmach_exception_raise, 6, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_exception_raise_t)}, - { (mig_impl_routine_t) 0, - (mig_stub_routine_t) _Xmach_exception_raise_state, 9, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_exception_raise_state_t)}, - { (mig_impl_routine_t) 0, - (mig_stub_routine_t) _Xmach_exception_raise_state_identity, 11, 0, (routine_arg_descriptor_t)0, (mach_msg_size_t)sizeof(__Reply__mach_exception_raise_state_identity_t)}, - } -}; - -mig_external boolean_t mach_exc_server - (mach_msg_header_t *InHeadP, mach_msg_header_t *OutHeadP) -{ - /* - * typedef struct { - * mach_msg_header_t Head; - * NDR_record_t NDR; - * kern_return_t RetCode; - * } mig_reply_error_t; - */ - - register mig_routine_t routine; - - OutHeadP->msgh_bits = MACH_MSGH_BITS(MACH_MSGH_BITS_REPLY(InHeadP->msgh_bits), 0); - OutHeadP->msgh_remote_port = InHeadP->msgh_reply_port; - /* Minimal size: routine() will update it if different */ - OutHeadP->msgh_size = (mach_msg_size_t)sizeof(mig_reply_error_t); - OutHeadP->msgh_local_port = MACH_PORT_NULL; - OutHeadP->msgh_id = InHeadP->msgh_id + 100; - - if ((InHeadP->msgh_id > 2407) || (InHeadP->msgh_id < 2405) || - ((routine = catch_mach_exc_subsystem.routine[InHeadP->msgh_id - 2405].stub_routine) == 0)) { - ((mig_reply_error_t *)OutHeadP)->NDR = NDR_record; - ((mig_reply_error_t *)OutHeadP)->RetCode = MIG_BAD_ID; - return FALSE; - } - (*routine) (InHeadP, OutHeadP); - return TRUE; -} - -mig_external mig_routine_t mach_exc_server_routine - (mach_msg_header_t *InHeadP) -{ - register int msgh_id; - - msgh_id = InHeadP->msgh_id - 2405; - - if ((msgh_id > 2) || (msgh_id < 0)) - return 0; - - return catch_mach_exc_subsystem.routine[msgh_id].stub_routine; -} - -#endif - diff --git a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/mach_excServer.h b/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/mach_excServer.h deleted file mode 100644 index 766ba11a..00000000 --- a/Pods/Nimble/Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/mach_excServer.h +++ /dev/null @@ -1,298 +0,0 @@ -#ifndef _mach_exc_server_ -#define _mach_exc_server_ - -/* Module mach_exc */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* BEGIN VOUCHER CODE */ - -#ifndef KERNEL -#if defined(__has_include) -#if __has_include() -#ifndef USING_VOUCHERS -#define USING_VOUCHERS -#endif -#ifndef __VOUCHER_FORWARD_TYPE_DECLS__ -#define __VOUCHER_FORWARD_TYPE_DECLS__ -#ifdef __cplusplus -extern "C" { -#endif - extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import)); -#ifdef __cplusplus -} -#endif -#endif // __VOUCHER_FORWARD_TYPE_DECLS__ -#endif // __has_include() -#endif // __has_include -#endif // !KERNEL - -/* END VOUCHER CODE */ - - -#ifdef AUTOTEST -#ifndef FUNCTION_PTR_T -#define FUNCTION_PTR_T -typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); -typedef struct { - char *name; - function_ptr_t function; -} function_table_entry; -typedef function_table_entry *function_table_t; -#endif /* FUNCTION_PTR_T */ -#endif /* AUTOTEST */ - -#ifndef mach_exc_MSG_COUNT -#define mach_exc_MSG_COUNT 3 -#endif /* mach_exc_MSG_COUNT */ - -#include -#include -#include -#include - -#ifdef __BeforeMigServerHeader -__BeforeMigServerHeader -#endif /* __BeforeMigServerHeader */ - - -/* Routine mach_exception_raise */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t catch_mach_exception_raise -( - mach_port_t exception_port, - mach_port_t thread, - mach_port_t task, - exception_type_t exception, - mach_exception_data_t code, - mach_msg_type_number_t codeCnt -); - -/* Routine mach_exception_raise_state */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t catch_mach_exception_raise_state -( - mach_port_t exception_port, - exception_type_t exception, - const mach_exception_data_t code, - mach_msg_type_number_t codeCnt, - int *flavor, - const thread_state_t old_state, - mach_msg_type_number_t old_stateCnt, - thread_state_t new_state, - mach_msg_type_number_t *new_stateCnt -); - -/* Routine mach_exception_raise_state_identity */ -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -kern_return_t catch_mach_exception_raise_state_identity -( - mach_port_t exception_port, - mach_port_t thread, - mach_port_t task, - exception_type_t exception, - mach_exception_data_t code, - mach_msg_type_number_t codeCnt, - int *flavor, - thread_state_t old_state, - mach_msg_type_number_t old_stateCnt, - thread_state_t new_state, - mach_msg_type_number_t *new_stateCnt -); - -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -boolean_t mach_exc_server( - mach_msg_header_t *InHeadP, - mach_msg_header_t *OutHeadP); - -#ifdef mig_external -mig_external -#else -extern -#endif /* mig_external */ -mig_routine_t mach_exc_server_routine( - mach_msg_header_t *InHeadP); - - -/* Description of this subsystem, for use in direct RPC */ -extern const struct catch_mach_exc_subsystem { - mig_server_routine_t server; /* Server routine */ - mach_msg_id_t start; /* Min routine number */ - mach_msg_id_t end; /* Max routine number + 1 */ - unsigned int maxsize; /* Max msg size */ - vm_address_t reserved; /* Reserved */ - struct routine_descriptor /*Array of routine descriptors */ - routine[3]; -} catch_mach_exc_subsystem; - -/* typedefs for all requests */ - -#ifndef __Request__mach_exc_subsystem__defined -#define __Request__mach_exc_subsystem__defined - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t thread; - mach_msg_port_descriptor_t task; - /* end of the kernel processed data */ - NDR_record_t NDR; - exception_type_t exception; - mach_msg_type_number_t codeCnt; - int64_t code[2]; - } __Request__mach_exception_raise_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - exception_type_t exception; - mach_msg_type_number_t codeCnt; - int64_t code[2]; - int flavor; - mach_msg_type_number_t old_stateCnt; - natural_t old_state[224]; - } __Request__mach_exception_raise_state_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - /* start of the kernel processed data */ - mach_msg_body_t msgh_body; - mach_msg_port_descriptor_t thread; - mach_msg_port_descriptor_t task; - /* end of the kernel processed data */ - NDR_record_t NDR; - exception_type_t exception; - mach_msg_type_number_t codeCnt; - int64_t code[2]; - int flavor; - mach_msg_type_number_t old_stateCnt; - natural_t old_state[224]; - } __Request__mach_exception_raise_state_identity_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack() -#endif -#endif /* !__Request__mach_exc_subsystem__defined */ - - -/* union of all requests */ - -#ifndef __RequestUnion__catch_mach_exc_subsystem__defined -#define __RequestUnion__catch_mach_exc_subsystem__defined -union __RequestUnion__catch_mach_exc_subsystem { - __Request__mach_exception_raise_t Request_mach_exception_raise; - __Request__mach_exception_raise_state_t Request_mach_exception_raise_state; - __Request__mach_exception_raise_state_identity_t Request_mach_exception_raise_state_identity; -}; -#endif /* __RequestUnion__catch_mach_exc_subsystem__defined */ -/* typedefs for all replies */ - -#ifndef __Reply__mach_exc_subsystem__defined -#define __Reply__mach_exc_subsystem__defined - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - } __Reply__mach_exception_raise_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - int flavor; - mach_msg_type_number_t new_stateCnt; - natural_t new_state[224]; - } __Reply__mach_exception_raise_state_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack() -#endif - -#ifdef __MigPackStructs -#pragma pack(4) -#endif - typedef struct { - mach_msg_header_t Head; - NDR_record_t NDR; - kern_return_t RetCode; - int flavor; - mach_msg_type_number_t new_stateCnt; - natural_t new_state[224]; - } __Reply__mach_exception_raise_state_identity_t __attribute__((unused)); -#ifdef __MigPackStructs -#pragma pack() -#endif -#endif /* !__Reply__mach_exc_subsystem__defined */ - - -/* union of all replies */ - -#ifndef __ReplyUnion__catch_mach_exc_subsystem__defined -#define __ReplyUnion__catch_mach_exc_subsystem__defined -union __ReplyUnion__catch_mach_exc_subsystem { - __Reply__mach_exception_raise_t Reply_mach_exception_raise; - __Reply__mach_exception_raise_state_t Reply_mach_exception_raise_state; - __Reply__mach_exception_raise_state_identity_t Reply_mach_exception_raise_state_identity; -}; -#endif /* __RequestUnion__catch_mach_exc_subsystem__defined */ - -#ifndef subsystem_to_name_map_mach_exc -#define subsystem_to_name_map_mach_exc \ - { "mach_exception_raise", 2405 },\ - { "mach_exception_raise_state", 2406 },\ - { "mach_exception_raise_state_identity", 2407 } -#endif - -#ifdef __AfterMigServerHeader -__AfterMigServerHeader -#endif /* __AfterMigServerHeader */ - -#endif /* _mach_exc_server_ */ diff --git a/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift b/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift deleted file mode 100644 index 2e58fdf9..00000000 --- a/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Foundation - -/// Protocol for the assertion handler that Nimble uses for all expectations. -public protocol AssertionHandler { - func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) -} - -/// Global backing interface for assertions that Nimble creates. -/// Defaults to a private test handler that passes through to XCTest. -/// -/// If XCTest is not available, you must assign your own assertion handler -/// before using any matchers, otherwise Nimble will abort the program. -/// -/// @see AssertionHandler -public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in - return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler() -}() diff --git a/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift b/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift deleted file mode 100644 index 94a9030e..00000000 --- a/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift +++ /dev/null @@ -1,19 +0,0 @@ -/// AssertionDispatcher allows multiple AssertionHandlers to receive -/// assertion messages. -/// -/// @warning Does not fully dispatch if one of the handlers raises an exception. -/// This is possible with XCTest-based assertion handlers. -/// -public class AssertionDispatcher: AssertionHandler { - let handlers: [AssertionHandler] - - public init(handlers: [AssertionHandler]) { - self.handlers = handlers - } - - public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { - for handler in handlers { - handler.assert(assertion, message: message, location: location) - } - } -} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift b/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift deleted file mode 100644 index 740c3923..00000000 --- a/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift +++ /dev/null @@ -1,100 +0,0 @@ -import Foundation - -/// A data structure that stores information about an assertion when -/// AssertionRecorder is set as the Nimble assertion handler. -/// -/// @see AssertionRecorder -/// @see AssertionHandler -public struct AssertionRecord: CustomStringConvertible { - /// Whether the assertion succeeded or failed - public let success: Bool - /// The failure message the assertion would display on failure. - public let message: FailureMessage - /// The source location the expectation occurred on. - public let location: SourceLocation - - public var description: String { - return "AssertionRecord { success=\(success), message='\(message.stringValue)', location=\(location) }" - } -} - -/// An AssertionHandler that silently records assertions that Nimble makes. -/// This is useful for testing failure messages for matchers. -/// -/// @see AssertionHandler -public class AssertionRecorder: AssertionHandler { - /// All the assertions that were captured by this recorder - public var assertions = [AssertionRecord]() - - public init() {} - - public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { - assertions.append( - AssertionRecord( - success: assertion, - message: message, - location: location)) - } -} - -/// Allows you to temporarily replace the current Nimble assertion handler with -/// the one provided for the scope of the closure. -/// -/// Once the closure finishes, then the original Nimble assertion handler is restored. -/// -/// @see AssertionHandler -public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closure: () throws -> Void) { - let environment = NimbleEnvironment.activeInstance - let oldRecorder = environment.assertionHandler - let capturer = NMBExceptionCapture(handler: nil, finally: ({ - environment.assertionHandler = oldRecorder - })) - environment.assertionHandler = tempAssertionHandler - capturer.tryBlock { - try! closure() - } -} - -/// Captures expectations that occur in the given closure. Note that all -/// expectations will still go through to the default Nimble handler. -/// -/// This can be useful if you want to gather information about expectations -/// that occur within a closure. -/// -/// @param silently expectations are no longer send to the default Nimble -/// assertion handler when this is true. Defaults to false. -/// -/// @see gatherFailingExpectations -public func gatherExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] { - let previousRecorder = NimbleEnvironment.activeInstance.assertionHandler - let recorder = AssertionRecorder() - let handlers: [AssertionHandler] - - if silently { - handlers = [recorder] - } else { - handlers = [recorder, previousRecorder] - } - - let dispatcher = AssertionDispatcher(handlers: handlers) - withAssertionHandler(dispatcher, closure: closure) - return recorder.assertions -} - -/// Captures failed expectations that occur in the given closure. Note that all -/// expectations will still go through to the default Nimble handler. -/// -/// This can be useful if you want to gather information about failed -/// expectations that occur within a closure. -/// -/// @param silently expectations are no longer send to the default Nimble -/// assertion handler when this is true. Defaults to false. -/// -/// @see gatherExpectations -/// @see raiseException source for an example use case. -public func gatherFailingExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] { - let assertions = gatherExpectations(silently: silently, closure: closure) - return assertions.filter { assertion in - !assertion.success - } -} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift b/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift deleted file mode 100644 index 1c51cd7f..00000000 --- a/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift +++ /dev/null @@ -1,131 +0,0 @@ -import Foundation - -#if _runtime(_ObjC) - -internal struct ObjCMatcherWrapper: Matcher { - let matcher: NMBMatcher - - func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - return matcher.matches( - ({ try! actualExpression.evaluate() }), - failureMessage: failureMessage, - location: actualExpression.location) - } - - func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - return matcher.doesNotMatch( - ({ try! actualExpression.evaluate() }), - failureMessage: failureMessage, - location: actualExpression.location) - } -} - -// Equivalent to Expectation, but for Nimble's Objective-C interface -public class NMBExpectation: NSObject { - internal let _actualBlock: () -> NSObject! - internal var _negative: Bool - internal let _file: FileString - internal let _line: UInt - internal var _timeout: TimeInterval = 1.0 - - public init(actualBlock: @escaping () -> NSObject!, negative: Bool, file: FileString, line: UInt) { - self._actualBlock = actualBlock - self._negative = negative - self._file = file - self._line = line - } - - private var expectValue: Expectation { - return expect(_file, line: _line) { - self._actualBlock() as NSObject? - } - } - - public var withTimeout: (TimeInterval) -> NMBExpectation { - return ({ timeout in self._timeout = timeout - return self - }) - } - - public var to: (NMBMatcher) -> Void { - return ({ matcher in - self.expectValue.to(ObjCMatcherWrapper(matcher: matcher)) - }) - } - - public var toWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in - self.expectValue.to(ObjCMatcherWrapper(matcher: matcher), description: description) - }) - } - - public var toNot: (NMBMatcher) -> Void { - return ({ matcher in - self.expectValue.toNot( - ObjCMatcherWrapper(matcher: matcher) - ) - }) - } - - public var toNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in - self.expectValue.toNot( - ObjCMatcherWrapper(matcher: matcher), description: description - ) - }) - } - - public var notTo: (NMBMatcher) -> Void { return toNot } - - public var notToWithDescription: (NMBMatcher, String) -> Void { return toNotWithDescription } - - public var toEventually: (NMBMatcher) -> Void { - return ({ matcher in - self.expectValue.toEventually( - ObjCMatcherWrapper(matcher: matcher), - timeout: self._timeout, - description: nil - ) - }) - } - - public var toEventuallyWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in - self.expectValue.toEventually( - ObjCMatcherWrapper(matcher: matcher), - timeout: self._timeout, - description: description - ) - }) - } - - public var toEventuallyNot: (NMBMatcher) -> Void { - return ({ matcher in - self.expectValue.toEventuallyNot( - ObjCMatcherWrapper(matcher: matcher), - timeout: self._timeout, - description: nil - ) - }) - } - - public var toEventuallyNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in - self.expectValue.toEventuallyNot( - ObjCMatcherWrapper(matcher: matcher), - timeout: self._timeout, - description: description - ) - }) - } - - public var toNotEventually: (NMBMatcher) -> Void { return toEventuallyNot } - - public var toNotEventuallyWithDescription: (NMBMatcher, String) -> Void { return toEventuallyNotWithDescription } - - public class func failWithMessage(_ message: String, file: FileString, line: UInt) { - fail(message, location: SourceLocation(file: file, line: line)) - } -} - -#endif diff --git a/Pods/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift b/Pods/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift deleted file mode 100644 index 19a4567b..00000000 --- a/Pods/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift +++ /dev/null @@ -1,81 +0,0 @@ -import Foundation - -#if _runtime(_ObjC) - -public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) -> Bool -public typealias FullMatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) -> Bool - -public class NMBObjCMatcher: NSObject, NMBMatcher { - let _match: MatcherBlock - let _doesNotMatch: MatcherBlock - let canMatchNil: Bool - - public init(canMatchNil: Bool, matcher: @escaping MatcherBlock, notMatcher: @escaping MatcherBlock) { - self.canMatchNil = canMatchNil - self._match = matcher - self._doesNotMatch = notMatcher - } - - public convenience init(matcher: @escaping MatcherBlock) { - self.init(canMatchNil: true, matcher: matcher) - } - - public convenience init(canMatchNil: Bool, matcher: @escaping MatcherBlock) { - self.init(canMatchNil: canMatchNil, matcher: matcher, notMatcher: ({ actualExpression, failureMessage in - return !matcher(actualExpression, failureMessage) - })) - } - - public convenience init(matcher: @escaping FullMatcherBlock) { - self.init(canMatchNil: true, matcher: matcher) - } - - public convenience init(canMatchNil: Bool, matcher: @escaping FullMatcherBlock) { - self.init(canMatchNil: canMatchNil, matcher: ({ actualExpression, failureMessage in - return matcher(actualExpression, failureMessage, false) - }), notMatcher: ({ actualExpression, failureMessage in - return matcher(actualExpression, failureMessage, true) - })) - } - - private func canMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - do { - if !canMatchNil { - if try actualExpression.evaluate() == nil { - failureMessage.postfixActual = " (use beNil() to match nils)" - return false - } - } - } catch let error { - failureMessage.actualValue = "an unexpected error thrown: \(error)" - return false - } - return true - } - - public func matches(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - let expr = Expression(expression: actualBlock, location: location) - let result = _match( - expr, - failureMessage) - if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { - return result - } else { - return false - } - } - - public func doesNotMatch(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - let expr = Expression(expression: actualBlock, location: location) - let result = _doesNotMatch( - expr, - failureMessage) - if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { - return result - } else { - return false - } - } -} - -#endif diff --git a/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift b/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift deleted file mode 100644 index a55cb271..00000000 --- a/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift +++ /dev/null @@ -1,45 +0,0 @@ -import Dispatch -import Foundation - -/// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this -/// class' existance -internal class NimbleEnvironment { - static var activeInstance: NimbleEnvironment { - get { - let env = Thread.current.threadDictionary["NimbleEnvironment"] - if let env = env as? NimbleEnvironment { - return env - } else { - let newEnv = NimbleEnvironment() - self.activeInstance = newEnv - return newEnv - } - } - set { - Thread.current.threadDictionary["NimbleEnvironment"] = newValue - } - } - - // TODO: eventually migrate the global to this environment value - var assertionHandler: AssertionHandler { - get { return NimbleAssertionHandler } - set { NimbleAssertionHandler = newValue } - } - - var suppressTVOSAssertionWarning: Bool = false - var awaiter: Awaiter - - init() { - let timeoutQueue: DispatchQueue - if #available(OSX 10.10, *) { - timeoutQueue = DispatchQueue.global(qos: .userInitiated) - } else { - timeoutQueue = DispatchQueue.global(priority: .high) - } - - awaiter = Awaiter( - waitLock: AssertionWaitLock(), - asyncQueue: .main, - timeoutQueue: timeoutQueue) - } -} diff --git a/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift deleted file mode 100644 index 78e6dd92..00000000 --- a/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift +++ /dev/null @@ -1,76 +0,0 @@ -import Foundation -import XCTest - -/// Default handler for Nimble. This assertion handler passes failures along to -/// XCTest. -public class NimbleXCTestHandler: AssertionHandler { - public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { - if !assertion { - recordFailure("\(message.stringValue)\n", location: location) - } - } -} - -/// Alternative handler for Nimble. This assertion handler passes failures along -/// to XCTest by attempting to reduce the failure message size. -public class NimbleShortXCTestHandler: AssertionHandler { - public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { - if !assertion { - let msg: String - if let actual = message.actualValue { - msg = "got: \(actual) \(message.postfixActual)" - } else { - msg = "expected \(message.to) \(message.postfixMessage)" - } - recordFailure("\(msg)\n", location: location) - } - } -} - -/// Fallback handler in case XCTest is unavailable. This assertion handler will abort -/// the program if it is invoked. -class NimbleXCTestUnavailableHandler: AssertionHandler { - func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { - fatalError("XCTest is not available and no custom assertion handler was configured. Aborting.") - } -} - -#if !SWIFT_PACKAGE -/// Helper class providing access to the currently executing XCTestCase instance, if any -@objc final internal class CurrentTestCaseTracker: NSObject, XCTestObservation { - @objc static let sharedInstance = CurrentTestCaseTracker() - - private(set) var currentTestCase: XCTestCase? - - @objc func testCaseWillStart(_ testCase: XCTestCase) { - currentTestCase = testCase - } - - @objc func testCaseDidFinish(_ testCase: XCTestCase) { - currentTestCase = nil - } -} -#endif - -func isXCTestAvailable() -> Bool { -#if _runtime(_ObjC) - // XCTest is weakly linked and so may not be present - return NSClassFromString("XCTestCase") != nil -#else - return true -#endif -} - -private func recordFailure(_ message: String, location: SourceLocation) { -#if SWIFT_PACKAGE - XCTFail("\(message)", file: location.file, line: location.line) -#else - if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase { - testCase.recordFailure(withDescription: message, inFile: location.file, atLine: location.line, expected: true) - } else { - let msg = "Attempted to report a test failure to XCTest while no test case was running. " + - "The failure was:\n\"\(message)\"\nIt occurred at: \(location.file):\(location.line)" - NSException(name: .internalInconsistencyException, reason: msg, userInfo: nil).raise() - } -#endif -} diff --git a/Pods/Nimble/Sources/Nimble/DSL+Wait.swift b/Pods/Nimble/Sources/Nimble/DSL+Wait.swift deleted file mode 100644 index f7f373fe..00000000 --- a/Pods/Nimble/Sources/Nimble/DSL+Wait.swift +++ /dev/null @@ -1,98 +0,0 @@ -import Dispatch -import Foundation - -private enum ErrorResult { - case exception(NSException) - case error(Error) - case none -} - -/// Only classes, protocols, methods, properties, and subscript declarations can be -/// bridges to Objective-C via the @objc keyword. This class encapsulates callback-style -/// asynchronous waiting logic so that it may be called from Objective-C and Swift. -internal class NMBWait: NSObject { - internal class func until( - timeout: TimeInterval, - file: FileString = #file, - line: UInt = #line, - action: @escaping (@escaping () -> Void) -> Void) -> Void { - return throwableUntil(timeout: timeout, file: file, line: line) { done in - action(done) - } - } - - // Using a throwable closure makes this method not objc compatible. - internal class func throwableUntil( - timeout: TimeInterval, - file: FileString = #file, - line: UInt = #line, - action: @escaping (@escaping () -> Void) throws -> Void) -> Void { - let awaiter = NimbleEnvironment.activeInstance.awaiter - let leeway = timeout / 2.0 - let result = awaiter.performBlock { (done: @escaping (ErrorResult) -> Void) throws -> Void in - DispatchQueue.main.async { - let capture = NMBExceptionCapture( - handler: ({ exception in - done(.exception(exception)) - }), - finally: ({ }) - ) - capture.tryBlock { - do { - try action { - done(.none) - } - } catch let e { - done(.error(e)) - } - } - } - }.timeout(timeout, forcefullyAbortTimeout: leeway).wait("waitUntil(...)", file: file, line: line) - - switch result { - case .incomplete: internalError("Reached .incomplete state for waitUntil(...).") - case .blockedRunLoop: - fail(blockedRunLoopErrorMessageFor("-waitUntil()", leeway: leeway), - file: file, line: line) - case .timedOut: - let pluralize = (timeout == 1 ? "" : "s") - fail("Waited more than \(timeout) second\(pluralize)", file: file, line: line) - case let .raisedException(exception): - fail("Unexpected exception raised: \(exception)") - case let .errorThrown(error): - fail("Unexpected error thrown: \(error)") - case .completed(.exception(let exception)): - fail("Unexpected exception raised: \(exception)") - case .completed(.error(let error)): - fail("Unexpected error thrown: \(error)") - case .completed(.none): // success - break - } - } - - #if SWIFT_PACKAGE - internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) -> Void { - until(timeout: 1, file: file, line: line, action: action) - } - #else - @objc(untilFile:line:action:) - internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) -> Void { - until(timeout: 1, file: file, line: line, action: action) - } - #endif -} - -internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: TimeInterval) -> String { - return "\(fnName) timed out but was unable to run the timeout handler because the main thread is unresponsive (\(leeway) seconds is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." -} - -/// Wait asynchronously until the done closure is called or the timeout has been reached. -/// -/// @discussion -/// Call the done() closure to indicate the waiting has completed. -/// -/// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function -/// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. -public func waitUntil(timeout: TimeInterval = 1, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) -> Void { - NMBWait.until(timeout: timeout, file: file, line: line, action: action) -} diff --git a/Pods/Nimble/Sources/Nimble/DSL.swift b/Pods/Nimble/Sources/Nimble/DSL.swift deleted file mode 100644 index 7ebd6842..00000000 --- a/Pods/Nimble/Sources/Nimble/DSL.swift +++ /dev/null @@ -1,64 +0,0 @@ -import Foundation - -/// Make an expectation on a given actual value. The value given is lazily evaluated. -public func expect(_ expression: @autoclosure @escaping () throws -> T?, file: FileString = #file, line: UInt = #line) -> Expectation { - return Expectation( - expression: Expression( - expression: expression, - location: SourceLocation(file: file, line: line), - isClosure: true)) -} - -/// Make an expectation on a given actual value. The closure is lazily invoked. -public func expect(_ file: FileString = #file, line: UInt = #line, expression: @escaping () throws -> T?) -> Expectation { - return Expectation( - expression: Expression( - expression: expression, - location: SourceLocation(file: file, line: line), - isClosure: true)) -} - -/// Always fails the test with a message and a specified location. -public func fail(_ message: String, location: SourceLocation) { - let handler = NimbleEnvironment.activeInstance.assertionHandler - handler.assert(false, message: FailureMessage(stringValue: message), location: location) -} - -/// Always fails the test with a message. -public func fail(_ message: String, file: FileString = #file, line: UInt = #line) { - fail(message, location: SourceLocation(file: file, line: line)) -} - -/// Always fails the test. -public func fail(_ file: FileString = #file, line: UInt = #line) { - fail("fail() always fails", file: file, line: line) -} - -/// Like Swift's precondition(), but raises NSExceptions instead of sigaborts -internal func nimblePrecondition( - _ expr: @autoclosure() -> Bool, - _ name: @autoclosure() -> String, - _ message: @autoclosure() -> String, - file: StaticString = #file, - line: UInt = #line) { - let result = expr() - if !result { -#if _runtime(_ObjC) - let e = NSException( - name: NSExceptionName(name()), - reason: message(), - userInfo: nil) - e.raise() -#else - preconditionFailure("\(name()) - \(message())", file: file, line: line) -#endif - } -} - -internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never { - fatalError( - "Nimble Bug Found: \(msg) at \(file):\(line).\n" + - "Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the " + - "code snippet that caused this error." - ) -} diff --git a/Pods/Nimble/Sources/Nimble/Expectation.swift b/Pods/Nimble/Sources/Nimble/Expectation.swift deleted file mode 100644 index c5978f4f..00000000 --- a/Pods/Nimble/Sources/Nimble/Expectation.swift +++ /dev/null @@ -1,71 +0,0 @@ -import Foundation - -internal func expressionMatches(_ expression: Expression, matcher: U, to: String, description: String?) -> (Bool, FailureMessage) - where U: Matcher, U.ValueType == T { - let msg = FailureMessage() - msg.userDescription = description - msg.to = to - do { - let pass = try matcher.matches(expression, failureMessage: msg) - if msg.actualValue == "" { - msg.actualValue = "<\(stringify(try expression.evaluate()))>" - } - return (pass, msg) - } catch let error { - msg.actualValue = "an unexpected error thrown: <\(error)>" - return (false, msg) - } -} - -internal func expressionDoesNotMatch(_ expression: Expression, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage) - where U: Matcher, U.ValueType == T { - let msg = FailureMessage() - msg.userDescription = description - msg.to = toNot - do { - let pass = try matcher.doesNotMatch(expression, failureMessage: msg) - if msg.actualValue == "" { - msg.actualValue = "<\(stringify(try expression.evaluate()))>" - } - return (pass, msg) - } catch let error { - msg.actualValue = "an unexpected error thrown: <\(error)>" - return (false, msg) - } -} - -public struct Expectation { - - public let expression: Expression - - public func verify(_ pass: Bool, _ message: FailureMessage) { - let handler = NimbleEnvironment.activeInstance.assertionHandler - handler.assert(pass, message: message, location: expression.location) - } - - /// Tests the actual value using a matcher to match. - public func to(_ matcher: U, description: String? = nil) - where U: Matcher, U.ValueType == T { - let (pass, msg) = expressionMatches(expression, matcher: matcher, to: "to", description: description) - verify(pass, msg) - } - - /// Tests the actual value using a matcher to not match. - public func toNot(_ matcher: U, description: String? = nil) - where U: Matcher, U.ValueType == T { - let (pass, msg) = expressionDoesNotMatch(expression, matcher: matcher, toNot: "to not", description: description) - verify(pass, msg) - } - - /// Tests the actual value using a matcher to not match. - /// - /// Alias to toNot(). - public func notTo(_ matcher: U, description: String? = nil) - where U: Matcher, U.ValueType == T { - toNot(matcher, description: description) - } - - // see: - // - AsyncMatcherWrapper for extension - // - NMBExpectation for Objective-C interface -} diff --git a/Pods/Nimble/Sources/Nimble/Expression.swift b/Pods/Nimble/Sources/Nimble/Expression.swift deleted file mode 100644 index f7afffe7..00000000 --- a/Pods/Nimble/Sources/Nimble/Expression.swift +++ /dev/null @@ -1,90 +0,0 @@ -import Foundation - -// Memoizes the given closure, only calling the passed -// closure once; even if repeat calls to the returned closure -internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) throws -> T { - var cache: T? - return ({ withoutCaching in - if withoutCaching || cache == nil { - cache = try closure() - } - return cache! - }) -} - -/// Expression represents the closure of the value inside expect(...). -/// Expressions are memoized by default. This makes them safe to call -/// evaluate() multiple times without causing a re-evaluation of the underlying -/// closure. -/// -/// @warning Since the closure can be any code, Objective-C code may choose -/// to raise an exception. Currently, Expression does not memoize -/// exception raising. -/// -/// This provides a common consumable API for matchers to utilize to allow -/// Nimble to change internals to how the captured closure is managed. -public struct Expression { - internal let _expression: (Bool) throws -> T? - internal let _withoutCaching: Bool - public let location: SourceLocation - public let isClosure: Bool - - /// Creates a new expression struct. Normally, expect(...) will manage this - /// creation process. The expression is memoized. - /// - /// @param expression The closure that produces a given value. - /// @param location The source location that this closure originates from. - /// @param isClosure A bool indicating if the captured expression is a - /// closure or internally produced closure. Some matchers - /// may require closures. For example, toEventually() - /// requires an explicit closure. This gives Nimble - /// flexibility if @autoclosure behavior changes between - /// Swift versions. Nimble internals always sets this true. - public init(expression: @escaping () throws -> T?, location: SourceLocation, isClosure: Bool = true) { - self._expression = memoizedClosure(expression) - self.location = location - self._withoutCaching = false - self.isClosure = isClosure - } - - /// Creates a new expression struct. Normally, expect(...) will manage this - /// creation process. - /// - /// @param expression The closure that produces a given value. - /// @param location The source location that this closure originates from. - /// @param withoutCaching Indicates if the struct should memoize the given - /// closure's result. Subsequent evaluate() calls will - /// not call the given closure if this is true. - /// @param isClosure A bool indicating if the captured expression is a - /// closure or internally produced closure. Some matchers - /// may require closures. For example, toEventually() - /// requires an explicit closure. This gives Nimble - /// flexibility if @autoclosure behavior changes between - /// Swift versions. Nimble internals always sets this true. - public init(memoizedExpression: @escaping (Bool) throws -> T?, location: SourceLocation, withoutCaching: Bool, isClosure: Bool = true) { - self._expression = memoizedExpression - self.location = location - self._withoutCaching = withoutCaching - self.isClosure = isClosure - } - - /// Returns a new Expression from the given expression. Identical to a map() - /// on this type. This should be used only to typecast the Expression's - /// closure value. - /// - /// The returned expression will preserve location and isClosure. - /// - /// @param block The block that can cast the current Expression value to a - /// new type. - public func cast(_ block: @escaping (T?) throws -> U?) -> Expression { - return Expression(expression: ({ try block(self.evaluate()) }), location: self.location, isClosure: self.isClosure) - } - - public func evaluate() throws -> T? { - return try self._expression(_withoutCaching) - } - - public func withoutCaching() -> Expression { - return Expression(memoizedExpression: self._expression, location: location, withoutCaching: true, isClosure: isClosure) - } -} diff --git a/Pods/Nimble/Sources/Nimble/FailureMessage.swift b/Pods/Nimble/Sources/Nimble/FailureMessage.swift deleted file mode 100644 index 24b6c8fd..00000000 --- a/Pods/Nimble/Sources/Nimble/FailureMessage.swift +++ /dev/null @@ -1,65 +0,0 @@ -import Foundation - -/// Encapsulates the failure message that matchers can report to the end user. -/// -/// This is shared state between Nimble and matchers that mutate this value. -public class FailureMessage: NSObject { - public var expected: String = "expected" - public var actualValue: String? = "" // empty string -> use default; nil -> exclude - public var to: String = "to" - public var postfixMessage: String = "match" - public var postfixActual: String = "" - /// An optional message that will be appended as a new line and provides additional details - /// about the failure. This message will only be visible in the issue navigator / in logs but - /// not directly in the source editor since only a single line is presented there. - public var extendedMessage: String? = nil - public var userDescription: String? = nil - - public var stringValue: String { - get { - if let value = _stringValueOverride { - return value - } else { - return computeStringValue() - } - } - set { - _stringValueOverride = newValue - } - } - - internal var _stringValueOverride: String? - - public override init() { - } - - public init(stringValue: String) { - _stringValueOverride = stringValue - } - - internal func stripNewlines(_ str: String) -> String { - let whitespaces = CharacterSet.whitespacesAndNewlines - return str - .components(separatedBy: "\n") - .map { line in line.trimmingCharacters(in: whitespaces) } - .joined(separator: "") - } - - internal func computeStringValue() -> String { - var value = "\(expected) \(to) \(postfixMessage)" - if let actualValue = actualValue { - value = "\(expected) \(to) \(postfixMessage), got \(actualValue)\(postfixActual)" - } - value = stripNewlines(value) - - if let extendedMessage = extendedMessage { - value += "\n\(stripNewlines(extendedMessage))" - } - - if let userDescription = userDescription { - return "\(userDescription)\n\(value)" - } - - return value - } -} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift b/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift deleted file mode 100644 index 73e79d37..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift +++ /dev/null @@ -1,94 +0,0 @@ -import Foundation - -public func allPass - (_ passFunc: @escaping (T?) -> Bool) -> NonNilMatcherFunc - where U: Sequence, U.Iterator.Element == T { - return allPass("pass a condition", passFunc) -} - -public func allPass - (_ passName: String, _ passFunc: @escaping (T?) -> Bool) -> NonNilMatcherFunc - where U: Sequence, U.Iterator.Element == T { - return createAllPassMatcher { expression, failureMessage in - failureMessage.postfixMessage = passName - return passFunc(try expression.evaluate()) - } -} - -public func allPass - (_ matcher: V) -> NonNilMatcherFunc - where U: Sequence, V: Matcher, U.Iterator.Element == V.ValueType { - return createAllPassMatcher { - try matcher.matches($0, failureMessage: $1) - } -} - -private func createAllPassMatcher - (_ elementEvaluator: @escaping (Expression, FailureMessage) throws -> Bool) -> NonNilMatcherFunc - where U: Sequence, U.Iterator.Element == T { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.actualValue = nil - if let actualValue = try actualExpression.evaluate() { - for currentElement in actualValue { - let exp = Expression( - expression: {currentElement}, location: actualExpression.location) - if try !elementEvaluator(exp, failureMessage) { - failureMessage.postfixMessage = - "all \(failureMessage.postfixMessage)," - + " but failed first at element <\(stringify(currentElement))>" - + " in <\(stringify(actualValue))>" - return false - } - } - failureMessage.postfixMessage = "all \(failureMessage.postfixMessage)" - } else { - failureMessage.postfixMessage = "all pass (use beNil() to match nils)" - return false - } - - return true - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func allPassMatcher(_ matcher: NMBObjCMatcher) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() - var nsObjects = [NSObject]() - - var collectionIsUsable = true - if let value = actualValue as? NSFastEnumeration { - let generator = NSFastEnumerationIterator(value) - while let obj = generator.next() { - if let nsObject = obj as? NSObject { - nsObjects.append(nsObject) - } else { - collectionIsUsable = false - break - } - } - } else { - collectionIsUsable = false - } - - if !collectionIsUsable { - failureMessage.postfixMessage = - "allPass only works with NSFastEnumeration (NSArray, NSSet, ...) of NSObjects" - failureMessage.expected = "" - failureMessage.to = "" - return false - } - - let expr = Expression(expression: ({ nsObjects }), location: location) - let elementEvaluator: (Expression, FailureMessage) -> Bool = { - expression, failureMessage in - return matcher.matches({try! expression.evaluate()}, failureMessage: failureMessage, location: expr.location) - } - return try! createAllPassMatcher(elementEvaluator).matches( - expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift b/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift deleted file mode 100644 index b971ccc1..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift +++ /dev/null @@ -1,141 +0,0 @@ -import Foundation - -/// If you are running on a slower machine, it could be useful to increase the default timeout value -/// or slow down poll interval. Default timeout interval is 1, and poll interval is 0.01. -public struct AsyncDefaults { - public static var Timeout: TimeInterval = 1 - public static var PollInterval: TimeInterval = 0.01 -} - -internal struct AsyncMatcherWrapper: Matcher - where U: Matcher, U.ValueType == T { - let fullMatcher: U - let timeoutInterval: TimeInterval - let pollInterval: TimeInterval - - init(fullMatcher: U, timeoutInterval: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval) { - self.fullMatcher = fullMatcher - self.timeoutInterval = timeoutInterval - self.pollInterval = pollInterval - } - - func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - let uncachedExpression = actualExpression.withoutCaching() - let fnName = "expect(...).toEventually(...)" - let result = pollBlock( - pollInterval: pollInterval, - timeoutInterval: timeoutInterval, - file: actualExpression.location.file, - line: actualExpression.location.line, - fnName: fnName) { - try self.fullMatcher.matches(uncachedExpression, failureMessage: failureMessage) - } - switch result { - case let .completed(isSuccessful): return isSuccessful - case .timedOut: return false - case let .errorThrown(error): - failureMessage.actualValue = "an unexpected error thrown: <\(error)>" - return false - case let .raisedException(exception): - failureMessage.actualValue = "an unexpected exception thrown: <\(exception)>" - return false - case .blockedRunLoop: - failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." - return false - case .incomplete: - internalError("Reached .incomplete state for toEventually(...).") - } - } - - func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - let uncachedExpression = actualExpression.withoutCaching() - let result = pollBlock( - pollInterval: pollInterval, - timeoutInterval: timeoutInterval, - file: actualExpression.location.file, - line: actualExpression.location.line, - fnName: "expect(...).toEventuallyNot(...)") { - try self.fullMatcher.doesNotMatch(uncachedExpression, failureMessage: failureMessage) - } - switch result { - case let .completed(isSuccessful): return isSuccessful - case .timedOut: return false - case let .errorThrown(error): - failureMessage.actualValue = "an unexpected error thrown: <\(error)>" - return false - case let .raisedException(exception): - failureMessage.actualValue = "an unexpected exception thrown: <\(exception)>" - return false - case .blockedRunLoop: - failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." - return false - case .incomplete: - internalError("Reached .incomplete state for toEventuallyNot(...).") - } - } -} - -private let toEventuallyRequiresClosureError = FailureMessage(stringValue: "expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) )\nSwift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function") - -extension Expectation { - /// Tests the actual value using a matcher to match by checking continuously - /// at each pollInterval until the timeout is reached. - /// - /// @discussion - /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function - /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) - where U: Matcher, U.ValueType == T { - if expression.isClosure { - let (pass, msg) = expressionMatches( - expression, - matcher: AsyncMatcherWrapper( - fullMatcher: matcher, - timeoutInterval: timeout, - pollInterval: pollInterval), - to: "to eventually", - description: description - ) - verify(pass, msg) - } else { - verify(false, toEventuallyRequiresClosureError) - } - } - - /// Tests the actual value using a matcher to not match by checking - /// continuously at each pollInterval until the timeout is reached. - /// - /// @discussion - /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function - /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventuallyNot(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) - where U: Matcher, U.ValueType == T { - if expression.isClosure { - let (pass, msg) = expressionDoesNotMatch( - expression, - matcher: AsyncMatcherWrapper( - fullMatcher: matcher, - timeoutInterval: timeout, - pollInterval: pollInterval), - toNot: "to eventually not", - description: description - ) - verify(pass, msg) - } else { - verify(false, toEventuallyRequiresClosureError) - } - } - - /// Tests the actual value using a matcher to not match by checking - /// continuously at each pollInterval until the timeout is reached. - /// - /// Alias of toEventuallyNot() - /// - /// @discussion - /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function - /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toNotEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) - where U: Matcher, U.ValueType == T { - return toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) - } -} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift deleted file mode 100644 index f636a72f..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift +++ /dev/null @@ -1,48 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is an instance of the given class. -public func beAKindOf(_ expectedType: T.Type) -> NonNilMatcherFunc { - return NonNilMatcherFunc {actualExpression, failureMessage in - failureMessage.postfixMessage = "be a kind of \(String(describing: expectedType))" - let instance = try actualExpression.evaluate() - guard let validInstance = instance else { - failureMessage.actualValue = "" - return false - } - - failureMessage.actualValue = "<\(String(describing: type(of: validInstance))) instance>" - - guard validInstance is T else { - return false - } - - return true - } -} - -#if _runtime(_ObjC) - -/// A Nimble matcher that succeeds when the actual value is an instance of the given class. -/// @see beAnInstanceOf if you want to match against the exact class -public func beAKindOf(_ expectedClass: AnyClass) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - let instance = try actualExpression.evaluate() - if let validInstance = instance { - failureMessage.actualValue = "<\(String(describing: type(of: validInstance))) instance>" - } else { - failureMessage.actualValue = "" - } - failureMessage.postfixMessage = "be a kind of \(String(describing: expectedClass))" - return instance != nil && instance!.isKind(of: expectedClass) - } -} - -extension NMBObjCMatcher { - public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! beAKindOf(expected).matches(actualExpression, failureMessage: failureMessage) - } - } -} - -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift deleted file mode 100644 index 07ce3d35..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift +++ /dev/null @@ -1,50 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is an _exact_ instance of the given class. -public func beAnInstanceOf(_ expectedType: T.Type) -> NonNilMatcherFunc { - return NonNilMatcherFunc {actualExpression, failureMessage in - failureMessage.postfixMessage = "be an instance of \(String(describing: expectedType))" - let instance = try actualExpression.evaluate() - guard let validInstance = instance else { - failureMessage.actualValue = "" - return false - } - - failureMessage.actualValue = "<\(String(describing: type(of: validInstance))) instance>" - - if type(of: validInstance) == expectedType { - return true - } - - return false - } -} - -/// A Nimble matcher that succeeds when the actual value is an instance of the given class. -/// @see beAKindOf if you want to match against subclasses -public func beAnInstanceOf(_ expectedClass: AnyClass) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - let instance = try actualExpression.evaluate() - if let validInstance = instance { - failureMessage.actualValue = "<\(String(describing: type(of: validInstance))) instance>" - } else { - failureMessage.actualValue = "" - } - failureMessage.postfixMessage = "be an instance of \(String(describing: expectedClass))" -#if _runtime(_ObjC) - return instance != nil && instance!.isMember(of: expectedClass) -#else - return instance != nil && type(of: instance!) == expectedClass -#endif - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! beAnInstanceOf(expected).matches(actualExpression, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift deleted file mode 100644 index 95c52cfe..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift +++ /dev/null @@ -1,122 +0,0 @@ -import Foundation - -internal let DefaultDelta = 0.0001 - -internal func isCloseTo(_ actualValue: NMBDoubleConvertible?, expectedValue: NMBDoubleConvertible, delta: Double, failureMessage: FailureMessage) -> Bool { - failureMessage.postfixMessage = "be close to <\(stringify(expectedValue))> (within \(stringify(delta)))" - failureMessage.actualValue = "<\(stringify(actualValue))>" - return actualValue != nil && abs(actualValue!.doubleValue - expectedValue.doubleValue) < delta -} - -/// A Nimble matcher that succeeds when a value is close to another. This is used for floating -/// point values which can have imprecise results when doing arithmetic on them. -/// -/// @see equal -public func beCloseTo(_ expectedValue: Double, within delta: Double = DefaultDelta) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta, failureMessage: failureMessage) - } -} - -/// A Nimble matcher that succeeds when a value is close to another. This is used for floating -/// point values which can have imprecise results when doing arithmetic on them. -/// -/// @see equal -public func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Double = DefaultDelta) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta, failureMessage: failureMessage) - } -} - -#if _runtime(_ObjC) -public class NMBObjCBeCloseToMatcher: NSObject, NMBMatcher { - var _expected: NSNumber - var _delta: CDouble - init(expected: NSNumber, within: CDouble) { - _expected = expected - _delta = within - } - - public func matches(_ actualExpression: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - let actualBlock: () -> NMBDoubleConvertible? = ({ - return actualExpression() as? NMBDoubleConvertible - }) - let expr = Expression(expression: actualBlock, location: location) - let matcher = beCloseTo(self._expected, within: self._delta) - return try! matcher.matches(expr, failureMessage: failureMessage) - } - - public func doesNotMatch(_ actualExpression: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - let actualBlock: () -> NMBDoubleConvertible? = ({ - return actualExpression() as? NMBDoubleConvertible - }) - let expr = Expression(expression: actualBlock, location: location) - let matcher = beCloseTo(self._expected, within: self._delta) - return try! matcher.doesNotMatch(expr, failureMessage: failureMessage) - } - - public var within: (CDouble) -> NMBObjCBeCloseToMatcher { - return ({ delta in - return NMBObjCBeCloseToMatcher(expected: self._expected, within: delta) - }) - } -} - -extension NMBObjCMatcher { - public class func beCloseToMatcher(_ expected: NSNumber, within: CDouble) -> NMBObjCBeCloseToMatcher { - return NMBObjCBeCloseToMatcher(expected: expected, within: within) - } -} -#endif - -public func beCloseTo(_ expectedValues: [Double], within delta: Double = DefaultDelta) -> NonNilMatcherFunc <[Double]> { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be close to <\(stringify(expectedValues))> (each within \(stringify(delta)))" - if let actual = try actualExpression.evaluate() { - failureMessage.actualValue = "<\(stringify(actual))>" - - if actual.count != expectedValues.count { - return false - } else { - for (index, actualItem) in actual.enumerated() { - if fabs(actualItem - expectedValues[index]) > delta { - return false - } - } - return true - } - } - return false - } -} - -// MARK: - Operators - -infix operator ≈ : ComparisonPrecedence - -public func ≈(lhs: Expectation<[Double]>, rhs: [Double]) { - lhs.to(beCloseTo(rhs)) -} - -public func ≈(lhs: Expectation, rhs: NMBDoubleConvertible) { - lhs.to(beCloseTo(rhs)) -} - -public func ≈(lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { - lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) -} - -public func == (lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { - lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) -} - -// make this higher precedence than exponents so the Doubles either end aren't pulled in -// unexpectantly -precedencegroup PlusMinusOperatorPrecedence { - higherThan: BitwiseShiftPrecedence -} - -infix operator ± : PlusMinusOperatorPrecedence -public func ±(lhs: NMBDoubleConvertible, rhs: Double) -> (expected: NMBDoubleConvertible, delta: Double) { - return (expected: lhs, delta: rhs) -} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift deleted file mode 100644 index 2ea2cdb0..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift +++ /dev/null @@ -1,91 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For strings, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actualSeq = try actualExpression.evaluate() - if actualSeq == nil { - return true - } - var generator = actualSeq!.makeIterator() - return generator.next() == nil - } -} - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For strings, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actualString = try actualExpression.evaluate() - return actualString == nil || NSString(string: actualString!).length == 0 - } -} - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For NSString instances, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actualString = try actualExpression.evaluate() - return actualString == nil || actualString!.length == 0 - } -} - -// Without specific overrides, beEmpty() is ambiguous for NSDictionary, NSArray, -// etc, since they conform to Sequence as well as NMBCollection. - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For strings, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actualDictionary = try actualExpression.evaluate() - return actualDictionary == nil || actualDictionary!.count == 0 - } -} - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For strings, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actualArray = try actualExpression.evaluate() - return actualArray == nil || actualArray!.count == 0 - } -} - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For strings, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actual = try actualExpression.evaluate() - return actual == nil || actual!.count == 0 - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beEmptyMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() - failureMessage.postfixMessage = "be empty" - if let value = actualValue as? NMBCollection { - let expr = Expression(expression: ({ value as NMBCollection }), location: location) - return try! beEmpty().matches(expr, failureMessage: failureMessage) - } else if let value = actualValue as? NSString { - let expr = Expression(expression: ({ value as String }), location: location) - return try! beEmpty().matches(expr, failureMessage: failureMessage) - } else if let actualValue = actualValue { - failureMessage.postfixMessage = "be empty (only works for NSArrays, NSSets, NSIndexSets, NSDictionaries, NSHashTables, and NSStrings)" - failureMessage.actualValue = "\(String(describing: type(of: actualValue))) type" - } - return false - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift deleted file mode 100644 index c7eb84cd..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift +++ /dev/null @@ -1,41 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is greater than the expected value. -public func beGreaterThan(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>" - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual > expected - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual value is greater than the expected value. -public func beGreaterThan(_ expectedValue: NMBComparable?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedDescending - return matches - } -} - -public func >(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThan(rhs)) -} - -public func > (lhs: Expectation, rhs: NMBComparable?) { - lhs.to(beGreaterThan(rhs)) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beGreaterThan(expected).matches(expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift deleted file mode 100644 index 2949fcea..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift +++ /dev/null @@ -1,44 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is greater than -/// or equal to the expected value. -public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - if let actual = actualValue, let expected = expectedValue { - return actual >= expected - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual value is greater than -/// or equal to the expected value. -public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending - return matches - } -} - -public func >=(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThanOrEqualTo(rhs)) -} - -public func >=(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThanOrEqualTo(rhs)) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift deleted file mode 100644 index 8df7e5ff..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift +++ /dev/null @@ -1,46 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is the same instance -/// as the expected instance. -public func beIdenticalTo(_ expected: Any?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - #if os(Linux) - let actual = try actualExpression.evaluate() as? AnyObject - #else - let actual = try actualExpression.evaluate() as AnyObject? - #endif - failureMessage.actualValue = "\(identityAsString(actual))" - failureMessage.postfixMessage = "be identical to \(identityAsString(expected))" - #if os(Linux) - return actual === (expected as? AnyObject) && actual !== nil - #else - return actual === (expected as AnyObject?) && actual !== nil - #endif - } -} - -public func === (lhs: Expectation, rhs: Any?) { - lhs.to(beIdenticalTo(rhs)) -} -public func !== (lhs: Expectation, rhs: Any?) { - lhs.toNot(beIdenticalTo(rhs)) -} - -/// A Nimble matcher that succeeds when the actual value is the same instance -/// as the expected instance. -/// -/// Alias for "beIdenticalTo". -public func be(_ expected: Any?) -> NonNilMatcherFunc { - return beIdenticalTo(expected) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let aExpr = actualExpression.cast { $0 as Any? } - return try! beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift deleted file mode 100644 index 5bbbf365..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift +++ /dev/null @@ -1,41 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is less than the expected value. -public func beLessThan(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual < expected - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual value is less than the expected value. -public func beLessThan(_ expectedValue: NMBComparable?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedAscending - return matches - } -} - -public func <(lhs: Expectation, rhs: T) { - lhs.to(beLessThan(rhs)) -} - -public func < (lhs: Expectation, rhs: NMBComparable?) { - lhs.to(beLessThan(rhs)) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beLessThan(expected).matches(expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift deleted file mode 100644 index a0cd2f01..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift +++ /dev/null @@ -1,42 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is less than -/// or equal to the expected value. -public func beLessThanOrEqualTo(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual <= expected - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual value is less than -/// or equal to the expected value. -public func beLessThanOrEqualTo(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - return actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedDescending - } -} - -public func <=(lhs: Expectation, rhs: T) { - lhs.to(beLessThanOrEqualTo(rhs)) -} - -public func <=(lhs: Expectation, rhs: T) { - lhs.to(beLessThanOrEqualTo(rhs)) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil:false) { actualExpression, failureMessage in - let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift deleted file mode 100644 index 49272a37..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift +++ /dev/null @@ -1,173 +0,0 @@ -import Foundation - -extension Int8: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).int8Value - } -} - -extension UInt8: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).uint8Value - } -} - -extension Int16: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).int16Value - } -} - -extension UInt16: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).uint16Value - } -} - -extension Int32: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).int32Value - } -} - -extension UInt32: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).uint32Value - } -} - -extension Int64: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).int64Value - } -} - -extension UInt64: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).uint64Value - } -} - -extension Float: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).floatValue - } -} - -extension Double: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).doubleValue - } -} - -extension Int: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).intValue - } -} - -extension UInt: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).uintValue - } -} - -internal func matcherWithFailureMessage(_ matcher: NonNilMatcherFunc, postprocessor: @escaping (FailureMessage) -> Void) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - defer { postprocessor(failureMessage) } - return try matcher.matcher(actualExpression, failureMessage) - } -} - -// MARK: beTrue() / beFalse() - -/// A Nimble matcher that succeeds when the actual value is exactly true. -/// This matcher will not match against nils. -public func beTrue() -> NonNilMatcherFunc { - return matcherWithFailureMessage(equal(true)) { failureMessage in - failureMessage.postfixMessage = "be true" - } -} - -/// A Nimble matcher that succeeds when the actual value is exactly false. -/// This matcher will not match against nils. -public func beFalse() -> NonNilMatcherFunc { - return matcherWithFailureMessage(equal(false)) { failureMessage in - failureMessage.postfixMessage = "be false" - } -} - -// MARK: beTruthy() / beFalsy() - -/// A Nimble matcher that succeeds when the actual value is not logically false. -public func beTruthy() -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be truthy" - let actualValue = try actualExpression.evaluate() - if let actualValue = actualValue { - // FIXME: This is a workaround to SR-2290. - // See: - // - https://bugs.swift.org/browse/SR-2290 - // - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873 - if let number = actualValue as? NSNumber { - return number.boolValue == true - } - - return actualValue == (true as T) - } - return actualValue != nil - } -} - -/// A Nimble matcher that succeeds when the actual value is logically false. -/// This matcher will match against nils. -public func beFalsy() -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be falsy" - let actualValue = try actualExpression.evaluate() - if let actualValue = actualValue { - // FIXME: This is a workaround to SR-2290. - // See: - // - https://bugs.swift.org/browse/SR-2290 - // - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873 - if let number = actualValue as? NSNumber { - return number.boolValue == false - } - - return actualValue == (false as T) - } - return actualValue == nil - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beTruthyMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beTruthy().matches(expr, failureMessage: failureMessage) - } - } - - public class func beFalsyMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beFalsy().matches(expr, failureMessage: failureMessage) - } - } - - public class func beTrueMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beTrue().matches(expr, failureMessage: failureMessage) - } - } - - public class func beFalseMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false } - return try! beFalse().matches(expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift deleted file mode 100644 index a6fb31fa..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift +++ /dev/null @@ -1,20 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is nil. -public func beNil() -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be nil" - let actualValue = try actualExpression.evaluate() - return actualValue == nil - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beNilMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - return try! beNil().matches(actualExpression, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift deleted file mode 100644 index 92a8d432..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is Void. -public func beVoid() -> MatcherFunc<()> { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be void" - let actualValue: ()? = try actualExpression.evaluate() - return actualValue != nil - } -} - -public func == (lhs: Expectation<()>, rhs: ()) { - lhs.to(beVoid()) -} - -public func != (lhs: Expectation<()>, rhs: ()) { - lhs.toNot(beVoid()) -} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift b/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift deleted file mode 100644 index 31cbe5df..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift +++ /dev/null @@ -1,63 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual sequence's first element -/// is equal to the expected value. -public func beginWith(_ startingElement: T) -> NonNilMatcherFunc - where S.Iterator.Element == T { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "begin with <\(startingElement)>" - if let actualValue = try actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - return actualGenerator.next() == startingElement - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual collection's first element -/// is equal to the expected object. -public func beginWith(_ startingElement: Any) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "begin with <\(startingElement)>" - guard let collection = try actualExpression.evaluate() else { return false } - guard collection.count > 0 else { return false } - #if os(Linux) - guard let collectionValue = collection.object(at: 0) as? NSObject else { - return false - } - #else - let collectionValue = collection.object(at: 0) as AnyObject - #endif - return collectionValue.isEqual(startingElement) - } -} - -/// A Nimble matcher that succeeds when the actual string contains expected substring -/// where the expected substring's location is zero. -public func beginWith(_ startingSubstring: String) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "begin with <\(startingSubstring)>" - if let actual = try actualExpression.evaluate() { - let range = actual.range(of: startingSubstring) - return range != nil && range!.lowerBound == actual.startIndex - } - return false - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beginWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = try! actualExpression.evaluate() - if let _ = actual as? String { - let expr = actualExpression.cast { $0 as? String } - return try! beginWith(expected as! String).matches(expr, failureMessage: failureMessage) - } else { - let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try! beginWith(expected).matches(expr, failureMessage: failureMessage) - } - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift b/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift deleted file mode 100644 index 50536422..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift +++ /dev/null @@ -1,94 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual sequence contains the expected value. -public func contain(_ items: T...) -> NonNilMatcherFunc - where S.Iterator.Element == T { - return contain(items) -} - -public func contain(_ items: [T]) -> NonNilMatcherFunc - where S.Iterator.Element == T { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" - if let actual = try actualExpression.evaluate() { - return items.all { - return actual.contains($0) - } - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual string contains the expected substring. -public func contain(_ substrings: String...) -> NonNilMatcherFunc { - return contain(substrings) -} - -public func contain(_ substrings: [String]) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" - if let actual = try actualExpression.evaluate() { - return substrings.all { - let range = actual.range(of: $0) - return range != nil && !range!.isEmpty - } - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual string contains the expected substring. -public func contain(_ substrings: NSString...) -> NonNilMatcherFunc { - return contain(substrings) -} - -public func contain(_ substrings: [NSString]) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" - if let actual = try actualExpression.evaluate() { - return substrings.all { actual.range(of: $0.description).length != 0 } - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual collection contains the expected object. -public func contain(_ items: Any?...) -> NonNilMatcherFunc { - return contain(items) -} - -public func contain(_ items: [Any?]) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" - guard let actual = try actualExpression.evaluate() else { return false } - return items.all { item in - return item != nil && actual.contains(item!) - } - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func containMatcher(_ expected: [NSObject]) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() - if let value = actualValue as? NMBContainer { - let expr = Expression(expression: ({ value as NMBContainer }), location: location) - - // A straightforward cast on the array causes this to crash, so we have to cast the individual items - let expectedOptionals: [Any?] = expected.map({ $0 as Any? }) - return try! contain(expectedOptionals).matches(expr, failureMessage: failureMessage) - } else if let value = actualValue as? NSString { - let expr = Expression(expression: ({ value as String }), location: location) - return try! contain(expected as! [String]).matches(expr, failureMessage: failureMessage) - } else if actualValue != nil { - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" - } else { - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))>" - } - return false - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift b/Pods/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift deleted file mode 100644 index ae8cca22..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/ContainElementSatisfying.swift +++ /dev/null @@ -1,59 +0,0 @@ -import Foundation - -public func containElementSatisfying(_ predicate: @escaping ((T) -> Bool), _ predicateDescription: String = "") -> NonNilMatcherFunc where S.Iterator.Element == T { - - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.actualValue = nil - - if predicateDescription == "" { - failureMessage.postfixMessage = "find object in collection that satisfies predicate" - } else { - failureMessage.postfixMessage = "find object in collection \(predicateDescription)" - } - - if let sequence = try actualExpression.evaluate() { - for object in sequence { - if predicate(object) { - return true - } - } - - return false - } - - return false - } -} - -#if _runtime(_ObjC) - extension NMBObjCMatcher { - public class func containElementSatisfyingMatcher(_ predicate: @escaping ((NSObject) -> Bool)) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let value = try! actualExpression.evaluate() - guard let enumeration = value as? NSFastEnumeration else { - failureMessage.postfixMessage = "containElementSatisfying must be provided an NSFastEnumeration object" - failureMessage.actualValue = nil - failureMessage.expected = "" - failureMessage.to = "" - return false - } - - let iterator = NSFastEnumerationIterator(enumeration) - while let item = iterator.next() { - guard let object = item as? NSObject else { - continue - } - - if predicate(object) { - return true - } - } - - failureMessage.actualValue = nil - failureMessage.postfixMessage = "" - failureMessage.to = "to find object in collection that satisfies predicate" - return false - } - } - } -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift b/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift deleted file mode 100644 index 00c7e202..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift +++ /dev/null @@ -1,72 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual sequence's last element -/// is equal to the expected value. -public func endWith(_ endingElement: T) -> NonNilMatcherFunc - where S.Iterator.Element == T { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingElement)>" - - if let actualValue = try actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - var lastItem: T? - var item: T? - repeat { - lastItem = item - item = actualGenerator.next() - } while(item != nil) - - return lastItem == endingElement - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual collection's last element -/// is equal to the expected object. -public func endWith(_ endingElement: Any) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingElement)>" - guard let collection = try actualExpression.evaluate() else { return false } - guard collection.count > 0 else { return false } - #if os(Linux) - guard let collectionValue = collection.object(at: collection.count - 1) as? NSObject else { - return false - } - #else - let collectionValue = collection.object(at: collection.count - 1) as AnyObject - #endif - - return collectionValue.isEqual(endingElement) - } -} - -/// A Nimble matcher that succeeds when the actual string contains the expected substring -/// where the expected substring's location is the actual string's length minus the -/// expected substring's length. -public func endWith(_ endingSubstring: String) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingSubstring)>" - if let collection = try actualExpression.evaluate() { - return collection.hasSuffix(endingSubstring) - } - return false - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func endWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = try! actualExpression.evaluate() - if let _ = actual as? String { - let expr = actualExpression.cast { $0 as? String } - return try! endWith(expected as! String).matches(expr, failureMessage: failureMessage) - } else { - let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try! endWith(expected).matches(expr, failureMessage: failureMessage) - } - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift b/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift deleted file mode 100644 index 1dccfd02..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift +++ /dev/null @@ -1,181 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is equal to the expected value. -/// Values can support equal by supporting the Equatable protocol. -/// -/// @see beCloseTo if you want to match imprecise types (eg - floats, doubles). -public func equal(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - let matches = actualValue == expectedValue && expectedValue != nil - if expectedValue == nil || actualValue == nil { - if expectedValue == nil { - failureMessage.postfixActual = " (use beNil() to match nils)" - } - return false - } - return matches - } -} - -/// A Nimble matcher that succeeds when the actual value is equal to the expected value. -/// Values can support equal by supporting the Equatable protocol. -/// -/// @see beCloseTo if you want to match imprecise types (eg - floats, doubles). -public func equal(_ expectedValue: [T: C]?) -> NonNilMatcherFunc<[T: C]> { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil { - failureMessage.postfixActual = " (use beNil() to match nils)" - } - return false - } - return expectedValue! == actualValue! - } -} - -/// A Nimble matcher that succeeds when the actual collection is equal to the expected collection. -/// Items must implement the Equatable protocol. -public func equal(_ expectedValue: [T]?) -> NonNilMatcherFunc<[T]> { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil { - failureMessage.postfixActual = " (use beNil() to match nils)" - } - return false - } - return expectedValue! == actualValue! - } -} - -/// A Nimble matcher allowing comparison of collection with optional type -public func equal(_ expectedValue: [T?]) -> NonNilMatcherFunc<[T?]> { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" - if let actualValue = try actualExpression.evaluate() { - if expectedValue.count != actualValue.count { - return false - } - - for (index, item) in actualValue.enumerated() { - let otherItem = expectedValue[index] - if item == nil && otherItem == nil { - continue - } else if item == nil && otherItem != nil { - return false - } else if item != nil && otherItem == nil { - return false - } else if item! != otherItem! { - return false - } - } - - return true - } else { - failureMessage.postfixActual = " (use beNil() to match nils)" - } - - return false - } -} - -/// A Nimble matcher that succeeds when the actual set is equal to the expected set. -public func equal(_ expectedValue: Set?) -> NonNilMatcherFunc> { - return equal(expectedValue, stringify: { stringify($0) }) -} - -/// A Nimble matcher that succeeds when the actual set is equal to the expected set. -public func equal(_ expectedValue: Set?) -> NonNilMatcherFunc> { - return equal(expectedValue, stringify: { - if let set = $0 { - return stringify(Array(set).sorted { $0 < $1 }) - } else { - return "nil" - } - }) -} - -private func equal(_ expectedValue: Set?, stringify: @escaping (Set?) -> String) -> NonNilMatcherFunc> { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" - - if let expectedValue = expectedValue { - if let actualValue = try actualExpression.evaluate() { - failureMessage.actualValue = "<\(stringify(actualValue))>" - - if expectedValue == actualValue { - return true - } - - let missing = expectedValue.subtracting(actualValue) - if missing.count > 0 { - failureMessage.postfixActual += ", missing <\(stringify(missing))>" - } - - let extra = actualValue.subtracting(expectedValue) - if extra.count > 0 { - failureMessage.postfixActual += ", extra <\(stringify(extra))>" - } - } - } else { - failureMessage.postfixActual = " (use beNil() to match nils)" - } - - return false - } -} - -public func ==(lhs: Expectation, rhs: T?) { - lhs.to(equal(rhs)) -} - -public func !=(lhs: Expectation, rhs: T?) { - lhs.toNot(equal(rhs)) -} - -public func ==(lhs: Expectation<[T]>, rhs: [T]?) { - lhs.to(equal(rhs)) -} - -public func !=(lhs: Expectation<[T]>, rhs: [T]?) { - lhs.toNot(equal(rhs)) -} - -public func == (lhs: Expectation>, rhs: Set?) { - lhs.to(equal(rhs)) -} - -public func != (lhs: Expectation>, rhs: Set?) { - lhs.toNot(equal(rhs)) -} - -public func ==(lhs: Expectation>, rhs: Set?) { - lhs.to(equal(rhs)) -} - -public func !=(lhs: Expectation>, rhs: Set?) { - lhs.toNot(equal(rhs)) -} - -public func ==(lhs: Expectation<[T: C]>, rhs: [T: C]?) { - lhs.to(equal(rhs)) -} - -public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) { - lhs.toNot(equal(rhs)) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func equalMatcher(_ expected: NSObject) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! equal(expected).matches(actualExpression, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift b/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift deleted file mode 100644 index 5b24af29..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift +++ /dev/null @@ -1,57 +0,0 @@ -import Foundation - -// The `haveCount` matchers do not print the full string representation of the collection value, -// instead they only print the type name and the expected count. This makes it easier to understand -// the reason for failed expectations. See: https://github.com/Quick/Nimble/issues/308. -// The representation of the collection content is provided in a new line as an `extendedMessage`. - -/// A Nimble matcher that succeeds when the actual Collection's count equals -/// the expected value -public func haveCount(_ expectedValue: T.IndexDistance) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - if let actualValue = try actualExpression.evaluate() { - failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))" - let result = expectedValue == actualValue.count - failureMessage.actualValue = "\(actualValue.count)" - failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))" - return result - } else { - return false - } - } -} - -/// A Nimble matcher that succeeds when the actual collection's count equals -/// the expected value -public func haveCount(_ expectedValue: Int) -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - if let actualValue = try actualExpression.evaluate() { - failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))" - let result = expectedValue == actualValue.count - failureMessage.actualValue = "\(actualValue.count)" - failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))" - return result - } else { - return false - } - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func haveCountMatcher(_ expected: NSNumber) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() - if let value = actualValue as? NMBCollection { - let expr = Expression(expression: ({ value as NMBCollection}), location: location) - return try! haveCount(expected.intValue).matches(expr, failureMessage: failureMessage) - } else if let actualValue = actualValue { - failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable" - failureMessage.actualValue = "\(String(describing: type(of: actualValue)))" - } - return false - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/Match.swift b/Pods/Nimble/Sources/Nimble/Matchers/Match.swift deleted file mode 100644 index 7e803318..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/Match.swift +++ /dev/null @@ -1,30 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual string satisfies the regular expression -/// described by the expected string. -public func match(_ expectedValue: String?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "match <\(stringify(expectedValue))>" - - if let actual = try actualExpression.evaluate() { - if let regexp = expectedValue { - return actual.range(of: regexp, options: .regularExpression) != nil - } - } - - return false - } -} - -#if _runtime(_ObjC) - -extension NMBObjCMatcher { - public class func matchMatcher(_ expected: NSString) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = actualExpression.cast { $0 as? String } - return try! match(expected.description).matches(actual, failureMessage: failureMessage) - } - } -} - -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift b/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift deleted file mode 100644 index 2092cb60..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift +++ /dev/null @@ -1,26 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual expression evaluates to an -/// error from the specified case. -/// -/// Errors are tried to be compared by their implementation of Equatable, -/// otherwise they fallback to comparision by _domain and _code. -public func matchError(_ error: T) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() - - setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, error: error) - return errorMatchesNonNilFieldsOrClosure(actualError, error: error) - } -} - -/// A Nimble matcher that succeeds when the actual expression evaluates to an -/// error of the specified type -public func matchError(_ errorType: T.Type) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() - - setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, errorType: errorType) - return errorMatchesNonNilFieldsOrClosure(actualError, errorType: errorType) - } -} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift b/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift deleted file mode 100644 index 02d3245c..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift +++ /dev/null @@ -1,69 +0,0 @@ -/// A convenience API to build matchers that don't need special negation -/// behavior. The toNot() behavior is the negation of to(). -/// -/// @see NonNilMatcherFunc if you prefer to have this matcher fail when nil -/// values are recieved in an expectation. -/// -/// You may use this when implementing your own custom matchers. -/// -/// Use the Matcher protocol instead of this type to accept custom matchers as -/// input parameters. -/// @see allPass for an example that uses accepts other matchers as input. -public struct MatcherFunc: Matcher { - public let matcher: (Expression, FailureMessage) throws -> Bool - - public init(_ matcher: @escaping (Expression, FailureMessage) throws -> Bool) { - self.matcher = matcher - } - - public func matches(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { - return try matcher(actualExpression, failureMessage) - } - - public func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { - return try !matcher(actualExpression, failureMessage) - } -} - -/// A convenience API to build matchers that don't need special negation -/// behavior. The toNot() behavior is the negation of to(). -/// -/// Unlike MatcherFunc, this will always fail if an expectation contains nil. -/// This applies regardless of using to() or toNot(). -/// -/// You may use this when implementing your own custom matchers. -/// -/// Use the Matcher protocol instead of this type to accept custom matchers as -/// input parameters. -/// @see allPass for an example that uses accepts other matchers as input. -public struct NonNilMatcherFunc: Matcher { - public let matcher: (Expression, FailureMessage) throws -> Bool - - public init(_ matcher: @escaping (Expression, FailureMessage) throws -> Bool) { - self.matcher = matcher - } - - public func matches(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { - let pass = try matcher(actualExpression, failureMessage) - if try attachNilErrorIfNeeded(actualExpression, failureMessage: failureMessage) { - return false - } - return pass - } - - public func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { - let pass = try !matcher(actualExpression, failureMessage) - if try attachNilErrorIfNeeded(actualExpression, failureMessage: failureMessage) { - return false - } - return pass - } - - internal func attachNilErrorIfNeeded(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { - if try actualExpression.evaluate() == nil { - failureMessage.postfixActual = " (use beNil() to match nils)" - return true - } - return false - } -} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift b/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift deleted file mode 100644 index 3f27ec1e..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift +++ /dev/null @@ -1,153 +0,0 @@ -import Foundation -// `CGFloat` is in Foundation (swift-corelibs-foundation) on Linux. -#if _runtime(_ObjC) - import CoreGraphics -#endif - -/// Implement this protocol to implement a custom matcher for Swift -public protocol Matcher { - associatedtype ValueType - func matches(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool - func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool -} - -#if _runtime(_ObjC) -/// Objective-C interface to the Swift variant of Matcher. -@objc public protocol NMBMatcher { - func matches(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool - func doesNotMatch(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool -} -#endif - -#if _runtime(_ObjC) -/// Protocol for types that support contain() matcher. -@objc public protocol NMBContainer { - @objc(containsObject:) - func contains(_ anObject: Any) -> Bool -} - -// FIXME: NSHashTable can not conform to NMBContainer since swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a -//extension NSHashTable : NMBContainer {} // Corelibs Foundation does not include this class yet -#else -public protocol NMBContainer { - func contains(_ anObject: Any) -> Bool -} -#endif - -extension NSArray : NMBContainer {} -extension NSSet : NMBContainer {} - -#if _runtime(_ObjC) -/// Protocol for types that support only beEmpty(), haveCount() matchers -@objc public protocol NMBCollection { - var count: Int { get } -} - -extension NSHashTable : NMBCollection {} // Corelibs Foundation does not include these classes yet -extension NSMapTable : NMBCollection {} -#else -public protocol NMBCollection { - var count: Int { get } -} -#endif - -extension NSSet : NMBCollection {} -extension NSIndexSet : NMBCollection {} -extension NSDictionary : NMBCollection {} - -#if _runtime(_ObjC) -/// Protocol for types that support beginWith(), endWith(), beEmpty() matchers -@objc public protocol NMBOrderedCollection: NMBCollection { - @objc(objectAtIndex:) - func object(at index: Int) -> Any -} -#else -public protocol NMBOrderedCollection: NMBCollection { - func object(at index: Int) -> Any -} -#endif - -extension NSArray : NMBOrderedCollection {} - -public protocol NMBDoubleConvertible { - var doubleValue: CDouble { get } -} - -extension Double : NMBDoubleConvertible { - public var doubleValue: CDouble { - return self - } -} - -extension Float : NMBDoubleConvertible { - public var doubleValue: CDouble { - return CDouble(self) - } -} - -extension CGFloat: NMBDoubleConvertible { - public var doubleValue: CDouble { - return CDouble(self) - } -} - -extension NSNumber : NMBDoubleConvertible { -} - -private let dateFormatter: DateFormatter = { - let formatter = DateFormatter() - formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSS" - formatter.locale = Locale(identifier: "en_US_POSIX") - - return formatter -}() - -extension Date: NMBDoubleConvertible { - public var doubleValue: CDouble { - return self.timeIntervalSinceReferenceDate - } -} - -extension NSDate: NMBDoubleConvertible { - public var doubleValue: CDouble { - return self.timeIntervalSinceReferenceDate - } -} - -extension Date: TestOutputStringConvertible { - public var testDescription: String { - return dateFormatter.string(from: self) - } -} - -extension NSDate: TestOutputStringConvertible { - public var testDescription: String { - return dateFormatter.string(from: Date(timeIntervalSinceReferenceDate: self.timeIntervalSinceReferenceDate)) - } -} - -/// Protocol for types to support beLessThan(), beLessThanOrEqualTo(), -/// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers. -/// -/// Types that conform to Swift's Comparable protocol will work implicitly too -#if _runtime(_ObjC) -@objc public protocol NMBComparable { - func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult -} -#else -// This should become obsolete once Corelibs Foundation adds Comparable conformance to NSNumber -public protocol NMBComparable { - func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult -} -#endif - -extension NSNumber : NMBComparable { - public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { - return compare(otherObject as! NSNumber) - } -} -extension NSString : NMBComparable { - public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { - return compare(otherObject as! String) - } -} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift b/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift deleted file mode 100644 index ac8ee5aa..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift +++ /dev/null @@ -1,70 +0,0 @@ -import Foundation - -internal class NotificationCollector { - private(set) var observedNotifications: [Notification] - private let notificationCenter: NotificationCenter - #if _runtime(_ObjC) - private var token: AnyObject? - #else - private var token: NSObjectProtocol? - #endif - - required init(notificationCenter: NotificationCenter) { - self.notificationCenter = notificationCenter - self.observedNotifications = [] - } - - func startObserving() { - self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil) { [weak self] n in - // linux-swift gets confused by .append(n) - self?.observedNotifications.append(n) - } - } - - deinit { - #if _runtime(_ObjC) - if let token = self.token { - self.notificationCenter.removeObserver(token) - } - #else - if let token = self.token as? AnyObject { - self.notificationCenter.removeObserver(token) - } - #endif - } -} - -private let mainThread = pthread_self() - -let notificationCenterDefault = NotificationCenter.default - -public func postNotifications( - _ notificationsMatcher: T, - fromNotificationCenter center: NotificationCenter = notificationCenterDefault) - -> MatcherFunc - where T: Matcher, T.ValueType == [Notification] -{ - let _ = mainThread // Force lazy-loading of this value - let collector = NotificationCollector(notificationCenter: center) - collector.startObserving() - var once: Bool = false - return MatcherFunc { actualExpression, failureMessage in - let collectorNotificationsExpression = Expression(memoizedExpression: { _ in - return collector.observedNotifications - }, location: actualExpression.location, withoutCaching: true) - - assert(pthread_equal(mainThread, pthread_self()) != 0, "Only expecting closure to be evaluated on main thread.") - if !once { - once = true - _ = try actualExpression.evaluate() - } - - let match = try notificationsMatcher.matches(collectorNotificationsExpression, failureMessage: failureMessage) - if collector.observedNotifications.isEmpty { - failureMessage.actualValue = "no notifications" - } else { - failureMessage.actualValue = "<\(stringify(collector.observedNotifications))>" - } - return match - } -} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift b/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift deleted file mode 100644 index 2867a1b1..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift +++ /dev/null @@ -1,183 +0,0 @@ -import Foundation - -// This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager -#if _runtime(_ObjC) && !SWIFT_PACKAGE - -/// A Nimble matcher that succeeds when the actual expression raises an -/// exception with the specified name, reason, and/or userInfo. -/// -/// Alternatively, you can pass a closure to do any arbitrary custom matching -/// to the raised exception. The closure only gets called when an exception -/// is raised. -/// -/// nil arguments indicates that the matcher should not attempt to match against -/// that parameter. -public func raiseException( - named: String? = nil, - reason: String? = nil, - userInfo: NSDictionary? = nil, - closure: ((NSException) -> Void)? = nil) -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - - var exception: NSException? - let capture = NMBExceptionCapture(handler: ({ e in - exception = e - }), finally: nil) - - capture.tryBlock { - _ = try! actualExpression.evaluate() - return - } - - setFailureMessageForException(failureMessage, exception: exception, named: named, reason: reason, userInfo: userInfo, closure: closure) - return exceptionMatchesNonNilFieldsOrClosure(exception, named: named, reason: reason, userInfo: userInfo, closure: closure) - } -} - -internal func setFailureMessageForException( - _ failureMessage: FailureMessage, - exception: NSException?, - named: String?, - reason: String?, - userInfo: NSDictionary?, - closure: ((NSException) -> Void)?) { - failureMessage.postfixMessage = "raise exception" - - if let named = named { - failureMessage.postfixMessage += " with name <\(named)>" - } - if let reason = reason { - failureMessage.postfixMessage += " with reason <\(reason)>" - } - if let userInfo = userInfo { - failureMessage.postfixMessage += " with userInfo <\(userInfo)>" - } - if let _ = closure { - failureMessage.postfixMessage += " that satisfies block" - } - if named == nil && reason == nil && userInfo == nil && closure == nil { - failureMessage.postfixMessage = "raise any exception" - } - - if let exception = exception { - failureMessage.actualValue = "\(String(describing: type(of: exception))) { name=\(exception.name), reason='\(stringify(exception.reason))', userInfo=\(stringify(exception.userInfo)) }" - } else { - failureMessage.actualValue = "no exception" - } -} - -internal func exceptionMatchesNonNilFieldsOrClosure( - _ exception: NSException?, - named: String?, - reason: String?, - userInfo: NSDictionary?, - closure: ((NSException) -> Void)?) -> Bool { - var matches = false - - if let exception = exception { - matches = true - - if let named = named, exception.name.rawValue != named { - matches = false - } - if reason != nil && exception.reason != reason { - matches = false - } - if let userInfo = userInfo, let exceptionUserInfo = exception.userInfo, - (exceptionUserInfo as NSDictionary) != userInfo { - matches = false - } - if let closure = closure { - let assertions = gatherFailingExpectations { - closure(exception) - } - let messages = assertions.map { $0.message } - if messages.count > 0 { - matches = false - } - } - } - - return matches -} - -public class NMBObjCRaiseExceptionMatcher: NSObject, NMBMatcher { - internal var _name: String? - internal var _reason: String? - internal var _userInfo: NSDictionary? - internal var _block: ((NSException) -> Void)? - - internal init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { - _name = name - _reason = reason - _userInfo = userInfo - _block = block - } - - public func matches(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - let block: () -> Any? = ({ _ = actualBlock(); return nil }) - let expr = Expression(expression: block, location: location) - - return try! raiseException( - named: _name, - reason: _reason, - userInfo: _userInfo, - closure: _block - ).matches(expr, failureMessage: failureMessage) - } - - public func doesNotMatch(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - return !matches(actualBlock, failureMessage: failureMessage, location: location) - } - - public var named: (_ name: String) -> NMBObjCRaiseExceptionMatcher { - return ({ name in - return NMBObjCRaiseExceptionMatcher( - name: name, - reason: self._reason, - userInfo: self._userInfo, - block: self._block - ) - }) - } - - public var reason: (_ reason: String?) -> NMBObjCRaiseExceptionMatcher { - return ({ reason in - return NMBObjCRaiseExceptionMatcher( - name: self._name, - reason: reason, - userInfo: self._userInfo, - block: self._block - ) - }) - } - - public var userInfo: (_ userInfo: NSDictionary?) -> NMBObjCRaiseExceptionMatcher { - return ({ userInfo in - return NMBObjCRaiseExceptionMatcher( - name: self._name, - reason: self._reason, - userInfo: userInfo, - block: self._block - ) - }) - } - - public var satisfyingBlock: (_ block: ((NSException) -> Void)?) -> NMBObjCRaiseExceptionMatcher { - return ({ block in - return NMBObjCRaiseExceptionMatcher( - name: self._name, - reason: self._reason, - userInfo: self._userInfo, - block: block - ) - }) - } -} - -extension NMBObjCMatcher { - public class func raiseExceptionMatcher() -> NMBObjCRaiseExceptionMatcher { - return NMBObjCRaiseExceptionMatcher(name: nil, reason: nil, userInfo: nil, block: nil) - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift b/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift deleted file mode 100644 index 6cef4c27..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift +++ /dev/null @@ -1,62 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value matches with any of the matchers -/// provided in the variable list of matchers. -public func satisfyAnyOf(_ matchers: U...) -> NonNilMatcherFunc - where U: Matcher, U.ValueType == T { - return satisfyAnyOf(matchers) -} - -internal func satisfyAnyOf(_ matchers: [U]) -> NonNilMatcherFunc - where U: Matcher, U.ValueType == T { - return NonNilMatcherFunc { actualExpression, failureMessage in - let postfixMessages = NSMutableArray() - var matches = false - for matcher in matchers { - if try matcher.matches(actualExpression, failureMessage: failureMessage) { - matches = true - } - postfixMessages.add(NSString(string: "{\(failureMessage.postfixMessage)}")) - } - - failureMessage.postfixMessage = "match one of: " + postfixMessages.componentsJoined(by: ", or ") - if let actualValue = try actualExpression.evaluate() { - failureMessage.actualValue = "\(actualValue)" - } - - return matches - } -} - -public func || (left: NonNilMatcherFunc, right: NonNilMatcherFunc) -> NonNilMatcherFunc { - return satisfyAnyOf(left, right) -} - -public func || (left: MatcherFunc, right: MatcherFunc) -> NonNilMatcherFunc { - return satisfyAnyOf(left, right) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func satisfyAnyOfMatcher(_ matchers: [NMBObjCMatcher]) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - if matchers.isEmpty { - failureMessage.stringValue = "satisfyAnyOf must be called with at least one matcher" - return false - } - - var elementEvaluators = [NonNilMatcherFunc]() - for matcher in matchers { - let elementEvaluator: (Expression, FailureMessage) -> Bool = { - expression, failureMessage in - return matcher.matches({try! expression.evaluate()}, failureMessage: failureMessage, location: actualExpression.location) - } - - elementEvaluators.append(NonNilMatcherFunc(elementEvaluator)) - } - - return try! satisfyAnyOf(elementEvaluators).matches(actualExpression, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Pods/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift b/Pods/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift deleted file mode 100644 index c847a1a6..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/ThrowAssertion.swift +++ /dev/null @@ -1,55 +0,0 @@ -import Foundation - -public func throwAssertion() -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - #if arch(x86_64) && _runtime(_ObjC) && !SWIFT_PACKAGE - failureMessage.postfixMessage = "throw an assertion" - failureMessage.actualValue = nil - - var succeeded = true - - let caughtException: BadInstructionException? = catchBadInstruction { - #if os(tvOS) - if !NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning { - print() - print("[Nimble Warning]: If you're getting stuck on a debugger breakpoint for a " + - "fatal error while using throwAssertion(), please disable 'Debug Executable' " + - "in your scheme. Go to 'Edit Scheme > Test > Info' and uncheck " + - "'Debug Executable'. If you've already done that, suppress this warning " + - "by setting `NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning = true`. " + - "This is required because the standard methods of catching assertions " + - "(mach APIs) are unavailable for tvOS. Instead, the same mechanism the " + - "debugger uses is the fallback method for tvOS." - ) - print() - NimbleEnvironment.activeInstance.suppressTVOSAssertionWarning = true - } - #endif - do { - try actualExpression.evaluate() - } catch let error { - succeeded = false - failureMessage.postfixMessage += "; threw error instead <\(error)>" - } - } - - if !succeeded { - return false - } - - if caughtException == nil { - return false - } - - return true - #elseif SWIFT_PACKAGE - fatalError("The throwAssertion Nimble matcher does not currently support Swift CLI." + - " You can silence this error by placing the test case inside an #if !SWIFT_PACKAGE" + - " conditional statement") - #else - fatalError("The throwAssertion Nimble matcher can only run on x86_64 platforms with " + - "Objective-C (e.g. Mac, iPhone 5s or later simulators). You can silence this error " + - "by placing the test case inside an #if arch(x86_64) or _runtime(_ObjC) conditional statement") - #endif - } -} diff --git a/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift b/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift deleted file mode 100644 index 151eb9ad..00000000 --- a/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift +++ /dev/null @@ -1,53 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual expression throws an -/// error of the specified type or from the specified case. -/// -/// Errors are tried to be compared by their implementation of Equatable, -/// otherwise they fallback to comparision by _domain and _code. -/// -/// Alternatively, you can pass a closure to do any arbitrary custom matching -/// to the thrown error. The closure only gets called when an error was thrown. -/// -/// nil arguments indicates that the matcher should not attempt to match against -/// that parameter. -public func throwError( - _ error: T? = nil, - errorType: T.Type? = nil, - closure: ((T) -> Void)? = nil) -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - - var actualError: Error? - do { - _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError - } - - setFailureMessageForError(failureMessage, actualError: actualError, error: error, errorType: errorType, closure: closure) - return errorMatchesNonNilFieldsOrClosure(actualError, error: error, errorType: errorType, closure: closure) - } -} - -/// A Nimble matcher that succeeds when the actual expression throws any -/// error or when the passed closures' arbitrary custom matching succeeds. -/// -/// This duplication to it's generic adequate is required to allow to receive -/// values of the existential type `Error` in the closure. -/// -/// The closure only gets called when an error was thrown. -public func throwError( - closure: ((Error) -> Void)? = nil) -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - - var actualError: Error? - do { - _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError - } - - setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) - return errorMatchesNonNilFieldsOrClosure(actualError, closure: closure) - } -} diff --git a/Pods/Nimble/Sources/Nimble/Nimble.h b/Pods/Nimble/Sources/Nimble/Nimble.h deleted file mode 100644 index 790d16dc..00000000 --- a/Pods/Nimble/Sources/Nimble/Nimble.h +++ /dev/null @@ -1,14 +0,0 @@ -#import -#import "NMBExceptionCapture.h" -#import "NMBStringify.h" -#import "DSL.h" - -#import "CwlCatchException.h" -#import "CwlCatchBadInstruction.h" - -#if !TARGET_OS_TV - #import "mach_excServer.h" -#endif - -FOUNDATION_EXPORT double NimbleVersionNumber; -FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; diff --git a/Pods/Nimble/Sources/Nimble/Utils/Async.swift b/Pods/Nimble/Sources/Nimble/Utils/Async.swift deleted file mode 100644 index 943fd30f..00000000 --- a/Pods/Nimble/Sources/Nimble/Utils/Async.swift +++ /dev/null @@ -1,361 +0,0 @@ -import CoreFoundation -import Dispatch -import Foundation - -#if !_runtime(_ObjC) - import CDispatch -#endif - -private let timeoutLeeway = DispatchTimeInterval.milliseconds(1) -private let pollLeeway = DispatchTimeInterval.milliseconds(1) - -/// Stores debugging information about callers -internal struct WaitingInfo: CustomStringConvertible { - let name: String - let file: FileString - let lineNumber: UInt - - var description: String { - return "\(name) at \(file):\(lineNumber)" - } -} - -internal protocol WaitLock { - func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) - func releaseWaitingLock() - func isWaitingLocked() -> Bool -} - -internal class AssertionWaitLock: WaitLock { - private var currentWaiter: WaitingInfo? = nil - init() { } - - func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) { - let info = WaitingInfo(name: fnName, file: file, lineNumber: line) - #if _runtime(_ObjC) - let isMainThread = Thread.isMainThread - #else - let isMainThread = _CFIsMainThread() - #endif - nimblePrecondition( - isMainThread, - "InvalidNimbleAPIUsage", - "\(fnName) can only run on the main thread." - ) - nimblePrecondition( - currentWaiter == nil, - "InvalidNimbleAPIUsage", - "Nested async expectations are not allowed to avoid creating flaky tests.\n\n" + - "The call to\n\t\(info)\n" + - "triggered this exception because\n\t\(currentWaiter!)\n" + - "is currently managing the main run loop." - ) - currentWaiter = info - } - - func isWaitingLocked() -> Bool { - return currentWaiter != nil - } - - func releaseWaitingLock() { - currentWaiter = nil - } -} - -internal enum AwaitResult { - /// Incomplete indicates None (aka - this value hasn't been fulfilled yet) - case incomplete - /// TimedOut indicates the result reached its defined timeout limit before returning - case timedOut - /// BlockedRunLoop indicates the main runloop is too busy processing other blocks to trigger - /// the timeout code. - /// - /// This may also mean the async code waiting upon may have never actually ran within the - /// required time because other timers & sources are running on the main run loop. - case blockedRunLoop - /// The async block successfully executed and returned a given result - case completed(T) - /// When a Swift Error is thrown - case errorThrown(Error) - /// When an Objective-C Exception is raised - case raisedException(NSException) - - func isIncomplete() -> Bool { - switch self { - case .incomplete: return true - default: return false - } - } - - func isCompleted() -> Bool { - switch self { - case .completed(_): return true - default: return false - } - } -} - -/// Holds the resulting value from an asynchronous expectation. -/// This class is thread-safe at receiving an "response" to this promise. -internal class AwaitPromise { - private(set) internal var asyncResult: AwaitResult = .incomplete - private var signal: DispatchSemaphore - - init() { - signal = DispatchSemaphore(value: 1) - } - - /// Resolves the promise with the given result if it has not been resolved. Repeated calls to - /// this method will resolve in a no-op. - /// - /// @returns a Bool that indicates if the async result was accepted or rejected because another - /// value was recieved first. - func resolveResult(_ result: AwaitResult) -> Bool { - if signal.wait(timeout: .now()) == .success { - self.asyncResult = result - return true - } else { - return false - } - } -} - -internal struct AwaitTrigger { - let timeoutSource: DispatchSourceTimer - let actionSource: DispatchSourceTimer? - let start: () throws -> Void -} - -/// Factory for building fully configured AwaitPromises and waiting for their results. -/// -/// This factory stores all the state for an async expectation so that Await doesn't -/// doesn't have to manage it. -internal class AwaitPromiseBuilder { - let awaiter: Awaiter - let waitLock: WaitLock - let trigger: AwaitTrigger - let promise: AwaitPromise - - internal init( - awaiter: Awaiter, - waitLock: WaitLock, - promise: AwaitPromise, - trigger: AwaitTrigger) { - self.awaiter = awaiter - self.waitLock = waitLock - self.promise = promise - self.trigger = trigger - } - - func timeout(_ timeoutInterval: TimeInterval, forcefullyAbortTimeout: TimeInterval) -> Self { - // = Discussion = - // - // There's a lot of technical decisions here that is useful to elaborate on. This is - // definitely more lower-level than the previous NSRunLoop based implementation. - // - // - // Why Dispatch Source? - // - // - // We're using a dispatch source to have better control of the run loop behavior. - // A timer source gives us deferred-timing control without having to rely as much on - // a run loop's traditional dispatching machinery (eg - NSTimers, DefaultRunLoopMode, etc.) - // which is ripe for getting corrupted by application code. - // - // And unlike dispatch_async(), we can control how likely our code gets prioritized to - // executed (see leeway parameter) + DISPATCH_TIMER_STRICT. - // - // This timer is assumed to run on the HIGH priority queue to ensure it maintains the - // highest priority over normal application / test code when possible. - // - // - // Run Loop Management - // - // In order to properly interrupt the waiting behavior performed by this factory class, - // this timer stops the main run loop to tell the waiter code that the result should be - // checked. - // - // In addition, stopping the run loop is used to halt code executed on the main run loop. - trigger.timeoutSource.scheduleOneshot( - deadline: DispatchTime.now() + timeoutInterval, - leeway: timeoutLeeway) - trigger.timeoutSource.setEventHandler { - guard self.promise.asyncResult.isIncomplete() else { return } - let timedOutSem = DispatchSemaphore(value: 0) - let semTimedOutOrBlocked = DispatchSemaphore(value: 0) - semTimedOutOrBlocked.signal() - let runLoop = CFRunLoopGetMain() - #if _runtime(_ObjC) - let runLoopMode = CFRunLoopMode.defaultMode.rawValue - #else - let runLoopMode = kCFRunLoopDefaultMode - #endif - CFRunLoopPerformBlock(runLoop, runLoopMode) { - if semTimedOutOrBlocked.wait(timeout: .now()) == .success { - timedOutSem.signal() - semTimedOutOrBlocked.signal() - if self.promise.resolveResult(.timedOut) { - CFRunLoopStop(CFRunLoopGetMain()) - } - } - } - // potentially interrupt blocking code on run loop to let timeout code run - CFRunLoopStop(runLoop) - let now = DispatchTime.now() + forcefullyAbortTimeout - let didNotTimeOut = timedOutSem.wait(timeout: now) != .success - let timeoutWasNotTriggered = semTimedOutOrBlocked.wait(timeout: .now()) == .success - if didNotTimeOut && timeoutWasNotTriggered { - if self.promise.resolveResult(.blockedRunLoop) { - CFRunLoopStop(CFRunLoopGetMain()) - } - } - } - return self - } - - /// Blocks for an asynchronous result. - /// - /// @discussion - /// This function must be executed on the main thread and cannot be nested. This is because - /// this function (and it's related methods) coordinate through the main run loop. Tampering - /// with the run loop can cause undesireable behavior. - /// - /// This method will return an AwaitResult in the following cases: - /// - /// - The main run loop is blocked by other operations and the async expectation cannot be - /// be stopped. - /// - The async expectation timed out - /// - The async expectation succeeded - /// - The async expectation raised an unexpected exception (objc) - /// - The async expectation raised an unexpected error (swift) - /// - /// The returned AwaitResult will NEVER be .incomplete. - func wait(_ fnName: String = #function, file: FileString = #file, line: UInt = #line) -> AwaitResult { - waitLock.acquireWaitingLock( - fnName, - file: file, - line: line) - - let capture = NMBExceptionCapture(handler: ({ exception in - _ = self.promise.resolveResult(.raisedException(exception)) - }), finally: ({ - self.waitLock.releaseWaitingLock() - })) - capture.tryBlock { - do { - try self.trigger.start() - } catch let error { - _ = self.promise.resolveResult(.errorThrown(error)) - } - self.trigger.timeoutSource.resume() - while self.promise.asyncResult.isIncomplete() { - // Stopping the run loop does not work unless we run only 1 mode - _ = RunLoop.current.run(mode: .defaultRunLoopMode, before: .distantFuture) - } - self.trigger.timeoutSource.suspend() - self.trigger.timeoutSource.cancel() - if let asyncSource = self.trigger.actionSource { - asyncSource.cancel() - } - } - - return promise.asyncResult - } -} - -internal class Awaiter { - let waitLock: WaitLock - let timeoutQueue: DispatchQueue - let asyncQueue: DispatchQueue - - internal init( - waitLock: WaitLock, - asyncQueue: DispatchQueue, - timeoutQueue: DispatchQueue) { - self.waitLock = waitLock - self.asyncQueue = asyncQueue - self.timeoutQueue = timeoutQueue - } - - private func createTimerSource(_ queue: DispatchQueue) -> DispatchSourceTimer { - return DispatchSource.makeTimerSource(flags: .strict, queue: queue) - } - - func performBlock( - _ closure: @escaping (@escaping (T) -> Void) throws -> Void) -> AwaitPromiseBuilder { - let promise = AwaitPromise() - let timeoutSource = createTimerSource(timeoutQueue) - var completionCount = 0 - let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: nil) { - try closure { - completionCount += 1 - nimblePrecondition( - completionCount < 2, - "InvalidNimbleAPIUsage", - "Done closure's was called multiple times. waitUntil(..) expects its " + - "completion closure to only be called once.") - if promise.resolveResult(.completed($0)) { - CFRunLoopStop(CFRunLoopGetMain()) - } - } - } - - return AwaitPromiseBuilder( - awaiter: self, - waitLock: waitLock, - promise: promise, - trigger: trigger) - } - - func poll(_ pollInterval: TimeInterval, closure: @escaping () throws -> T?) -> AwaitPromiseBuilder { - let promise = AwaitPromise() - let timeoutSource = createTimerSource(timeoutQueue) - let asyncSource = createTimerSource(asyncQueue) - let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) { - let interval = DispatchTimeInterval.nanoseconds(Int(pollInterval * TimeInterval(NSEC_PER_SEC))) - asyncSource.scheduleRepeating(deadline: .now(), interval: interval, leeway: pollLeeway) - asyncSource.setEventHandler { - do { - if let result = try closure() { - if promise.resolveResult(.completed(result)) { - CFRunLoopStop(CFRunLoopGetCurrent()) - } - } - } catch let error { - if promise.resolveResult(.errorThrown(error)) { - CFRunLoopStop(CFRunLoopGetCurrent()) - } - } - } - asyncSource.resume() - } - - return AwaitPromiseBuilder( - awaiter: self, - waitLock: waitLock, - promise: promise, - trigger: trigger) - } -} - -internal func pollBlock( - pollInterval: TimeInterval, - timeoutInterval: TimeInterval, - file: FileString, - line: UInt, - fnName: String = #function, - expression: @escaping () throws -> Bool) -> AwaitResult { - let awaiter = NimbleEnvironment.activeInstance.awaiter - let result = awaiter.poll(pollInterval) { () throws -> Bool? in - do { - if try expression() { - return true - } - return nil - } catch let error { - throw error - } - }.timeout(timeoutInterval, forcefullyAbortTimeout: timeoutInterval / 2.0).wait(fnName, file: file, line: line) - - return result -} diff --git a/Pods/Nimble/Sources/Nimble/Utils/Errors.swift b/Pods/Nimble/Sources/Nimble/Utils/Errors.swift deleted file mode 100644 index f3765056..00000000 --- a/Pods/Nimble/Sources/Nimble/Utils/Errors.swift +++ /dev/null @@ -1,141 +0,0 @@ -import Foundation - -// Generic - -internal func setFailureMessageForError( - _ failureMessage: FailureMessage, - postfixMessageVerb: String = "throw", - actualError: Error?, - error: T? = nil, - errorType: T.Type? = nil, - closure: ((T) -> Void)? = nil) { - failureMessage.postfixMessage = "\(postfixMessageVerb) error" - - if let error = error { - if let error = error as? CustomDebugStringConvertible { - failureMessage.postfixMessage += " <\(error.debugDescription)>" - } else { - failureMessage.postfixMessage += " <\(error)>" - } - } else if errorType != nil || closure != nil { - failureMessage.postfixMessage += " from type <\(T.self)>" - } - if let _ = closure { - failureMessage.postfixMessage += " that satisfies block" - } - if error == nil && errorType == nil && closure == nil { - failureMessage.postfixMessage = "\(postfixMessageVerb) any error" - } - - if let actualError = actualError { - failureMessage.actualValue = "<\(actualError)>" - } else { - failureMessage.actualValue = "no error" - } -} - -internal func errorMatchesExpectedError( - _ actualError: Error, - expectedError: T) -> Bool { - return actualError._domain == expectedError._domain - && actualError._code == expectedError._code -} - -internal func errorMatchesExpectedError( - _ actualError: Error, - expectedError: T) -> Bool - where T: Equatable { - if let actualError = actualError as? T { - return actualError == expectedError - } - return false -} - -internal func errorMatchesNonNilFieldsOrClosure( - _ actualError: Error?, - error: T? = nil, - errorType: T.Type? = nil, - closure: ((T) -> Void)? = nil) -> Bool { - var matches = false - - if let actualError = actualError { - matches = true - - if let error = error { - if !errorMatchesExpectedError(actualError, expectedError: error) { - matches = false - } - } - if let actualError = actualError as? T { - if let closure = closure { - let assertions = gatherFailingExpectations { - closure(actualError as T) - } - let messages = assertions.map { $0.message } - if messages.count > 0 { - matches = false - } - } - } else if errorType != nil { - matches = (actualError is T) - // The closure expects another ErrorProtocol as argument, so this - // is _supposed_ to fail, so that it becomes more obvious. - if let closure = closure { - let assertions = gatherExpectations { - if let actual = actualError as? T { - closure(actual) - } - } - let messages = assertions.map { $0.message } - if messages.count > 0 { - matches = false - } - } - } - } - - return matches -} - -// Non-generic - -internal func setFailureMessageForError( - _ failureMessage: FailureMessage, - actualError: Error?, - closure: ((Error) -> Void)?) { - failureMessage.postfixMessage = "throw error" - - if let _ = closure { - failureMessage.postfixMessage += " that satisfies block" - } else { - failureMessage.postfixMessage = "throw any error" - } - - if let actualError = actualError { - failureMessage.actualValue = "<\(actualError)>" - } else { - failureMessage.actualValue = "no error" - } -} - -internal func errorMatchesNonNilFieldsOrClosure( - _ actualError: Error?, - closure: ((Error) -> Void)?) -> Bool { - var matches = false - - if let actualError = actualError { - matches = true - - if let closure = closure { - let assertions = gatherFailingExpectations { - closure(actualError) - } - let messages = assertions.map { $0.message } - if messages.count > 0 { - matches = false - } - } - } - - return matches -} diff --git a/Pods/Nimble/Sources/Nimble/Utils/Functional.swift b/Pods/Nimble/Sources/Nimble/Utils/Functional.swift deleted file mode 100644 index 6c5126a4..00000000 --- a/Pods/Nimble/Sources/Nimble/Utils/Functional.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation - -extension Sequence { - internal func all(_ fn: (Iterator.Element) -> Bool) -> Bool { - for item in self { - if !fn(item) { - return false - } - } - return true - } -} diff --git a/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift b/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift deleted file mode 100644 index 4e37aefa..00000000 --- a/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift +++ /dev/null @@ -1,31 +0,0 @@ -import Foundation - -// Ideally we would always use `StaticString` as the type for tracking the file name -// that expectations originate from, for consistency with `assert` etc. from the -// stdlib, and because recent versions of the XCTest overlay require `StaticString` -// when calling `XCTFail`. Under the Objective-C runtime (i.e. building on Mac), we -// have to use `String` instead because StaticString can't be generated from Objective-C -#if SWIFT_PACKAGE -public typealias FileString = StaticString -#else -public typealias FileString = String -#endif - -public final class SourceLocation: NSObject { - public let file: FileString - public let line: UInt - - override init() { - file = "Unknown File" - line = 0 - } - - init(file: FileString, line: UInt) { - self.file = file - self.line = line - } - - override public var description: String { - return "\(file):\(line)" - } -} diff --git a/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift b/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift deleted file mode 100644 index 8a15c4cf..00000000 --- a/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift +++ /dev/null @@ -1,212 +0,0 @@ -import Foundation - -internal func identityAsString(_ value: Any?) -> String { - let anyObject: AnyObject? -#if os(Linux) - anyObject = value as? AnyObject -#else - anyObject = value as AnyObject? -#endif - if let value = anyObject { - return NSString(format: "<%p>", unsafeBitCast(value, to: Int.self)).description - } else { - return "nil" - } -} - -internal func arrayAsString(_ items: [T], joiner: String = ", ") -> String { - return items.reduce("") { accum, item in - let prefix = (accum.isEmpty ? "" : joiner) - return accum + prefix + "\(stringify(item))" - } -} - -/// A type with a customized test output text representation. -/// -/// This textual representation is produced when values will be -/// printed in test runs, and may be useful when producing -/// error messages in custom matchers. -/// -/// - SeeAlso: `CustomDebugStringConvertible` -public protocol TestOutputStringConvertible { - var testDescription: String { get } -} - -extension Double: TestOutputStringConvertible { - public var testDescription: String { - return NSNumber(value: self).testDescription - } -} - -extension Float: TestOutputStringConvertible { - public var testDescription: String { - return NSNumber(value: self).testDescription - } -} - -extension NSNumber: TestOutputStringConvertible { - // This is using `NSString(format:)` instead of - // `String(format:)` because the latter somehow breaks - // the travis CI build on linux. - public var testDescription: String { - let description = self.description - - if description.contains(".") { - // Travis linux swiftpm build doesn't like casting String to NSString, - // which is why this annoying nested initializer thing is here. - // Maybe this will change in a future snapshot. - let decimalPlaces = NSString(string: NSString(string: description) - .components(separatedBy: ".")[1]) - - // SeeAlso: https://bugs.swift.org/browse/SR-1464 - switch decimalPlaces.length { - case 1: - return NSString(format: "%0.1f", self.doubleValue).description - case 2: - return NSString(format: "%0.2f", self.doubleValue).description - case 3: - return NSString(format: "%0.3f", self.doubleValue).description - default: - return NSString(format: "%0.4f", self.doubleValue).description - } - } - return self.description - } -} - -extension Array: TestOutputStringConvertible { - public var testDescription: String { - let list = self.map(Nimble.stringify).joined(separator: ", ") - return "[\(list)]" - } -} - -extension AnySequence: TestOutputStringConvertible { - public var testDescription: String { - let generator = self.makeIterator() - var strings = [String]() - var value: AnySequence.Iterator.Element? - - repeat { - value = generator.next() - if let value = value { - strings.append(stringify(value)) - } - } while value != nil - - let list = strings.joined(separator: ", ") - return "[\(list)]" - } -} - -extension NSArray: TestOutputStringConvertible { - public var testDescription: String { - let list = Array(self).map(Nimble.stringify).joined(separator: ", ") - return "(\(list))" - } -} - -extension NSIndexSet: TestOutputStringConvertible { - public var testDescription: String { - let list = Array(self).map(Nimble.stringify).joined(separator: ", ") - return "(\(list))" - } -} - -extension String: TestOutputStringConvertible { - public var testDescription: String { - return self - } -} - -extension Data: TestOutputStringConvertible { - public var testDescription: String { - #if os(Linux) - // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16) - return "Data" - #else - return "Data" - #endif - } -} - -/// -/// Returns a string appropriate for displaying in test output -/// from the provided value. -/// -/// - parameter value: A value that will show up in a test's output. -/// -/// - returns: The string that is returned can be -/// customized per type by conforming a type to the `TestOutputStringConvertible` -/// protocol. When stringifying a non-`TestOutputStringConvertible` type, this -/// function will return the value's debug description and then its -/// normal description if available and in that order. Otherwise it -/// will return the result of constructing a string from the value. -/// -/// - SeeAlso: `TestOutputStringConvertible` -public func stringify(_ value: T) -> String { - if let value = value as? TestOutputStringConvertible { - return value.testDescription - } - - if let value = value as? CustomDebugStringConvertible { - return value.debugDescription - } - - return String(describing: value) -} - -/// -SeeAlso: `stringify(value: T)` -public func stringify(_ value: T?) -> String { - if let unboxed = value { - return stringify(unboxed) - } - return "nil" -} - -#if _runtime(_ObjC) -@objc public class NMBStringer: NSObject { - @objc public class func stringify(_ obj: Any?) -> String { - return Nimble.stringify(obj) - } -} -#endif - -// MARK: Collection Type Stringers - -/// Attempts to generate a pretty type string for a given value. If the value is of a Objective-C -/// collection type, or a subclass thereof, (e.g. `NSArray`, `NSDictionary`, etc.). -/// This function will return the type name of the root class of the class cluster for better -/// readability (e.g. `NSArray` instead of `__NSArrayI`). -/// -/// For values that don't have a type of an Objective-C collection, this function returns the -/// default type description. -/// -/// - parameter value: A value that will be used to determine a type name. -/// -/// - returns: The name of the class cluster root class for Objective-C collection types, or the -/// the `dynamicType` of the value for values of any other type. -public func prettyCollectionType(_ value: T) -> String { - switch value { - case is NSArray: - return String(describing: NSArray.self) - case is NSDictionary: - return String(describing: NSDictionary.self) - case is NSSet: - return String(describing: NSSet.self) - case is NSIndexSet: - return String(describing: NSIndexSet.self) - default: - return String(describing: value) - } -} - -/// Returns the type name for a given collection type. This overload is used by Swift -/// collection types. -/// -/// - parameter collection: A Swift `CollectionType` value. -/// -/// - returns: A string representing the `dynamicType` of the value. -public func prettyCollectionType(_ collection: T) -> String { - return String(describing: type(of: collection)) -} diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/CurrentTestCaseTracker.h b/Pods/Nimble/Sources/NimbleObjectiveC/CurrentTestCaseTracker.h deleted file mode 100644 index 5d416e47..00000000 --- a/Pods/Nimble/Sources/NimbleObjectiveC/CurrentTestCaseTracker.h +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import - -SWIFT_CLASS("_TtC6Nimble22CurrentTestCaseTracker") -@interface CurrentTestCaseTracker : NSObject -+ (CurrentTestCaseTracker *)sharedInstance; -@end - -@interface CurrentTestCaseTracker (Register) @end diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/DSL.h b/Pods/Nimble/Sources/NimbleObjectiveC/DSL.h deleted file mode 100644 index 2089607f..00000000 --- a/Pods/Nimble/Sources/NimbleObjectiveC/DSL.h +++ /dev/null @@ -1,381 +0,0 @@ -#import - -@class NMBExpectation; -@class NMBObjCBeCloseToMatcher; -@class NMBObjCRaiseExceptionMatcher; -@protocol NMBMatcher; - - -NS_ASSUME_NONNULL_BEGIN - - -#define NIMBLE_OVERLOADABLE __attribute__((overloadable)) -#define NIMBLE_EXPORT FOUNDATION_EXPORT -#define NIMBLE_EXPORT_INLINE FOUNDATION_STATIC_INLINE - -#define NIMBLE_VALUE_OF(VAL) ({ \ - __typeof__((VAL)) val = (VAL); \ - [NSValue valueWithBytes:&val objCType:@encode(__typeof__((VAL)))]; \ -}) - -#ifdef NIMBLE_DISABLE_SHORT_SYNTAX -#define NIMBLE_SHORT(PROTO, ORIGINAL) -#define NIMBLE_SHORT_OVERLOADED(PROTO, ORIGINAL) -#else -#define NIMBLE_SHORT(PROTO, ORIGINAL) FOUNDATION_STATIC_INLINE PROTO { return (ORIGINAL); } -#define NIMBLE_SHORT_OVERLOADED(PROTO, ORIGINAL) FOUNDATION_STATIC_INLINE NIMBLE_OVERLOADABLE PROTO { return (ORIGINAL); } -#endif - - - -#define DEFINE_NMB_EXPECT_OVERLOAD(TYPE, EXPR) \ - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - NMBExpectation *NMB_expect(TYPE(^actualBlock)(), NSString *file, NSUInteger line) { \ - return NMB_expect(^id { return EXPR; }, file, line); \ - } - - NIMBLE_EXPORT NIMBLE_OVERLOADABLE - NMBExpectation *NMB_expect(id(^actualBlock)(), NSString *file, NSUInteger line); - - // overloaded dispatch for nils - expect(nil) - DEFINE_NMB_EXPECT_OVERLOAD(void*, nil) - DEFINE_NMB_EXPECT_OVERLOAD(NSRange, NIMBLE_VALUE_OF(actualBlock())) - DEFINE_NMB_EXPECT_OVERLOAD(long, @(actualBlock())) - DEFINE_NMB_EXPECT_OVERLOAD(unsigned long, @(actualBlock())) - DEFINE_NMB_EXPECT_OVERLOAD(int, @(actualBlock())) - DEFINE_NMB_EXPECT_OVERLOAD(unsigned int, @(actualBlock())) - DEFINE_NMB_EXPECT_OVERLOAD(float, @(actualBlock())) - DEFINE_NMB_EXPECT_OVERLOAD(double, @(actualBlock())) - DEFINE_NMB_EXPECT_OVERLOAD(long long, @(actualBlock())) - DEFINE_NMB_EXPECT_OVERLOAD(unsigned long long, @(actualBlock())) - DEFINE_NMB_EXPECT_OVERLOAD(char, @(actualBlock())) - DEFINE_NMB_EXPECT_OVERLOAD(unsigned char, @(actualBlock())) - // bool doesn't get the compiler to dispatch to BOOL types, but using BOOL here seems to allow - // the compiler to dispatch to bool. - DEFINE_NMB_EXPECT_OVERLOAD(BOOL, @(actualBlock())) - DEFINE_NMB_EXPECT_OVERLOAD(char *, @(actualBlock())) - - -#undef DEFINE_NMB_EXPECT_OVERLOAD - - - -NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(), NSString *file, NSUInteger line); - - - -#define DEFINE_OVERLOAD(TYPE, EXPR) \ - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_equal(TYPE expectedValue) { \ - return NMB_equal((EXPR)); \ - } \ - NIMBLE_SHORT_OVERLOADED(id equal(TYPE expectedValue), NMB_equal(expectedValue)); - - - NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_equal(__nullable id expectedValue); - - NIMBLE_SHORT_OVERLOADED(id equal(__nullable id expectedValue), - NMB_equal(expectedValue)); - - // overloaded dispatch for nils - expect(nil) - DEFINE_OVERLOAD(void*__nullable, (id)nil) - DEFINE_OVERLOAD(NSRange, NIMBLE_VALUE_OF(expectedValue)) - DEFINE_OVERLOAD(long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long, @(expectedValue)) - DEFINE_OVERLOAD(int, @(expectedValue)) - DEFINE_OVERLOAD(unsigned int, @(expectedValue)) - DEFINE_OVERLOAD(float, @(expectedValue)) - DEFINE_OVERLOAD(double, @(expectedValue)) - DEFINE_OVERLOAD(long long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) - DEFINE_OVERLOAD(char, @(expectedValue)) - DEFINE_OVERLOAD(unsigned char, @(expectedValue)) - // bool doesn't get the compiler to dispatch to BOOL types, but using BOOL here seems to allow - // the compiler to dispatch to bool. - DEFINE_OVERLOAD(BOOL, @(expectedValue)) - DEFINE_OVERLOAD(char *, @(expectedValue)) - -#undef DEFINE_OVERLOAD - - -#define DEFINE_OVERLOAD(TYPE, EXPR) \ - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_haveCount(TYPE expectedValue) { \ - return NMB_haveCount((EXPR)); \ - } \ - NIMBLE_SHORT_OVERLOADED(id haveCount(TYPE expectedValue), \ - NMB_haveCount(expectedValue)); - - - NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_haveCount(id expectedValue); - - NIMBLE_SHORT_OVERLOADED(id haveCount(id expectedValue), - NMB_haveCount(expectedValue)); - - DEFINE_OVERLOAD(long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long, @(expectedValue)) - DEFINE_OVERLOAD(int, @(expectedValue)) - DEFINE_OVERLOAD(unsigned int, @(expectedValue)) - DEFINE_OVERLOAD(long long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) - DEFINE_OVERLOAD(char, @(expectedValue)) - DEFINE_OVERLOAD(unsigned char, @(expectedValue)) - -#undef DEFINE_OVERLOAD - -#define DEFINE_OVERLOAD(TYPE, EXPR) \ - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - NMBObjCBeCloseToMatcher *NMB_beCloseTo(TYPE expectedValue) { \ - return NMB_beCloseTo((NSNumber *)(EXPR)); \ - } \ - NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToMatcher *beCloseTo(TYPE expectedValue), \ - NMB_beCloseTo(expectedValue)); - - NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue); - NIMBLE_SHORT_OVERLOADED(NMBObjCBeCloseToMatcher *beCloseTo(NSNumber *expectedValue), - NMB_beCloseTo(expectedValue)); - - // it would be better to only overload float & double, but zero becomes ambigious - - DEFINE_OVERLOAD(long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long, @(expectedValue)) - DEFINE_OVERLOAD(int, @(expectedValue)) - DEFINE_OVERLOAD(unsigned int, @(expectedValue)) - DEFINE_OVERLOAD(float, @(expectedValue)) - DEFINE_OVERLOAD(double, @(expectedValue)) - DEFINE_OVERLOAD(long long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) - DEFINE_OVERLOAD(char, @(expectedValue)) - DEFINE_OVERLOAD(unsigned char, @(expectedValue)) - -#undef DEFINE_OVERLOAD - -NIMBLE_EXPORT id NMB_beAnInstanceOf(Class expectedClass); -NIMBLE_EXPORT_INLINE id beAnInstanceOf(Class expectedClass) { - return NMB_beAnInstanceOf(expectedClass); -} - -NIMBLE_EXPORT id NMB_beAKindOf(Class expectedClass); -NIMBLE_EXPORT_INLINE id beAKindOf(Class expectedClass) { - return NMB_beAKindOf(expectedClass); -} - -NIMBLE_EXPORT id NMB_beginWith(id itemElementOrSubstring); -NIMBLE_EXPORT_INLINE id beginWith(id itemElementOrSubstring) { - return NMB_beginWith(itemElementOrSubstring); -} - -#define DEFINE_OVERLOAD(TYPE, EXPR) \ - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beGreaterThan(TYPE expectedValue) { \ - return NMB_beGreaterThan((EXPR)); \ - } \ - NIMBLE_SHORT_OVERLOADED(id beGreaterThan(TYPE expectedValue), NMB_beGreaterThan(expectedValue)); - - NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beGreaterThan(NSNumber *expectedValue); - - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beGreaterThan(NSNumber *expectedValue) { - return NMB_beGreaterThan(expectedValue); - } - - DEFINE_OVERLOAD(long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long, @(expectedValue)) - DEFINE_OVERLOAD(int, @(expectedValue)) - DEFINE_OVERLOAD(unsigned int, @(expectedValue)) - DEFINE_OVERLOAD(long long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) - DEFINE_OVERLOAD(char, @(expectedValue)) - DEFINE_OVERLOAD(unsigned char, @(expectedValue)) - -#undef DEFINE_OVERLOAD - -#define DEFINE_OVERLOAD(TYPE, EXPR) \ - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beGreaterThanOrEqualTo(TYPE expectedValue) { \ - return NMB_beGreaterThanOrEqualTo((EXPR)); \ - } \ - NIMBLE_SHORT_OVERLOADED(id beGreaterThanOrEqualTo(TYPE expectedValue), \ - NMB_beGreaterThanOrEqualTo(expectedValue)); - - NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue); - - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beGreaterThanOrEqualTo(NSNumber *expectedValue) { - return NMB_beGreaterThanOrEqualTo(expectedValue); - } - - DEFINE_OVERLOAD(long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long, @(expectedValue)) - DEFINE_OVERLOAD(int, @(expectedValue)) - DEFINE_OVERLOAD(unsigned int, @(expectedValue)) - DEFINE_OVERLOAD(float, @(expectedValue)) - DEFINE_OVERLOAD(double, @(expectedValue)) - DEFINE_OVERLOAD(long long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) - DEFINE_OVERLOAD(char, @(expectedValue)) - DEFINE_OVERLOAD(unsigned char, @(expectedValue)) - - -#undef DEFINE_OVERLOAD - -NIMBLE_EXPORT id NMB_beIdenticalTo(id expectedInstance); -NIMBLE_SHORT(id beIdenticalTo(id expectedInstance), - NMB_beIdenticalTo(expectedInstance)); - -NIMBLE_EXPORT id NMB_be(id expectedInstance); -NIMBLE_SHORT(id be(id expectedInstance), - NMB_be(expectedInstance)); - - -#define DEFINE_OVERLOAD(TYPE, EXPR) \ - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beLessThan(TYPE expectedValue) { \ - return NMB_beLessThan((EXPR)); \ - } \ - NIMBLE_SHORT_OVERLOADED(id beLessThan(TYPE expectedValue), \ - NMB_beLessThan(expectedValue)); - - NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beLessThan(NSNumber *expectedValue); - - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beLessThan(NSNumber *expectedValue) { - return NMB_beLessThan(expectedValue); - } - - DEFINE_OVERLOAD(long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long, @(expectedValue)) - DEFINE_OVERLOAD(int, @(expectedValue)) - DEFINE_OVERLOAD(unsigned int, @(expectedValue)) - DEFINE_OVERLOAD(float, @(expectedValue)) - DEFINE_OVERLOAD(double, @(expectedValue)) - DEFINE_OVERLOAD(long long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) - DEFINE_OVERLOAD(char, @(expectedValue)) - DEFINE_OVERLOAD(unsigned char, @(expectedValue)) - -#undef DEFINE_OVERLOAD - - -#define DEFINE_OVERLOAD(TYPE, EXPR) \ - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE \ - id NMB_beLessThanOrEqualTo(TYPE expectedValue) { \ - return NMB_beLessThanOrEqualTo((EXPR)); \ - } \ - NIMBLE_SHORT_OVERLOADED(id beLessThanOrEqualTo(TYPE expectedValue), \ - NMB_beLessThanOrEqualTo(expectedValue)); - - - NIMBLE_EXPORT NIMBLE_OVERLOADABLE - id NMB_beLessThanOrEqualTo(NSNumber *expectedValue); - - NIMBLE_EXPORT_INLINE NIMBLE_OVERLOADABLE - id beLessThanOrEqualTo(NSNumber *expectedValue) { - return NMB_beLessThanOrEqualTo(expectedValue); - } - - DEFINE_OVERLOAD(long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long, @(expectedValue)) - DEFINE_OVERLOAD(int, @(expectedValue)) - DEFINE_OVERLOAD(unsigned int, @(expectedValue)) - DEFINE_OVERLOAD(float, @(expectedValue)) - DEFINE_OVERLOAD(double, @(expectedValue)) - DEFINE_OVERLOAD(long long, @(expectedValue)) - DEFINE_OVERLOAD(unsigned long long, @(expectedValue)) - DEFINE_OVERLOAD(char, @(expectedValue)) - DEFINE_OVERLOAD(unsigned char, @(expectedValue)) - -#undef DEFINE_OVERLOAD - -NIMBLE_EXPORT id NMB_beTruthy(void); -NIMBLE_SHORT(id beTruthy(void), - NMB_beTruthy()); - -NIMBLE_EXPORT id NMB_beFalsy(void); -NIMBLE_SHORT(id beFalsy(void), - NMB_beFalsy()); - -NIMBLE_EXPORT id NMB_beTrue(void); -NIMBLE_SHORT(id beTrue(void), - NMB_beTrue()); - -NIMBLE_EXPORT id NMB_beFalse(void); -NIMBLE_SHORT(id beFalse(void), - NMB_beFalse()); - -NIMBLE_EXPORT id NMB_beNil(void); -NIMBLE_SHORT(id beNil(void), - NMB_beNil()); - -NIMBLE_EXPORT id NMB_beEmpty(void); -NIMBLE_SHORT(id beEmpty(void), - NMB_beEmpty()); - -NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, ...) NS_REQUIRES_NIL_TERMINATION; -#define NMB_contain(...) NMB_containWithNilTermination(__VA_ARGS__, nil) -#ifndef NIMBLE_DISABLE_SHORT_SYNTAX -#define contain(...) NMB_contain(__VA_ARGS__) -#endif - -NIMBLE_EXPORT id NMB_containElementSatisfying(BOOL(^predicate)(id)); -NIMBLE_SHORT(id containElementSatisfying(BOOL(^predicate)(id)), - NMB_containElementSatisfying(predicate)); - -NIMBLE_EXPORT id NMB_endWith(id itemElementOrSubstring); -NIMBLE_SHORT(id endWith(id itemElementOrSubstring), - NMB_endWith(itemElementOrSubstring)); - -NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException(void); -NIMBLE_SHORT(NMBObjCRaiseExceptionMatcher *raiseException(void), - NMB_raiseException()); - -NIMBLE_EXPORT id NMB_match(id expectedValue); -NIMBLE_SHORT(id match(id expectedValue), - NMB_match(expectedValue)); - -NIMBLE_EXPORT id NMB_allPass(id matcher); -NIMBLE_SHORT(id allPass(id matcher), - NMB_allPass(matcher)); - -NIMBLE_EXPORT id NMB_satisfyAnyOfWithMatchers(id matchers); -#define NMB_satisfyAnyOf(...) NMB_satisfyAnyOfWithMatchers(@[__VA_ARGS__]) -#ifndef NIMBLE_DISABLE_SHORT_SYNTAX -#define satisfyAnyOf(...) NMB_satisfyAnyOf(__VA_ARGS__) -#endif - -// In order to preserve breakpoint behavior despite using macros to fill in __FILE__ and __LINE__, -// define a builder that populates __FILE__ and __LINE__, and returns a block that takes timeout -// and action arguments. See https://github.com/Quick/Quick/pull/185 for details. -typedef void (^NMBWaitUntilTimeoutBlock)(NSTimeInterval timeout, void (^action)(void (^)(void))); -typedef void (^NMBWaitUntilBlock)(void (^action)(void (^)(void))); - -NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line); - -NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line); -NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line); - -NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line); - -#define NMB_waitUntilTimeout NMB_waitUntilTimeoutBuilder(@(__FILE__), __LINE__) -#define NMB_waitUntil NMB_waitUntilBuilder(@(__FILE__), __LINE__) - -#ifndef NIMBLE_DISABLE_SHORT_SYNTAX -#define expect(...) NMB_expect(^{ return (__VA_ARGS__); }, @(__FILE__), __LINE__) -#define expectAction(BLOCK) NMB_expectAction((BLOCK), @(__FILE__), __LINE__) -#define failWithMessage(msg) NMB_failWithMessage(msg, @(__FILE__), __LINE__) -#define fail() failWithMessage(@"fail() always fails") - - -#define waitUntilTimeout NMB_waitUntilTimeout -#define waitUntil NMB_waitUntil - -#undef NIMBLE_VALUE_OF - -#endif - -NS_ASSUME_NONNULL_END diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/DSL.m b/Pods/Nimble/Sources/NimbleObjectiveC/DSL.m deleted file mode 100644 index 31ff8100..00000000 --- a/Pods/Nimble/Sources/NimbleObjectiveC/DSL.m +++ /dev/null @@ -1,160 +0,0 @@ -#import -#import - -SWIFT_CLASS("_TtC6Nimble7NMBWait") -@interface NMBWait : NSObject - -+ (void)untilTimeout:(NSTimeInterval)timeout file:(NSString *)file line:(NSUInteger)line action:(void(^)())action; -+ (void)untilFile:(NSString *)file line:(NSUInteger)line action:(void(^)())action; - -@end - - -NS_ASSUME_NONNULL_BEGIN - - -NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBExpectation *__nonnull NMB_expect(id __nullable(^actualBlock)(), NSString *__nonnull file, NSUInteger line) { - return [[NMBExpectation alloc] initWithActualBlock:actualBlock - negative:NO - file:file - line:line]; -} - -NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(), NSString *file, NSUInteger line) { - return NMB_expect(^id{ - actualBlock(); - return nil; - }, file, line); -} - -NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line) { - return [NMBExpectation failWithMessage:msg file:file line:line]; -} - -NIMBLE_EXPORT id NMB_beAnInstanceOf(Class expectedClass) { - return [NMBObjCMatcher beAnInstanceOfMatcher:expectedClass]; -} - -NIMBLE_EXPORT id NMB_beAKindOf(Class expectedClass) { - return [NMBObjCMatcher beAKindOfMatcher:expectedClass]; -} - -NIMBLE_EXPORT NIMBLE_OVERLOADABLE NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beCloseToMatcher:expectedValue within:0.001]; -} - -NIMBLE_EXPORT id NMB_beginWith(id itemElementOrSubstring) { - return [NMBObjCMatcher beginWithMatcher:itemElementOrSubstring]; -} - -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beGreaterThan(NSNumber *expectedValue) { - return [NMBObjCMatcher beGreaterThanMatcher:expectedValue]; -} - -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beGreaterThanOrEqualToMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_beIdenticalTo(id expectedInstance) { - return [NMBObjCMatcher beIdenticalToMatcher:expectedInstance]; -} - -NIMBLE_EXPORT id NMB_be(id expectedInstance) { - return [NMBObjCMatcher beIdenticalToMatcher:expectedInstance]; -} - -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beLessThan(NSNumber *expectedValue) { - return [NMBObjCMatcher beLessThanMatcher:expectedValue]; -} - -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_beLessThanOrEqualTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beLessThanOrEqualToMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_beTruthy() { - return [NMBObjCMatcher beTruthyMatcher]; -} - -NIMBLE_EXPORT id NMB_beFalsy() { - return [NMBObjCMatcher beFalsyMatcher]; -} - -NIMBLE_EXPORT id NMB_beTrue() { - return [NMBObjCMatcher beTrueMatcher]; -} - -NIMBLE_EXPORT id NMB_beFalse() { - return [NMBObjCMatcher beFalseMatcher]; -} - -NIMBLE_EXPORT id NMB_beNil() { - return [NMBObjCMatcher beNilMatcher]; -} - -NIMBLE_EXPORT id NMB_beEmpty() { - return [NMBObjCMatcher beEmptyMatcher]; -} - -NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, ...) { - NSMutableArray *itemOrSubstringArray = [NSMutableArray array]; - - if (itemOrSubstring) { - [itemOrSubstringArray addObject:itemOrSubstring]; - - va_list args; - va_start(args, itemOrSubstring); - id next; - while ((next = va_arg(args, id))) { - [itemOrSubstringArray addObject:next]; - } - va_end(args); - } - - return [NMBObjCMatcher containMatcher:itemOrSubstringArray]; -} - -NIMBLE_EXPORT id NMB_containElementSatisfying(BOOL(^predicate)(id)) { - return [NMBObjCMatcher containElementSatisfyingMatcher:predicate]; -} - -NIMBLE_EXPORT id NMB_endWith(id itemElementOrSubstring) { - return [NMBObjCMatcher endWithMatcher:itemElementOrSubstring]; -} - -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_equal(__nullable id expectedValue) { - return [NMBObjCMatcher equalMatcher:expectedValue]; -} - -NIMBLE_EXPORT NIMBLE_OVERLOADABLE id NMB_haveCount(id expectedValue) { - return [NMBObjCMatcher haveCountMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_match(id expectedValue) { - return [NMBObjCMatcher matchMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_allPass(id expectedValue) { - return [NMBObjCMatcher allPassMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_satisfyAnyOfWithMatchers(id matchers) { - return [NMBObjCMatcher satisfyAnyOfMatcher:matchers]; -} - -NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException() { - return [NMBObjCMatcher raiseExceptionMatcher]; -} - -NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line) { - return ^(NSTimeInterval timeout, void (^action)(void (^)(void))) { - [NMBWait untilTimeout:timeout file:file line:line action:action]; - }; -} - -NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line) { - return ^(void (^action)(void (^)(void))) { - [NMBWait untilFile:file line:line action:action]; - }; -} - -NS_ASSUME_NONNULL_END diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.h b/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.h deleted file mode 100644 index d2a54d2f..00000000 --- a/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.h +++ /dev/null @@ -1,11 +0,0 @@ -#import -#import - -@interface NMBExceptionCapture : NSObject - -- (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)())finally; -- (void)tryBlock:(__attribute__((noescape)) void(^ _Nonnull)())unsafeBlock NS_SWIFT_NAME(tryBlock(_:)); - -@end - -typedef void(^NMBSourceCallbackBlock)(BOOL successful); diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m b/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m deleted file mode 100644 index 0a882b7c..00000000 --- a/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m +++ /dev/null @@ -1,35 +0,0 @@ -#import "NMBExceptionCapture.h" - -@interface NMBExceptionCapture () -@property (nonatomic, copy) void(^ _Nullable handler)(NSException * _Nullable); -@property (nonatomic, copy) void(^ _Nullable finally)(); -@end - -@implementation NMBExceptionCapture - -- (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)())finally { - self = [super init]; - if (self) { - self.handler = handler; - self.finally = finally; - } - return self; -} - -- (void)tryBlock:(void(^ _Nonnull)())unsafeBlock { - @try { - unsafeBlock(); - } - @catch (NSException *exception) { - if (self.handler) { - self.handler(exception); - } - } - @finally { - if (self.finally) { - self.finally(); - } - } -} - -@end diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.h b/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.h deleted file mode 100644 index e5d5ddd2..00000000 --- a/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.h +++ /dev/null @@ -1,18 +0,0 @@ -@class NSString; - -/** - * Returns a string appropriate for displaying in test output - * from the provided value. - * - * @param value A value that will show up in a test's output. - * - * @return The string that is returned can be - * customized per type by conforming a type to the `TestOutputStringConvertible` - * protocol. When stringifying a non-`TestOutputStringConvertible` type, this - * function will return the value's debug description and then its - * normal description if available and in that order. Otherwise it - * will return the result of constructing a string from the value. - * - * @see `TestOutputStringConvertible` - */ -extern NSString *_Nonnull NMBStringify(id _Nullable anyObject) __attribute__((warn_unused_result)); diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.m b/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.m deleted file mode 100644 index 329d39a0..00000000 --- a/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.m +++ /dev/null @@ -1,6 +0,0 @@ -#import "NMBStringify.h" -#import - -NSString *_Nonnull NMBStringify(id _Nullable anyObject) { - return [NMBStringer stringify:anyObject]; -} diff --git a/Pods/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m b/Pods/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m deleted file mode 100644 index 35f26fd0..00000000 --- a/Pods/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m +++ /dev/null @@ -1,78 +0,0 @@ -#import "CurrentTestCaseTracker.h" -#import -#import - -#pragma mark - Method Swizzling - -/// Swaps the implementations between two instance methods. -/// -/// @param class The class containing `originalSelector`. -/// @param originalSelector Original method to replace. -/// @param replacementSelector Replacement method. -void swizzleSelectors(Class class, SEL originalSelector, SEL replacementSelector) { - Method originalMethod = class_getInstanceMethod(class, originalSelector); - Method replacementMethod = class_getInstanceMethod(class, replacementSelector); - - BOOL didAddMethod = - class_addMethod(class, - originalSelector, - method_getImplementation(replacementMethod), - method_getTypeEncoding(replacementMethod)); - - if (didAddMethod) { - class_replaceMethod(class, - replacementSelector, - method_getImplementation(originalMethod), - method_getTypeEncoding(originalMethod)); - } else { - method_exchangeImplementations(originalMethod, replacementMethod); - } -} - -#pragma mark - Private - -@interface XCTestObservationCenter (Private) -- (void)_addLegacyTestObserver:(id)observer; -@end - -@implementation XCTestObservationCenter (Register) - -/// Uses objc method swizzling to register `CurrentTestCaseTracker` as a test observer. This is necessary -/// because Xcode 7.3 introduced timing issues where if a custom `XCTestObservation` is registered too early -/// it suppresses all console output (generated by `XCTestLog`), breaking any tools that depend on this output. -/// This approach waits to register our custom test observer until XCTest adds its first "legacy" observer, -/// falling back to registering after the first normal observer if this private method ever changes. -+ (void)load { - if (class_getInstanceMethod([self class], @selector(_addLegacyTestObserver:))) { - // Swizzle -_addLegacyTestObserver: - swizzleSelectors([self class], @selector(_addLegacyTestObserver:), @selector(NMB_original__addLegacyTestObserver:)); - } else { - // Swizzle -addTestObserver:, only if -_addLegacyTestObserver: is not implemented - swizzleSelectors([self class], @selector(addTestObserver:), @selector(NMB_original_addTestObserver:)); - } -} - -#pragma mark - Replacement Methods - -/// Registers `CurrentTestCaseTracker` as a test observer after `XCTestLog` has been added. -- (void)NMB_original__addLegacyTestObserver:(id)observer { - [self NMB_original__addLegacyTestObserver:observer]; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [self addTestObserver:[CurrentTestCaseTracker sharedInstance]]; - }); -} - -/// Registers `CurrentTestCaseTracker` as a test observer after `XCTestLog` has been added. -/// This method is only used if `-_addLegacyTestObserver:` is not impelemented. (added in Xcode 7.3) -- (void)NMB_original_addTestObserver:(id)observer { - [self NMB_original_addTestObserver:observer]; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [self NMB_original_addTestObserver:[CurrentTestCaseTracker sharedInstance]]; - }); -} - -@end diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj deleted file mode 100644 index fed21565..00000000 --- a/Pods/Pods.xcodeproj/project.pbxproj +++ /dev/null @@ -1,5534 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 0038FAE5A0CCED46FC7046DF587B2243 /* XCTest+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9AB4E3B5E6E0EA3B8B9B99DF46CD96A /* XCTest+Rx.swift */; }; - 004A7C94DB016DC6C5CB064A383CEC59 /* RLMObjectSchema.h in Headers */ = {isa = PBXBuildFile; fileRef = AA2358C12FB2240A3DA7703004D3EF17 /* RLMObjectSchema.h */; }; - 00C2511D3EB1D249D908F8A8D7D1C810 /* Using.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD520CE7E7239BF77CCE073A8BF2EB8E /* Using.swift */; }; - 00CAC914662A338E2865058F4BADD5A2 /* RLMObjectBase.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = B54E8EE5A67BAF0E3BA65C7AF73361F6 /* RLMObjectBase.h */; }; - 01EFC4C97CE1FC51BBD9E4788B7B47C8 /* ObserverType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70D181751AE81CDA7BB7711225488CA3 /* ObserverType.swift */; }; - 0238D5468CFEF4B5E424CCA54DA105F1 /* DelegateProxyType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46B11D9ED9998049254C57399B0671D3 /* DelegateProxyType.swift */; }; - 027CE8DFB431262070F801BB3AB9DC90 /* RLMProperty_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = FC207590A5FC79B5F2876F39287DDD34 /* RLMProperty_Private.h */; }; - 028B1C4625DAF6FD648957CB649F1115 /* RLMSyncPermissionChange.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 09CA29D163C4A81B573A815A943B909E /* RLMSyncPermissionChange.h */; }; - 028C4E168F297D84172E8108D30AD62E /* Observable+Concurrency.swift in Sources */ = {isa = PBXBuildFile; fileRef = B58A17614C170BB578C0CF4B63E4A805 /* Observable+Concurrency.swift */; }; - 02958E3E95A39E369A17379EFB4B6818 /* SynchronizedUnsubscribeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = E31FCD0AEA3AFD5AB8F1A9CB36071E14 /* SynchronizedUnsubscribeType.swift */; }; - 031EADD1F66083AFDBB3926BE73689DE /* CompositeDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7538D00F21F7D591ABDA749CF6C3959B /* CompositeDisposable.swift */; }; - 03C9E8960AB73B4BF98F390661C2B764 /* RLMMigration.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 19C9139587A0BA340E56221ED8C0BFDF /* RLMMigration.h */; }; - 04AE1DC56A0C088489EA27CED5190838 /* Stringers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D4F870392098A336DBBE73DB36D7565 /* Stringers.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 04F1333C07921C5CF8C85689863DCE40 /* RLMMigration_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 79587E31E603FA8B4DF3FABA69304C71 /* RLMMigration_Private.h */; }; - 05095A78C447F2825F0143AE86199D99 /* Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = E74965087A941114772D04B6C982AF19 /* Driver.swift */; }; - 05129E5528EC6FC21EBC90FEB9A23703 /* Producer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 092FA86B8002A03741E806731B57D444 /* Producer.swift */; }; - 0522A860E6FFB5AD0D40BCD4CDA2D39A /* collection_notifications.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DF8F0E2233CD8F6B901DFE255E381F7 /* collection_notifications.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 0551871E9AB5CCB96D45F4CD7D1808E3 /* RLMSchema_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = D8A20375F4A84061C6B4E3EF2DAB140F /* RLMSchema_Private.h */; }; - 05CC3AED612A73460690CB7D8C5D8B1D /* RxTableViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 83E711AC617EE79D5719C77D84568D61 /* RxTableViewDataSourceProxy.swift */; }; - 0702CFD183DDB744D7EF0BF1152036A9 /* RLMSyncUser.h in Headers */ = {isa = PBXBuildFile; fileRef = D80DAD9DCF476D933384B3CCBA0F4C2B /* RLMSyncUser.h */; }; - 074E23FEFC1D302C556E4DA73AE7818A /* SynchronizedOnType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82F60631C865A4D18BB6AC807121D734 /* SynchronizedOnType.swift */; }; - 0780C21E8FAD599F71A5A8D2238D730A /* Reduce.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01FA738286EDB78D4DEA81877FB6F38A /* Reduce.swift */; }; - 07C26352152E78A50E11C951888594D9 /* ConcurrentDispatchQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B16EF6020F24C00DA5420E8B89BE1E8 /* ConcurrentDispatchQueueScheduler.swift */; }; - 07E27E76E425DE09CE7D615B1C48D729 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC779AAB6131AEB402A39824AB090711 /* RxSwift.framework */; }; - 0860EDC510A80C60D061332D077C17FC /* placeholder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6261ABB26A06A5A78C1882286643E8C /* placeholder.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 08C2195D2E2DA6BAAF02EDD0682BAE6F /* Sink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87A84264C64C45ED2BD758C26F02FD6B /* Sink.swift */; }; - 08FD4F5F7826753B3C660394BFE64263 /* ObservableType+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0345ECE2099E714228B5AC19D4D68858 /* ObservableType+Extensions.swift */; }; - 094E407D7B60EC732A73BDB966667696 /* RefCountDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 66F960C5CB35AA50C12D2CF398D2E7C6 /* RefCountDisposable.swift */; }; - 09798F290110ED61A5C78894817C4F79 /* UIStepper+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4D7EAC9D7DDECFF26379A565A656DC8 /* UIStepper+Rx.swift */; }; - 0A50244B3CDA684A1040A07757642BE4 /* RLMSyncPermissionChange_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BFB4F3168E45943ABFB5A3C6F1095BB /* RLMSyncPermissionChange_Private.h */; }; - 0B5FD5498E20D2C88030B4F0CDB5F011 /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BA27878FE6C0B9657EAF8BCA96C71C8 /* RecursiveLock.swift */; }; - 0B66CBCFAC9EEF560B1997493EC72D59 /* _RXDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = AE208C7710B81B7DB545B3C47BCE671A /* _RXDelegateProxy.m */; }; - 0B846370B6EA04F7D7909A403DD16317 /* CwlBadInstructionException.swift in Sources */ = {isa = PBXBuildFile; fileRef = C19A57FED1E6BAEEB96AD5D4942B31D3 /* CwlBadInstructionException.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 0BF5D28410FF5E483CD636909F58B761 /* RLMRealmConfiguration_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = C555FD10571F74DAE34500F844CB34CA /* RLMRealmConfiguration_Private.h */; }; - 0CBAC4A242DB22A93BB0513CF11EEC3D /* RLMSyncUtil.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 1D2B9940FB9B64166D596E8557D5A808 /* RLMSyncUtil.h */; }; - 0CBC24F25CEAF534664A5EB7F72748DD /* UIActivityIndicatorView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 453FAF80D4E039A7FE62AFD5A8240609 /* UIActivityIndicatorView+Rx.swift */; }; - 0D30D044EC92CE4C8FE00FBCD51850FF /* Observable+Time.swift in Sources */ = {isa = PBXBuildFile; fileRef = E75BC693E7D92E8F3D03FA21EE9AD428 /* Observable+Time.swift */; }; - 0D4B1951108CF54E1968467D30C351B5 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BF3FA788E8E5602FEE9A5F090EE93C6 /* MatcherFunc.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 0DF2D4E6B55D67E28D8BE9EC5A25F24E /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6212B5E1406A44C5AF532CAF7B94511 /* Async.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 0E10A25085E10F70B24A400824EC0091 /* RxBlocking-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8BBB7E0B4D592B340B7627F9E7E47938 /* RxBlocking-dummy.m */; }; - 0E28DE1B6297A83BCCC9E50745116C4A /* UIWebView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA125B544144AE7113CA11C137B5370E /* UIWebView+Rx.swift */; }; - 0E7A765087D618AB742E4C047653BC55 /* RLMRealmUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = 248B75378699A4E685CFDADA3B8CAC41 /* RLMRealmUtil.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 0FD10EC4CD742E8A2EAEC6D3245DCD86 /* BinaryDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C2F88B8545B66CBC3BEC7250E684A54 /* BinaryDisposable.swift */; }; - 10165E35AB7CAA2704185FA58DD93CB4 /* realm_coordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FBC32FCE9A7D8DB312E6DE40B882E6C5 /* realm_coordinator.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 10B953E63951E8DB495AA5B5EBDBBABA /* PostNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FB1C45406525141D43BD202BFD4601F /* PostNotification.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 10FB0F937A957B2845C0C748AE3C9DFE /* RLMConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = DEC184AC85553054659581B7240F098D /* RLMConstants.m */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 1156C06DA6A931174DCBC7948A15BA20 /* RLMSyncUser.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = D80DAD9DCF476D933384B3CCBA0F4C2B /* RLMSyncUser.h */; }; - 11EEDB6DB6F03E2AF3FC368AA32274AC /* ThrowAssertion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0FB4B0C151C53589DDA9F00F0030A6E4 /* ThrowAssertion.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 1200E3E2E38164F7FE431BDFC4A83C4A /* SkipWhile.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB6F36CC9B7AA1EBA88BC20EF65605A6 /* SkipWhile.swift */; }; - 123D36BB9CA549C55BBE6FC7D21BAB97 /* NMBStringify.m in Sources */ = {isa = PBXBuildFile; fileRef = 75327AB63E4F7E973B826E8D33D0A655 /* NMBStringify.m */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 1271188962C817ED2AF614F2A3B28799 /* NSObject+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04755FFA86DD547A2EC9D4A3832B0B2C /* NSObject+Rx.swift */; }; - 13BC74A727AF9AE419BC258692FCFFCC /* UIProgressView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9873284E3734D478A44DB5469041A77 /* UIProgressView+Rx.swift */; }; - 1427108D787A8EA22063013C3A85AC56 /* UIDatePicker+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23E3CA0E92CF4E32082E5FB0CD7632ED /* UIDatePicker+Rx.swift */; }; - 14411AFBAFE09692492DF031BB5B550F /* Event+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC5FAA30414B06944F6763C7A849859A /* Event+Equatable.swift */; }; - 1520C8FECD6EB99CAC68AFF4C1074B63 /* RLMObject_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = D60C73374AF1C9A11387557CCDE4485F /* RLMObject_Private.h */; }; - 1558F932D2EAE64D9FC0C1CBC29CF635 /* format.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C155F3210E736DC8F707C661517CA3C /* format.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 16127B907D81BB985CF063B8C3330CBA /* RLMObjectBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 32BCBA134D69CD39AE23D5A005F035E2 /* RLMObjectBase.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 1621585E40485409856BB2CFD5FA8ECE /* Skip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 209F4C1D14383101977209F0972A8D40 /* Skip.swift */; }; - 163488075238790421628D50E5519BFC /* Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65F6A58026C6EED2818FCE1A270C466C /* Filter.swift */; }; - 17222310C3CD050F89CFD6F70931FDDD /* RLMRealmConfiguration+Sync.h in Headers */ = {isa = PBXBuildFile; fileRef = A1C84A6BF14AB41A9CD563155675C452 /* RLMRealmConfiguration+Sync.h */; }; - 17426A2C50A2490A4789C20BB9E03ED5 /* Repeat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04091A58B1790A6548EF098AE66CF3A9 /* Repeat.swift */; }; - 1748611683DFCC5121CB15AD467702CD /* DistinctUntilChanged.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5976406626019A4510709DEC0D775315 /* DistinctUntilChanged.swift */; }; - 17F48B037F9592836678BCFB7C1E28D2 /* Pods-CoreDataPlatform-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = B5440177F5179769B6F62D590A26E693 /* Pods-CoreDataPlatform-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1841DE2CF9A35CE60778F31A35FD7289 /* SharedSequence+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40A91CAD49F801AEF2040179CF6FB9D0 /* SharedSequence+Operators.swift */; }; - 19E1F6E45CF33A5D70E736B65143CAC8 /* GroupedObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C95112385932116CE17EB9AB8D181A /* GroupedObservable.swift */; }; - 1A5384100C4F32F0E2DE06E18EF099D4 /* RxTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82D866DD022BC145686ED68C49589590 /* RxTests.swift */; }; - 1B6F84F1CFD72BC6F0BC2CBE8BD237B3 /* Pods-CleanArchitectureRxSwiftTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 22F13FC131FEBD6B1E0EA44C27EAA523 /* Pods-CleanArchitectureRxSwiftTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1C37D984F1BBBC7278E1FB6BDB153892 /* CwlCatchBadInstruction.swift in Sources */ = {isa = PBXBuildFile; fileRef = E160F93F4C043688D81D2F3471469690 /* CwlCatchBadInstruction.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 1C4D32A8B4BE4F0550573A582A4D9B44 /* ScheduledItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBD37B96914326B6D403C752454FB28F /* ScheduledItem.swift */; }; - 1CF0AEF1D95657ACEBEB05CE8D6D86BE /* Observable+StandardSequenceOperators.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA764D488DA21265DCB666D506B91F36 /* Observable+StandardSequenceOperators.swift */; }; - 1DD25B641CB9A691C5416933C5E5D494 /* RxRealm.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC8979BACCB986B1895235C7A8862251 /* RxRealm.swift */; }; - 1E0C2A0F63071B93DC4F3FC06E318D8C /* Object.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CC63AB5E7C63726A6DB408222F484CF /* Object.swift */; }; - 1E1E331C95FF318B92EA1B028669EFAE /* Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC936A807878C4A12B3F79CB60B8E42C /* Rx.swift */; }; - 1F59FA29FCD1E3ECEC0DAB1870697FA3 /* DisposeBag.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD5F14DC655D910221783AA947DD700A /* DisposeBag.swift */; }; - 1F707004C05C63F90F0030E8E4902D66 /* BeLessThanOrEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7DCDC3E80BD1902283A39F5F01A9D86E /* BeLessThanOrEqual.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 20477B8EB84E411CCD250DC48F5A225A /* InfiniteSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E92742A4FDFA16695FA81A88278F08D /* InfiniteSequence.swift */; }; - 2173F4681D2DDDF63A01A7439EDE1FD4 /* NMBObjCMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 978F38FE83D29E7EF9C4E95C1BADEB6C /* NMBObjCMatcher.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 21C581601DE68512FE7F4CC5930A4DB6 /* Just.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C6939167CFD590D922C61EC97874F3A /* Just.swift */; }; - 22E6C7671AC663A40758CC59C8CD9B7D /* BlockingObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = C57476FAC6A0C52BA090C6D4B5BB9649 /* BlockingObservable.swift */; }; - 233775CCE20C4C44BD89804941677FC3 /* CombineLatest+Collection.swift in Sources */ = {isa = PBXBuildFile; fileRef = CECD5B91706E6F398912E7F13BD6384A /* CombineLatest+Collection.swift */; }; - 238B66DE909D6EFC97D6322C033F682C /* Util.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB9CAA431B02149E5221455001A1AE31 /* Util.swift */; }; - 23D4105F4D7E9C3F35E8F43CD56548FE /* Observable+Aggregate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4292DCD72C6D25F38487976F95E8A1DE /* Observable+Aggregate.swift */; }; - 23D48ECB6FCEFE3B5F19343E02C51296 /* RLMResults.h in Headers */ = {isa = PBXBuildFile; fileRef = 5F3462BE4A577BA487B2A9108E90F763 /* RLMResults.h */; }; - 23F653F66B7953162F2FD99330E5A4EA /* ColdObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1E6547B9D6243D4CF71A0C77BE85465 /* ColdObservable.swift */; }; - 24D888587E676C6F70C5BB1F0F682589 /* Take.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BACD7D12DBE83767BEB0ECD5EAC5610 /* Take.swift */; }; - 25618586568456111144702323B0EE8D /* Aliases.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D6BF12283E0B530F91741DBA29B1319 /* Aliases.swift */; }; - 273B7E556D46FA80BB7BD3B8F83A581D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - 274CD942EBC2FAF7E9DD5EDD7E988B17 /* RLMProperty.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = CBE2E0B290CF9163911607C23E090D9C /* RLMProperty.h */; }; - 27A1C6A11842EDFB253A7A31D3902677 /* RLMObjectBase_Dynamic.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = B08D726E62BB67BA300B3BEC98BD0227 /* RLMObjectBase_Dynamic.h */; }; - 27B911F164F453EE43F617648F43EA50 /* ObservableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAEAA9EE9B3496B70B3A080292393D87 /* ObservableType.swift */; }; - 288DBE855F794BA1AE8BC47AA413693E /* BeginWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5B5A413CCB125AE95B36D10B52C498E /* BeginWith.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 296265B2129505B5A0FED45465FB265D /* Logging.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1A560DF846C100753A99E9A04F177D9 /* Logging.swift */; }; - 29EAA8AB5DAD907283C5C24EDB9CA2CF /* _RXKVOObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 763EF4959E0C4B33459C3D414E0DFEEE /* _RXKVOObserver.m */; }; - 2A39A00D7AEC4370BD0BBC73302489C8 /* RxCollectionViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B6FAEB331EB95EA708A46D197CC4168 /* RxCollectionViewDataSourceType.swift */; }; - 2B1034E4C47757714971C72F594602B0 /* RealmSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53CB3018CC908AE0B39B5FAD841C02E4 /* RealmSwift.framework */; }; - 2B46BE7A94A0F6CBD536AA24CCAAF04B /* RLMTokenModels.m in Sources */ = {isa = PBXBuildFile; fileRef = 54168AB68346D9C62335D17484B6BD5B /* RLMTokenModels.m */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 2B74A62461CDDBA26B280AED72D0225B /* Bag.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA91C5789039F5EE1DF36450BC6FCEA7 /* Bag.swift */; }; - 2C0F749387EF5BC809535FEDF403A37D /* UITextView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB56B533DB96A224DFABAED89D4D96CA /* UITextView+Rx.swift */; }; - 2CD126201F6E26AD39BC437D8E9750C9 /* NopDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2783992A84439EA1893A28DF0A37757 /* NopDisposable.swift */; }; - 2CD40505E27031B84521B0CA9F433BB1 /* DispatchQueueConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68B808DD1239D92B2CD72AA1D534FE02 /* DispatchQueueConfiguration.swift */; }; - 2D8C1636B4ADFC51E5833F941519B9BE /* RLMSyncPermissionOffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3007808C7A2C2295B71CB84F98CB8788 /* RLMSyncPermissionOffer.m */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 2DAB9F3B0542B57D15A5FE4FED89F7FB /* RLMSyncUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 1D2B9940FB9B64166D596E8557D5A808 /* RLMSyncUtil.h */; }; - 2DC88DDB75B4F3AD2EAAFB6E9ECAACCA /* NSError+RLMSync.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = A3B9206E6EAB97E39A1B218C5DC6E21D /* NSError+RLMSync.h */; }; - 2DDAD51A54FD6A69CD245C3067222E2B /* Pods-CleanArchitectureRxSwiftTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A70BC8106A92C9B6BCD22E56083E124 /* Pods-CleanArchitectureRxSwiftTests-dummy.m */; }; - 2DF80575B9759A9E8004F4F642D0D123 /* ContainElementSatisfying.swift in Sources */ = {isa = PBXBuildFile; fileRef = 355C96D7E6DA49624176F800F4276141 /* ContainElementSatisfying.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 2E11F501621B848A83AF9A7A21BE21F0 /* RLMSyncPermissionOfferResponse.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 8EA94F6951EDBCE65EE3ABA35A6E8F6E /* RLMSyncPermissionOfferResponse.h */; }; - 2E3A9838B424530CD39AB60F18B42EC8 /* LinkingObjects.swift in Sources */ = {isa = PBXBuildFile; fileRef = F62981846211AB9A56BC9DE108E81476 /* LinkingObjects.swift */; }; - 2FC76CE3A378AD261A9F43C4C056A6FA /* TakeWhile.swift in Sources */ = {isa = PBXBuildFile; fileRef = E726364160961DC7CA6554453D9B3C38 /* TakeWhile.swift */; }; - 300D21FD30F1080EC0226E4BB7F269D6 /* RLMArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A6587BBA0993061ACD6A225501F6C907 /* RLMArray.h */; }; - 30B87EF91D4948153D503A258B58D49C /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C814A8BF612F67498C6C2BC34E6C2C4 /* Error.swift */; }; - 30F7C0185D1A4F4119757895A82C02AC /* NotificationCenter+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A78EA70789CFED1187666227105C133 /* NotificationCenter+Rx.swift */; }; - 30F80459D8D536D8B99880EDD353987A /* BeGreaterThan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5239B3D651CB232F32021273593EDD83 /* BeGreaterThan.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 31402AE5C2DBCC764AAB2781BE05CB61 /* SubscribeOn.swift in Sources */ = {isa = PBXBuildFile; fileRef = A787E97336FD45CDDF79B761294A02D2 /* SubscribeOn.swift */; }; - 318F9AE6D9561CFB487071A821B4217D /* BeLessThan.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABE583707D2E82BCC386E782B54DF72E /* BeLessThan.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 31AA18E8435C3629E08654254662881B /* TakeLast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F526232925C1A53B777B03207F790D9 /* TakeLast.swift */; }; - 31F7CF7ED198AB52DB0C17C54E5C8980 /* ControlTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = F764790299E276D41B15B956E08DF02F /* ControlTarget.swift */; }; - 3245792BC5FA40FA5C058364FA28F266 /* NSTextStorage+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8DCD9A35F302AA2A689F93A69C685B0C /* NSTextStorage+Rx.swift */; }; - 32AB6828BB98A679D3EBCC16C7BE9566 /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C675C0A74C682A44C4E08772DA6F3B0 /* Functional.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 32BA52A477DB0589093812F0AE6225E1 /* WithLatestFrom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47D75A8BFFF4212F4969780ECF3AEE1B /* WithLatestFrom.swift */; }; - 33800B8BE4B478F3E0E85BDFEA1871E4 /* Catch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73FB40DDCBAAB504D3EA21A28D77E2CE /* Catch.swift */; }; - 33F39E3DBE5219C69D290B0791EBEE04 /* Observable+Creation.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC9C07BFD9E5285640958FD1F757A3B1 /* Observable+Creation.swift */; }; - 3413BE623857A95EB359BD570D5696E3 /* VirtualTimeConverterType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3F4B3E20EC2AC39A861AAACC78EA132 /* VirtualTimeConverterType.swift */; }; - 344A1302DA4AE22A9A7CA1E3D9F1D62E /* InvocableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05FBC618FE607B32B230E614F5E23BD4 /* InvocableType.swift */; }; - 34AECA25BD452A0C649518DD95C27538 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC779AAB6131AEB402A39824AB090711 /* RxSwift.framework */; }; - 34E0569B2666F68A70EB676EFDCC4434 /* CwlCatchException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84F1C0AC877B51B7ACF21232AE9CEFB3 /* CwlCatchException.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 34E1A3BCB1963E37E43D9E7C53CEE33C /* Debounce.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85CABC513996516722136DD552AAAC99 /* Debounce.swift */; }; - 358FC0B058CC806759A2D2AD66616FF0 /* RLMArrayLinkView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 475FD510C5E88D7756730D9BE72F0434 /* RLMArrayLinkView.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 35FAA1CD88C538E3B7CDBE983BB68123 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - 374F524B385804E0F6DA1ADE2089E03D /* sync_session.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 82CF0AC20AA633380BB32EFCD43569A7 /* sync_session.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 37FB1246AFEEF33D0815180B66DFAF63 /* UIButton+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18CF0CACF92757CC2590C03214C9CC7E /* UIButton+Rx.swift */; }; - 383B3EF018CDFD095EFEB7D74769144A /* EndWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3F88767FB9DAAE2147BA4AFC0F324D5 /* EndWith.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 38ADA3219A190567A959C954807BF55E /* RLMListBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = BD0D3D502C52C530869CB471A41E1EB0 /* RLMListBase.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 38DBCA990F02F3F16CF802311F85842D /* Bag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44C2C85A52F1FAE6B3B17CEB044A4AB7 /* Bag.swift */; }; - 392B3F1DDF3A8F2DF5AD9F814D10D0B8 /* RxTest-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 96BBA5CDAC52B30D246E512DD3D26532 /* RxTest-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3951A75F43A20D2347494F90C7577378 /* ItemEvents.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2005A2F0B8500820258925CE1765C34 /* ItemEvents.swift */; }; - 39DB9955D3010101CC9CD689EEC4C39D /* AddRef.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAB57A78D701A804B22FEF812B0BB979 /* AddRef.swift */; }; - 3A5CEB64EE64A78FFA05521784AE5971 /* Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA2D0F53DBA0078A870976910A7C078B /* Debug.swift */; }; - 3A8F394C5D970BD27ECA1F7BF9F776D5 /* RealmSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = E96371DF4BBAA27834C93DAEA5F0DD3D /* RealmSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3B70255ECDF50CB576C279421E697729 /* RLMObjectStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 41759AABE84C08A37113D6E35E9A53EE /* RLMObjectStore.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 3B761FC7120A3636564CDFD489484247 /* RLMSyncUtil_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 6031907F5FB40AC1819F8F4D5DD23CB8 /* RLMSyncUtil_Private.h */; }; - 3B7C23A5E701F72531E186D42D6B0EEB /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD4F0F4F7611B59EB7B852A2897AEB06 /* Errors.swift */; }; - 3BB5E1969E527FEBB22C1FD04747AD5D /* UIPickerView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 290E91EC5CB09B9DE450FDC4F42BB6BE /* UIPickerView+Rx.swift */; }; - 3C10F87A78719796C1A119BCE11C0441 /* Reactive.swift in Sources */ = {isa = PBXBuildFile; fileRef = 647B2D7490F994843E8AF357DA2D339D /* Reactive.swift */; }; - 3D89C4ED6C5F24152D8B5B490E5DD578 /* Concat.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48E4D2FF3238DCF2F4E7CF0EFDF6A0CC /* Concat.swift */; }; - 3EE385B1BE79C7DFDD83A7CE518BEF4D /* Attribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC56074901EBEF20D23A74EAE9253DDD /* Attribute.swift */; }; - 3F610CB9745DAC571E2601BF84B80097 /* SingleAssignmentDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3A4EAB6B11F014FE29FF10E4616E668 /* SingleAssignmentDisposable.swift */; }; - 3FF8DB5245B79D96C7010A74AA6DC611 /* results.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EE0CAA07155179BF3F081117D6587F8A /* results.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 404C7DFDD8D106B937A4857770E8B00F /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87FAB44ABC252FE3A6CA52CAEE54FF41 /* RecursiveLock.swift */; }; - 405F2EFCFCB4A37597D101CA594A825A /* Resources.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A2EEEA2D447627757BE4857F136CC5B /* Resources.swift */; }; - 409A3ECDDC680D0BD343E3F203862E25 /* Nimble.h in Headers */ = {isa = PBXBuildFile; fileRef = 83EC45B0515EC5AA0B8BEE99D3A98DC7 /* Nimble.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4349A31B53679F746D9EDF061D51C665 /* BooleanDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8895468BF142846DD869960F6D3AEFE9 /* BooleanDisposable.swift */; }; - 4471DBCF8CBD0CD74F4BE88BB5BA83AC /* Zip.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01312618C8A9DE3BF0AB661508430F78 /* Zip.swift */; }; - 4565B63BFECF9195A1BE74835D7C234F /* UISwitch+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7ACEB311ECFA84D9FD17B6E87C05CFE /* UISwitch+Rx.swift */; }; - 45AEF7916B711832D47DEDC9D21BCBFB /* SynchronizedDisposeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1543FA1B38905618379CEAC6A4136358 /* SynchronizedDisposeType.swift */; }; - 469C7D38B75CEBB7C580CA06EE97E1BC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - 471BD3BEC316BA65B26D3EDBC9A7FA52 /* UISlider+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C12E18EB9076B86DCB54CB5CEA607A82 /* UISlider+Rx.swift */; }; - 47635387B42AFA4043860933076B3D54 /* RLMSyncCredentials.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AE7B534F16968B523BD7E569F148363 /* RLMSyncCredentials.h */; }; - 47EA53518FF80112971054A53F1615D0 /* ShareReplay1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58C066AD56238C1D6F01C12799C6BA49 /* ShareReplay1.swift */; }; - 485AA0A2AF45FB43ABCDA55C440F57DB /* RLMObject_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = D60C73374AF1C9A11387557CCDE4485F /* RLMObject_Private.h */; }; - 48FBD0ADD4877FC7EDF916833F156A59 /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADFAB4721B073AD66157837FAD1C4BF7 /* Realm.framework */; }; - 4986900E17B22F8648EFCF5C235F0BCA /* Multicast.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD16B879B46399C1A79AE65F9429917B /* Multicast.swift */; }; - 498BA94B3767BB81531AE5BDEC5FC027 /* RLMSyncConfiguration.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 237D4E8B60CF721ED681A3052F2BECA9 /* RLMSyncConfiguration.h */; }; - 49F4FED74BFDF7BF9E87665F1B701362 /* sync_metadata.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C25316696EA3FD3FCBCCD3E7E5E60DF1 /* sync_metadata.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 4A17E1DB4EA2CCBF04B76F5F8EB417A1 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = B43027225C56E595F5E913D502663CAE /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4A260A283B42CD2B1CB3ED25BDC1321F /* Window.swift in Sources */ = {isa = PBXBuildFile; fileRef = 010615A01409020BA1C725CE32E0E35D /* Window.swift */; }; - 4A3E2391B796DCD62D06550B23ED354A /* RunLoopLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73D5044680BB9382E25FDC882F516522 /* RunLoopLock.swift */; }; - 4A802E45AF58A980E74B0221253135D2 /* RLMSyncSession.mm in Sources */ = {isa = PBXBuildFile; fileRef = CFC2CB297B7568B9481BA1075998CB58 /* RLMSyncSession.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 4AB2B56D0B7EF259DE58070FEA36D229 /* SchedulerServices+Emulation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659BF5AFED33E42956343E8559221A17 /* SchedulerServices+Emulation.swift */; }; - 4AD3B03D430BFC47A0092202AE2F6A33 /* PriorityQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A1FB18B7E477EE3BD21E3FFE700B50 /* PriorityQueue.swift */; }; - 4B6579FFF0062EEBBABB8336C0871171 /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = C61C62CBB65B867F80D32CF5E6A0FFE8 /* Errors.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 4C522F4B5535AA948BD64BEEEE708BF6 /* RLMProperty_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = FC207590A5FC79B5F2876F39287DDD34 /* RLMProperty_Private.h */; }; - 4DF409E8CBE6462BE4A4A8EE9613F445 /* RLMAccessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 9EE14CD66DEAC50B04FB05EC9EE4D7EE /* RLMAccessor.h */; }; - 4EC97CCB28B555BEAC3BB85C8A08D2ED /* RxTabBarControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5D15835D0AB5E9B05210AB236D8952B /* RxTabBarControllerDelegateProxy.swift */; }; - 50C04849FB5A983FAE9F302B994AA8D5 /* ControlProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CB5CB6AC67FFD9DA0B592F391800792 /* ControlProperty.swift */; }; - 52D954B843F8F7E11964793FEB6C192C /* RLMListBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E80CDB97E97899BD0038B78302ADB3 /* RLMListBase.h */; }; - 538E4457CAFA7E5389267D5806D9DF13 /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BCE4F1C204A76349723E6450F8FB06D /* Platform.Linux.swift */; }; - 53E2E72544E67C0C9B4B011EF5E59A6D /* RLMSchema.mm in Sources */ = {isa = PBXBuildFile; fileRef = 061B315CD14BB732ABE81D3E9A24E1F6 /* RLMSchema.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 54B6FCD3AE128214AEAA0BC2D99F72C7 /* AnonymousInvocable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AB78650825C442F4DB5617DF9A60D6D /* AnonymousInvocable.swift */; }; - 5501848A986A91A35E796A927290FCBE /* QuerySet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EBB488FCFB93905CF0BFE1F0512968C /* QuerySet.swift */; }; - 551219DCDDC09C85FAB6A9A15B558E98 /* UIControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4E9F674E5D41EFBB3474C816A789F644 /* UIControl+Rx.swift */; }; - 5517BF419724743A1F506FADF0D95B08 /* Optional.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCE55DB8FB0AB2E413DB6F50F46406DE /* Optional.swift */; }; - 5666FFE8CEB3F28A62E834AC0E2FB76A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - 56685948CFA256789DA450BFDEF4A15A /* Property.swift in Sources */ = {isa = PBXBuildFile; fileRef = F37EEEA6DF79DE035BF9694CDE83749D /* Property.swift */; }; - 5685322E421AB4DA6A91B26C09833B29 /* BeIdenticalTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E651B8C4B3321D6784A7A05DD142E59 /* BeIdenticalTo.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 56C97081D5B4125752F0E9D981FE8D37 /* SortDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AF941F3C8CC0E7B773DB318A6D2A2CB /* SortDescriptor.swift */; }; - 5765BDD7BF7C0721BF1F47ACD6FC99DD /* UISearchBar+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9272BB7EC05AAB42EAEEB81CB1674CE7 /* UISearchBar+Rx.swift */; }; - 577FDB83C2D312581D33039DD574A0F9 /* RLMQueryUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = B54E0D7C11D62423A37856C07A5503D1 /* RLMQueryUtil.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 580A589494EEB227F32674BC2FC4C930 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - 58F311273F21BFB3138D1567EA153989 /* UICollectionView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74FE60E9D19651328FED8B65E315257E /* UICollectionView+Rx.swift */; }; - 594BFAE3EB59AF0501F9BD3CC59E430F /* CurrentThreadScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26FA3B549953A29FBCBDFE55C8AF6AF6 /* CurrentThreadScheduler.swift */; }; - 59656B1F5214178C44993CF5938F09F4 /* RLMRealm_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = C5121AA168A2C53B33839BEFD2CD6751 /* RLMRealm_Private.h */; }; - 5A5D210AEBA7220EF8DFA81BD1D2743F /* AnonymousObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69179C45B2DE5D08778AC6669F98A187 /* AnonymousObservable.swift */; }; - 5A8CDF35A2F830E16DE87403D7D50FE9 /* RLMUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = DD70AF42B51227529EC85C61C290A6E6 /* RLMUtil.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 5B2DA5AA90709F04ED19173B914B9DCE /* RLMArray.mm in Sources */ = {isa = PBXBuildFile; fileRef = D481473374DD16525B37E0B777FEE151 /* RLMArray.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 5B310F12E65785EA98F0F8078C8DFD90 /* RLMObjectSchema_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = 38039087DC23815CCBF407685CADBECC /* RLMObjectSchema_Private.h */; }; - 5B7FF1DC30E1F8DAE07C3B886563BB63 /* ControlEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = D69A9FD89F7773AC0DE5317CB4690A3B /* ControlEvent.swift */; }; - 5B863348B30BDAFED3CCC2AF961B930F /* SwitchIfEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 369A442F8D4A7AC7D1EF096638AF9426 /* SwitchIfEmpty.swift */; }; - 5C241BAAD7564DEB20A9E6FFC9E9B950 /* SharedSequence+Operators+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C863F1B3DEDA62678903E6864DB63F2 /* SharedSequence+Operators+arity.swift */; }; - 5CDE195731A9F071C0B9F7C7AB70D46F /* RxWebViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAADEF34790ABC1117C0FCFC197FBD03 /* RxWebViewDelegateProxy.swift */; }; - 5E3D61624CFB629D16E773CAA9D76EE4 /* RealmCollection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B536283BDC4C41292388887CD7B37AA /* RealmCollection.swift */; }; - 5EDAFB547B262B83F2BB1CBA4BCEBEDA /* RxCocoaRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 8228DD6D4CB3FE2917439A9502282852 /* RxCocoaRuntime.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5F7C33DAAF62C8FFE9F1C9C3AF159E4D /* RLMSyncConfiguration_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = 85D3B261B046352E80E38C49E4517546 /* RLMSyncConfiguration_Private.h */; }; - 6073CBD1D1453D44B6D03D692B72949F /* Realm.h in Headers */ = {isa = PBXBuildFile; fileRef = D73B8E9DFA10E77D6BBB7C2C0B29A483 /* Realm.h */; }; - 613C135918AF7BE03B0FA3E7DFE4B328 /* RefCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6BFE4CFD55F24BD664C94EA62163719 /* RefCount.swift */; }; - 61A0034C86CEFD1CDC770474798A444D /* SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AF5E8E6E9B553B5DC77EDB7153C5267 /* SharedSequence.swift */; }; - 62B6A33E0448492B1FE79ED9D7FF9A76 /* RxCocoa-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = BB068DC0F039D5F81258E7C270B36CCB /* RxCocoa-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 62F22A3D22FDE21E09E0EBCDC7A5EB2E /* RxPickerViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B781C46CC5C0FC0A551DA04BFF6D6A3 /* RxPickerViewDelegateProxy.swift */; }; - 6344AA77F50893A93CC7F972D9AEA054 /* sync_file.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD46E1B417F0A908BC72E6198B90EAFB /* sync_file.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 641970F062A4DC5E995DF874F6D0267A /* _RX.h in Headers */ = {isa = PBXBuildFile; fileRef = EF88472545EDF4E24240E50B66C44174 /* _RX.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 64C8D2426CC157630964D974B0941881 /* results_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3D7B0334A9F9928FF52C6050967CD30 /* results_notifier.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 65335E2F74AE71C270659EC7E8725030 /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D149BB26C33A57D55049C3C3D440A74 /* Expression.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 65F7C74D7759DA4B14F8C262C6F400E3 /* RLMSyncCredentials.m in Sources */ = {isa = PBXBuildFile; fileRef = 67B67D32CD6BA52879F9362A323F74EE /* RLMSyncCredentials.m */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 66476ECA34EEFEA8CAAB0C24DFAC4F1D /* RLMSyncPermissionOfferResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EA94F6951EDBCE65EE3ABA35A6E8F6E /* RLMSyncPermissionOfferResponse.h */; }; - 666CA0A6A8ADA4259E081BDD4E2A22F6 /* SingleAsync.swift in Sources */ = {isa = PBXBuildFile; fileRef = 474822C52CBE972860E8DC255086CAC6 /* SingleAsync.swift */; }; - 6740A6AAFC84336CE6FB6B4B2DB92E79 /* QueryKit-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = B3A4870B24422E3B82672BBC037886AB /* QueryKit-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 677791EE56669F5E8477E1D86AE1C3B2 /* SkipUntil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A87A2EA0FB26333CDE81BFD3B6AD4C7 /* SkipUntil.swift */; }; - 67D32AE97B91531C76AA76AD26FDC9A5 /* Pods-RealmPlatform-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 56C8638CE774B8A8C12676C28219318C /* Pods-RealmPlatform-dummy.m */; }; - 68B947F9DF5DAB6FC009FC77D6C1267D /* RealmSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 119538EEE489B3E27AA49D1FE48283F4 /* RealmSwift-dummy.m */; }; - 68E2113D6353CF20675407282574214E /* Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CC994EB560618D04579BC84C503DF01 /* Subscription.swift */; }; - 68F13C960F4E3AEC928C0D327750F2DC /* RetryWhen.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6A21F53393A351653982660E8D3B7E9 /* RetryWhen.swift */; }; - 699FB2F108E60EA2D41ECB418F9B3527 /* Disposables.swift in Sources */ = {isa = PBXBuildFile; fileRef = 540BBF4DB174D011B42C5A7CD928749E /* Disposables.swift */; }; - 69F9C31FC991A69337CE9B599993D68D /* NimbleEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 86F75BCD0221A6D3B29AA45BD76A4FE8 /* NimbleEnvironment.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 6ACE4193309F562459D6B8D9EC0CA526 /* SerialDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18251AFE1D92A264FF23E4B4BB099AD5 /* SerialDisposable.swift */; }; - 6B0483D7524C25D09BCFB0FA019D56C5 /* Scan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5599270D0CDAB890664985587BCBA77B /* Scan.swift */; }; - 6BB74E657C038911DAF7CFAF1812A364 /* StartWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = 618E7A71AADE30E6782BF2984DB54E15 /* StartWith.swift */; }; - 6BBB2C64E3BA4097CA5195D5A9E0D297 /* SerialDispatchQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03A66613668A36AB188D806792455DCF /* SerialDispatchQueueScheduler.swift */; }; - 6BCB9DA57AAE1EEA5A687912E6BA3497 /* RxScrollViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA831E78C82E138DCFADB062EB62CC22 /* RxScrollViewDelegateProxy.swift */; }; - 6C21FA2965F6C838EA40897875969F3F /* ObservableConvertibleType+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = A00C7D904474DBCC0A4DCE1F5442CDAF /* ObservableConvertibleType+Driver.swift */; }; - 6C76372BFB58A83CD36051C1B521FB84 /* RLMOptionalBase.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 256AF63FA29E54ABA829F3EB9D900316 /* RLMOptionalBase.h */; }; - 6C90EC2CC6DCB3CE78EBFCDA9ED2961A /* Delay.swift in Sources */ = {isa = PBXBuildFile; fileRef = E58053D64E5CAF32528EB1D63F9DA215 /* Delay.swift */; }; - 6D17DC575F711BD62AD981F02C367552 /* RLMObjectSchema.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9604E66751F69896AD323181D092CAF3 /* RLMObjectSchema.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 6D4479F428E656D74280F8EB6B6C2EC2 /* LockOwnerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75F6471591B80647ED7E7F982A70F078 /* LockOwnerType.swift */; }; - 6F324D91D1CF310C72E59E94EDEDA705 /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = E03AA51CE98C0E25831A651363252F01 /* RecursiveLock.swift */; }; - 6F36A431DE56B28FD400D20036A23DE4 /* NMBExceptionCapture.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B6630E2BCC0325A3B9010075A6EA253 /* NMBExceptionCapture.m */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 6F634DA2B91E0389E03FB0573CDA3296 /* Map.swift in Sources */ = {isa = PBXBuildFile; fileRef = 490B2302297DFB82C7D87440BB0F2024 /* Map.swift */; }; - 6FB97B1717A444B0AB123965A41EF990 /* RLMArray_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 9DAECC01EADF40818647F8793CF4BBF7 /* RLMArray_Private.h */; }; - 6FC819B991B1D35929BCCDFBD771BB8F /* RxCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 7598CF4B5C61DDA6CBB4D59CD0BAA801 /* RxCocoa.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 704DA81E48A5263B35189F36C5247A53 /* FailureMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EE2FBEC0F4C6DB320F908FBDE43951A /* FailureMessage.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 708B7E7A92AC1C3583C0F3B502CD5365 /* RLMResults.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 5F3462BE4A577BA487B2A9108E90F763 /* RLMResults.h */; }; - 70D48AAB5EB7E79F599F87EB71AA28D9 /* RLMSyncManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 827829900FDED975E2E0C53B2EDC8A63 /* RLMSyncManager.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 713028CCC706043FE2171388284BEAEE /* RLMObjectBase_Dynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = B08D726E62BB67BA300B3BEC98BD0227 /* RLMObjectBase_Dynamic.h */; }; - 7170346340E9FD36E9E70F00D595F5BC /* UITableView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CDFB51C334E9637BB0AAAC5E7055307 /* UITableView+Rx.swift */; }; - 71BF96E0F4FB425B4339F99C5805BB38 /* UIImageView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BFA5EF6BB4E0E297CB404369B9818EB /* UIImageView+Rx.swift */; }; - 72092E73A616B51735CF0DA03038F031 /* RLMSyncPermissionChange.h in Headers */ = {isa = PBXBuildFile; fileRef = 09CA29D163C4A81B573A815A943B909E /* RLMSyncPermissionChange.h */; }; - 7217153F8E31A49E4DE2BB7DD0BC98DC /* Results.swift in Sources */ = {isa = PBXBuildFile; fileRef = 428E0EA94CAF38B592D33171034CAF3E /* Results.swift */; }; - 7272DB71A8C5325A0778F63E6F6C9957 /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8799EAE23AC4B38F89FB70248DB44D5A /* AssertionDispatcher.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 7276DB3552398200B421D06F207EC0E3 /* NimbleXCTestHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5513B8FA21F53EA856639800CCDEDB4F /* NimbleXCTestHandler.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 72B3C008F279BD3EAECFDD055D5975B3 /* Pods-CleanArchitectureRxSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CCE033306547A0E208151520F52A803 /* Pods-CleanArchitectureRxSwift-dummy.m */; }; - 74010EF77F8408B3D07DAB41286A7664 /* RxTableViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C3D32B58B6052BC084EEA9DEE3384E5 /* RxTableViewReactiveArrayDataSource.swift */; }; - 748BB746CA429F9C5D510EEF3245ECFD /* Nimble-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = C965109204C6C72427A9D61E931164D1 /* Nimble-dummy.m */; }; - 754213380BBF5353F7963BEA0C49E776 /* ScheduledItemType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CBDC78B19B72BF7FD1FABD2769EEFE9 /* ScheduledItemType.swift */; }; - 7604EA066917CBDE4B4C289ED19C775D /* object.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 09A9B00781747A780375A164E3453854 /* object.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 763D7954EED201AD92043B01DAF03D29 /* Pods-CleanArchitectureRxSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 76F609DEF8E2FE7A4C17AD233F295E74 /* Pods-CleanArchitectureRxSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7661DDEC3DA64D3D5037E3B50A76304A /* NSObject+Rx+KVORepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACC48F782F7667876412E9401C618C48 /* NSObject+Rx+KVORepresentable.swift */; }; - 76CAC00A6F60E18BD152D27C04F502E8 /* Bag+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20BC21E8D260DF654A13E8B8A04D0651 /* Bag+Rx.swift */; }; - 76D85D0D8B2F3973C0E182414FB5DE84 /* list.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 119DC06AE581F74CB5C3B6B890F896E9 /* list.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 7777B8EB829C441942011FF91F4BD154 /* RLMThreadSafeReference.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 6ABACBA2C9D315DC47A49C74A8B7C2A4 /* RLMThreadSafeReference.h */; }; - 7777FAD1790F92E199CD0E6F08D85ED8 /* ControlProperty+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5EFD66E6BD218495B48E96BA9B3CD2F /* ControlProperty+Driver.swift */; }; - 779F362A05B65DC46B0530E3EE1C5575 /* SubjectType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C126DC815AA11F53B7102B2291C9C0B /* SubjectType.swift */; }; - 78012D8560C1F47AA9E0A7CBBBCB6DCB /* RxCollectionViewReactiveArrayDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14F213114CE9516889AF0C47CCFC8644 /* RxCollectionViewReactiveArrayDataSource.swift */; }; - 7816D3BE0452F02591EB4EAE0F9F34A6 /* TakeUntil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E2686CB51C73A7C37264F9AF994744A /* TakeUntil.swift */; }; - 78456ABEEEB323CFEB99981C7042B621 /* HotObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85F7317AA13674AF45FF061C2B34AD65 /* HotObservable.swift */; }; - 794468717E1BF7B6C69DB625A6E2FF48 /* Realm.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = D73B8E9DFA10E77D6BBB7C2C0B29A483 /* Realm.h */; }; - 79ED1EAEEF241EE089D0588577B0E33F /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC779AAB6131AEB402A39824AB090711 /* RxSwift.framework */; }; - 7AB0B07A51FD678229FE646C10501AE9 /* RLMProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = CBE2E0B290CF9163911607C23E090D9C /* RLMProperty.h */; }; - 7B80A3135C242B72B1B1DD84242E16E2 /* ElementAt.swift in Sources */ = {isa = PBXBuildFile; fileRef = DAD3127158220FA5FDFC00B86E1E3F8C /* ElementAt.swift */; }; - 7B8DFBB0EF7191D92D4F13E2FF3FEFC4 /* InvocableScheduledItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9589E038DA4969D52DF2D43FDD685A93 /* InvocableScheduledItem.swift */; }; - 7BD907A708031D5361E1A97CACF9F24E /* Nimble-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 82FEAFA0FC4D69B31FDE29DB838B3CE7 /* Nimble-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7C56AF4A65676283CE7BB567D506C4E8 /* RxTableViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7FF34C24A309A56D5E558BFC9DC5EE5 /* RxTableViewDelegateProxy.swift */; }; - 7D73D65CE9BE1F8EEF943ADC46A1A5AF /* RLMListBase.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = 51E80CDB97E97899BD0038B78302ADB3 /* RLMListBase.h */; }; - 7DB9BFCCFAC9C44949D22A39E768A2EE /* RLMSyncErrorResponseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 65E03150924581C5CDF3FF73CEDD4C44 /* RLMSyncErrorResponseModel.m */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 7DF58E273B3FAEB185899FD6BFA0FB83 /* Never.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BCE66A45226586BD7DF6BEC43E0434D /* Never.swift */; }; - 7E848D0A5596F4B34266C4FB1F2627F2 /* RLMPredicateUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = B36C40EE40CB92DDC99B65592FF6BF0F /* RLMPredicateUtil.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 7E8B6FC2D0E46A4C48E762CF8C0CBA5D /* RxMutableBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 620CFD2A642307BF12177D65F4747CB0 /* RxMutableBox.swift */; }; - 7EAF404933AC39FC664224F5E42C2CAB /* MainScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DFF991D5D6EC73F086137666782689A /* MainScheduler.swift */; }; - 7F0403F383753B68CCBB9C3CFEF48B3E /* Bag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2BEDB59B2607DBB61E2BF6AE6133FECB /* Bag.swift */; }; - 7F16E9D6C65A3A6304BB98F57CC4456D /* Zip+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE8220D6464C1EB4A670642D437E73CA /* Zip+arity.swift */; }; - 7F2190516E80087BE2A656782CB70962 /* RLMOptionalBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 256AF63FA29E54ABA829F3EB9D900316 /* RLMOptionalBase.h */; }; - 7F9AE18821B437A591459E7B15BB6DCB /* KVORepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DB873EE8F7C5FD34C4C6578A1072B9F /* KVORepresentable.swift */; }; - 7FAE3AE25E62379C3AEE0733CC26748D /* Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = C22CE36AFE7517678FA6060BC4A56D66 /* Schema.swift */; }; - 7FF1E4C06F7C7AE8C82E517EC0E7F039 /* UITabBar+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7E38F7A5F6F7B7F221ACC5C0AAB201F /* UITabBar+Rx.swift */; }; - 802C2D7A98BB0ADB88A89EA20A67047E /* RxTabBarDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02C8097609AA8B6959CB5B30CD203514 /* RxTabBarDelegateProxy.swift */; }; - 804E9A79B9D1EA3CD95C0EEC86780447 /* Observable+Single.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4456366A2BF3546CF5EBB700106AC35 /* Observable+Single.swift */; }; - 808EA3343A85CA8A4CCE2D172CA49B58 /* list_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6000C7FD72123C0DF8EC0819EF0F0D2F /* list_notifier.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 80B864601EC0B9DCCF305376768B641F /* RLMSchema.h in Headers */ = {isa = PBXBuildFile; fileRef = ADC6A2DAA3C7B805A6B65430E7FE9A6A /* RLMSchema.h */; }; - 80D1788131B3D3326041E62364F8C7AA /* BeAKindOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 680F8C82FE30FC925A6F0EBA92CC93A6 /* BeAKindOf.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 80EA45C15F1E1491ACA86B9321751002 /* Recorded.swift in Sources */ = {isa = PBXBuildFile; fileRef = C05DDD4799193E1D553A931B33F90393 /* Recorded.swift */; }; - 82B13AF65D86F96FF17B3D8B5BFEE50F /* NSObject+Rx+RawRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D640BC3EB4D9032D0A4F36670BCCA86E /* NSObject+Rx+RawRepresentable.swift */; }; - 82C9B744FDD1C25FFC5491A33C9596B5 /* RLMArray.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = A6587BBA0993061ACD6A225501F6C907 /* RLMArray.h */; }; - 83938A09CC48C4A863179A39CD6C64F4 /* ObservableConvertibleType+Blocking.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A3F969C497BD91AD3F5DD9396FF96B /* ObservableConvertibleType+Blocking.swift */; }; - 83CFBF299CB0BB75C8FBB9BB910E26E4 /* RxTextViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D48431617F5E01019D3D46F2F5FC2F1 /* RxTextViewDelegateProxy.swift */; }; - 8418DF8A5BE018F65758F68D75DAAAF7 /* _RXObjCRuntime.h in Headers */ = {isa = PBXBuildFile; fileRef = 5AAB6D50DAC127911F2AE131727672EE /* _RXObjCRuntime.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8486299F1747EDFD0460C9664CE1934E /* UITabBarItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = D82F882024EF9E73620A4FBB0D4DA834 /* UITabBarItem+Rx.swift */; }; - 8493E4563A24BB560ABFC7A977EEEB1D /* shared_realm.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9D40B8EB25FE62AA6D6D3D2D48BDD0D6 /* shared_realm.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 8564FC84CC3C20E3FC4BA4A67A2A4DD1 /* Pods-Domain-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = C93F74F2EDCEBA93D7710BD08CDCB725 /* Pods-Domain-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8599B573F453A986A64236D1B7175AAC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - 86DE001B0730C061B4507D32C5F34803 /* Timeout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 322D2CBEC7964F87AC4A568C1C159173 /* Timeout.swift */; }; - 86EB34D19E761CAE40A6B42C97997478 /* SynchronizedSubscribeType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 187CB18ECDE52D77BEB23E286DF86FA7 /* SynchronizedSubscribeType.swift */; }; - 8725D22AA29AD69B2F44A1F3B29EE085 /* RxRealm-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 737B50270378DB7DB4F3948B4AF9F59F /* RxRealm-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 874EF0A06B9FC80B877261425BAB4ED2 /* mach_excServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 60282D96FD06BDAC343AF6E6E86F8673 /* mach_excServer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8852BBB56C2C72E6557CF48AA66F696E /* RLMClassInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 87A68AFF74DF578CD9C34F9CD082051C /* RLMClassInfo.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 8898FE738D52A304B8E44A1624FFA43C /* RxSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E38A3BBA7C1B086C3EB1D2E492298C8 /* RxSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 889F4AB16D68F6D465EC010DD78E03D2 /* sync_user.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 75150084CD6CFCF2F4A99BA5E7580F35 /* sync_user.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 88B771FB81DD05BF7E48A0D9271D9EB4 /* CwlCatchBadInstruction.h in Headers */ = {isa = PBXBuildFile; fileRef = B99F3FB2FC5C707FB7FF466786E4E749 /* CwlCatchBadInstruction.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 891830DAAE9F2C1C8FACBFF52F812C68 /* RxCocoaObjCRuntimeError+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25B4A84FDB33A5C82AF22FA7ED7101A5 /* RxCocoaObjCRuntimeError+Extensions.swift */; }; - 892AC3D8F11ACC6D81A94922B3C597A7 /* ObservableConvertibleType+SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E7B7DF0DDDC3AA6C08D571EF57C4BB4 /* ObservableConvertibleType+SharedSequence.swift */; }; - 8A085CEF31B24ECA942E9A0F64CC3D1F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - 8A0D6EE74899BCEF3E892DB7FC516994 /* PriorityQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7C457E30ED78639FDBAD11D32F2E5D35 /* PriorityQueue.swift */; }; - 8A13A2ADF070624728E6D54FA0E81810 /* UITabBarController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FAD1573476230902C96233E3146AE68 /* UITabBarController+Rx.swift */; }; - 8A772549298F64FE6305696A5FE1F832 /* ObservableConvertibleType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 00245512723919720F6610B0FD5B5FA5 /* ObservableConvertibleType.swift */; }; - 8A993FCF14A197B15277C7B954A971C1 /* Pods-RealmPlatformTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 456C4D0CC020D0F5B34472CED5436D76 /* Pods-RealmPlatformTests-dummy.m */; }; - 8AA47706BFC064659CF38507FF116092 /* RLMSyncPermissionOffer.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = F8BAE64E30EA9DF69A3FB3B92FC4D690 /* RLMSyncPermissionOffer.h */; }; - 8B9D0E619D2474679035F5FCC7F2A76D /* RLMObservation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39A3F66ED64B7DBFE07F75C4E93FBCEC /* RLMObservation.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 8BDF66A042BF01798954D4362E880FF5 /* Realm-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 23AA7BD6E4CBCFC8AFA0A6E8BBEDF33C /* Realm-dummy.m */; }; - 8C44ED8E5CA93FB5A2FDF00CD6D89FED /* ControlEvent+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBBF44D77690F11DE05093230CB4E696 /* ControlEvent+Driver.swift */; }; - 8CBAA78F6BFB505EBD79766E4EBBA388 /* PriorityQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC1312795717FDCEFC84ADD8B8E0A2C /* PriorityQueue.swift */; }; - 8CEB8A6E359CFD6C1AEBFFF2A3EC8DAF /* RLMRealm_Dynamic.h in Headers */ = {isa = PBXBuildFile; fileRef = E870979F5C62F7A48BBA13C070842F12 /* RLMRealm_Dynamic.h */; }; - 8D6C9667138F9296FA5B35F30E6A7A43 /* RLMSchema_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = D8A20375F4A84061C6B4E3EF2DAB140F /* RLMSchema_Private.h */; }; - 8D76F08376541663A679DC800B7761BF /* PublishSubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3995157AED191D50B373A29AD950FF44 /* PublishSubject.swift */; }; - 8DB17FD32F0F3BEE7A8595C5E469FAAA /* schema.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 347E05CBC887B0FDE925DD40E560A429 /* schema.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 8DD1FBEE164E836182610D1D4392BDF4 /* RLMNetworkClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 17880DD8A71DD766D4C5BF068866C398 /* RLMNetworkClient.m */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 8DF52E3A7F288CC06C85C069A68A91B3 /* Disposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADFBCA755396F244B2CFFDA38918CED5 /* Disposable.swift */; }; - 9078ED5F28A296FCF92EFAA16393B43B /* RLMSchema.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = ADC6A2DAA3C7B805A6B65430E7FE9A6A /* RLMSchema.h */; }; - 90CBD0EE6666150EC36EC72C24B0C176 /* _RXObjCRuntime.m in Sources */ = {isa = PBXBuildFile; fileRef = B0E48F61B0569430EAB76A9301709383 /* _RXObjCRuntime.m */; }; - 91D35C208817CE2790D05ACF38CBE0B0 /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845D0EA8611F2FB24CD712D978D6ACFA /* Platform.Linux.swift */; }; - 92557966C3965C2DBF7E72ECECEBAF8B /* Deferred.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAF071D8F638574AA04A43378F800E5B /* Deferred.swift */; }; - 926F67C94121C19A959745138E5B42B6 /* NMBStringify.h in Headers */ = {isa = PBXBuildFile; fileRef = 318B8F2DB12388587F176B1280DCC748 /* NMBStringify.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 92875822BC612F957F39B5964EC27696 /* NSLayoutConstraint+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99FF802CC6AA32414FF845B4E422D063 /* NSLayoutConstraint+Rx.swift */; }; - 92D71A5902991DB53A4BBF86C51AC0E0 /* Observable+Debug.swift in Sources */ = {isa = PBXBuildFile; fileRef = 256A7CC03DD807F0C92D64B350C9A815 /* Observable+Debug.swift */; }; - 9362900463464DFBEF3A1D53984D521B /* Realm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADFAB4721B073AD66157837FAD1C4BF7 /* Realm.framework */; }; - 93ACC0691455B2EF3D3082207CF476A1 /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A85BA326BCA9C57C225C39D9F0DB3C1 /* DispatchQueue+Extensions.swift */; }; - 94D4002526ACDC30711BB5DE8985412A /* UIGestureRecognizer+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 449223001FD790A403F78B3E34186EF5 /* UIGestureRecognizer+Rx.swift */; }; - 952145835DD7DDF619D742CC7C2C2164 /* RLMSyncPermissionOffer_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A99D0A764F4145F96DCA40079603C8DA /* RLMSyncPermissionOffer_Private.h */; }; - 955E6C9B1F44B32B235EB56B5AFDA9DD /* RLMRealm.mm in Sources */ = {isa = PBXBuildFile; fileRef = BE87C88221EBDF94A4D0CD98E637BE5B /* RLMRealm.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 956DCCDBB5221D178DD5C6916C7C2265 /* TextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBC006F1F0DBD8AC1A0B890646852B4B /* TextInput.swift */; }; - 95DC7AFE23F1E1563437999FAB45EA5B /* UIPageControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19EA56528221F157A574C7B4B1D7112D /* UIPageControl+Rx.swift */; }; - 9665CA0604B29C43C49EDE0FC0BD06FC /* RxCocoa-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BFE207BAB34C549F199FDFFB6798281 /* RxCocoa-dummy.m */; }; - 967F04046C55E4DCC73452395B9F1783 /* object_store.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 218C350B11A80A2817C1141FF95F54A1 /* object_store.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 96AF17653573AE8DADC0A7781F85D8CA /* UIBarButtonItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3E77E11E365F562B26CE30D3CC144B /* UIBarButtonItem+Rx.swift */; }; - 96C645C2A524262DC0C5CE3961947A58 /* Observable+Bind.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8381718F65F50C2F878283CCC802FA6 /* Observable+Bind.swift */; }; - 9792F864FDAE8F796629F0F5D60B07C1 /* UINavigationItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8B1D24C4BC6E7A939373F908196AB54 /* UINavigationItem+Rx.swift */; }; - 980B35F504BF8AB0C52F3D9F095B6475 /* UISearchController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FF39F3BD1D678CA9BACAEEFD39DCB8F /* UISearchController+Rx.swift */; }; - 98100194787ED4C357A4A493CBC2CACB /* UITextField+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9627E7DD73D5851D73ABDA76F10A27F2 /* UITextField+Rx.swift */; }; - 982DA9B12EBD0EE37FC22DCD40D6A09C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - 98C4FF5F6FE0332BDB27D1B0F6AE3AA7 /* SwiftVersion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9263B3A050D8F0206EE9674A65052154 /* SwiftVersion.swift */; }; - 98F0C338F886F65AE03A987983A229F9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - 995D9EDC65494F1B9F5690C827134FD1 /* RLMSyncUtil_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = 6031907F5FB40AC1819F8F4D5DD23CB8 /* RLMSyncUtil_Private.h */; }; - 99CB8A8B85123E2CCE3FF6DEAA517C33 /* Observable+Multiple.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AEC88EB83550D0CEE740F01AD3304F3 /* Observable+Multiple.swift */; }; - 9A26614B85D6C8E7548CE7771E1AABC6 /* RLMThreadSafeReference.mm in Sources */ = {isa = PBXBuildFile; fileRef = 137E976E469CFB6D8C628C752EEF26AB /* RLMThreadSafeReference.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 9A41A1019843F98F3E2082BD46CCC153 /* RLMSyncConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0D67BEF4D9D22A8A0DFE2543AE09F23C /* RLMSyncConfiguration.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 9A552C9FDDE94B7CF1A3F1C60FFCB5A0 /* RLMSyncPermissionOfferResponse_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 41A4EF93D766224EFFDA68623C54A7AF /* RLMSyncPermissionOfferResponse_Private.h */; }; - 9A59412B5ADE7CF9748D5A359C8A1D7B /* TestableObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3E73C12117ABCB9685A1573BB44D10A /* TestableObserver.swift */; }; - 9B0FE76F7ECA7CEBAD1D79F9607831E5 /* TestScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B55EA40F4928799825E9C22AD36D1C1 /* TestScheduler.swift */; }; - 9BD4D8E7A0AB04BFFCD9132E711AFB91 /* Error.swift in Sources */ = {isa = PBXBuildFile; fileRef = A34E5639FD366712F3924C743CB50378 /* Error.swift */; }; - 9C3EF93809C13A5C4C8DF46F72302593 /* ShareReplay1WhileConnected.swift in Sources */ = {isa = PBXBuildFile; fileRef = 292DBC9AD470A408306D9D1B89CDFE7B /* ShareReplay1WhileConnected.swift */; }; - 9C4638996F1308A925A3B30098D90795 /* RLMCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 2952FBF26066799DBB635AE5EE3D6AC0 /* RLMCollection.h */; }; - 9CB4FDBBA9CCCC990ED8AFE76A80734B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - 9CCE5B9E572B73500ED842EF98B0868B /* weak_realm_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 365A23A9D17A8ACEA664210B80849378 /* weak_realm_notifier.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 9D4C48245A664939B754A58FE24BBC56 /* ScheduledDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 617F97FAC54C3C016E9BD5962051E6AA /* ScheduledDisposable.swift */; }; - 9D9155396F48333B854DBE586138EDBF /* NMBExpectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D61929A5ABE4042C09417168DF233F3C /* NMBExpectation.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - 9E74655781E19FBADB6C3827E03784F7 /* RLMSwiftSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = FEB18B36D3EE307D7CA204E17B0EEEFA /* RLMSwiftSupport.m */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 9EA8AF49B2B9FEE46FC2432B872DB107 /* RealmConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EE35D0725F8F90CC75E788D19568FB /* RealmConfiguration.swift */; }; - 9ED0DE2CC279330D9B1FED6E7B635B36 /* RLMObject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9949BF61505A3724B810B5CFFEE9CED4 /* RLMObject.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 9EDD1CD67F29A8B6AF03539D1823A5C9 /* UIAlertAction+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = E03F4258E17C30AB8353F67FCAC54713 /* UIAlertAction+Rx.swift */; }; - 9EE6A8A11BFB9CD5C2482F7FA044E8FF /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - 9F7DD8D2D7DB256317958B166BE805E5 /* NSError+RLMSync.m in Sources */ = {isa = PBXBuildFile; fileRef = D18AE140B42060652DA722A18B4581D6 /* NSError+RLMSync.m */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - 9FAD6265121A9E451AB127625312DF5B /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E33742CD0E675E708288D4EB15A67EE /* Platform.Darwin.swift */; }; - A04A2C16F51CF32D9E808D7BA6BD9315 /* ImmediateScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DBB9B657E9422DE4900989C0DAD462A /* ImmediateScheduler.swift */; }; - A065388A5F04E762D771FCC9A7173AAD /* RLMRealmConfiguration+Sync.mm in Sources */ = {isa = PBXBuildFile; fileRef = 00BC4A17CF3F1323C69BB2FB47C342D6 /* RLMRealmConfiguration+Sync.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - A1E06D3D84108E4C640F216C7C78DC03 /* ConnectableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBED89F2DC54B20A504A4AAAE40CB4AA /* ConnectableObservable.swift */; }; - A20B7D79A61A342C293991077BD33005 /* AnyObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8E6BC43A1E8D721B8AC29C3C8E35EB6E /* AnyObserver.swift */; }; - A279D4DAE8E16C5D8F9019CDBED14D73 /* DSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBEC25DC81B1ABDCB21C52F89DA8A509 /* DSL.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - A32899272ED7C405813D9791525C817D /* GroupBy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9142FC789F4E3E454D4CEA249BE53885 /* GroupBy.swift */; }; - A350920CA682B83DF982492034F8AF97 /* Lock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8714A665CD919AF83A3D6358E2FF31CF /* Lock.swift */; }; - A3A35910366400841E04E80391C8E31D /* RLMObjectStore.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = FE2CCA9264024E06109045959D1EC7E3 /* RLMObjectStore.h */; }; - A4364E436ACF12AC75BB65D97871AA9A /* ImmediateSchedulerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB1FB9D374AE5AA968003FE72D707271 /* ImmediateSchedulerType.swift */; }; - A4A310099FFD3978529A7CFAA2CED525 /* Sequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5707648E42DDFCC4B19502E48E2780E /* Sequence.swift */; }; - A5FCF5803D0D7352152C14D5EEA4A0B4 /* UIBindingObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B9F9F8D327301B5D0920362F19116D9 /* UIBindingObserver.swift */; }; - A604E89C2E13AEEB4FFBE8E4970FCB37 /* ObserverBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5455DB9934B6E9608CEE0A65CF1F2AB /* ObserverBase.swift */; }; - A665BE606F6B28E89B531EDE41657ECE /* Match.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE0ECAB8F86782C26B2920BF87A56CF1 /* Match.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - A67439EE31E1C1F77A36DE2F4583F287 /* DisposeBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 956C6ED2267E772D5C6BA90A5939066B /* DisposeBase.swift */; }; - A67CD1439188015DD46B425EEA82E946 /* RLMOptionalBase.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = 256AF63FA29E54ABA829F3EB9D900316 /* RLMOptionalBase.h */; }; - A69D38644F45C29F8ACDD8B60F98C1F6 /* Optional.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA642526C373285055DF7A048E6653DA /* Optional.swift */; }; - A7555A45AD27F927A22263A35C740E0F /* Zip+Collection.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA98B93E0B97D8B7E1C7D158CAC17D4D /* Zip+Collection.swift */; }; - A7B24340807413BA57135CE2AAB31DCE /* Observable+Binding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 226F053FF2041508860647259F595B96 /* Observable+Binding.swift */; }; - A7DF0C050AF71110B5D7CE0F43D65306 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - A83474E5AFADE19547E98E3E1B50A320 /* Queue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ACEDAB72DD6F89B6EF216AA2E234CFD /* Queue.swift */; }; - A87CA098369D61EFC7A05BD61512A3F5 /* BeAnInstanceOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 437748C82613E2EE8BE3BDDBB9CD429D /* BeAnInstanceOf.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - A87D198FEDE3A9ADB07BC1E75C56D7EE /* ObserveOn.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63117D92D9C1C46672E8C21CDEA8A6CA /* ObserveOn.swift */; }; - A89F3A35EDBD8F49D96024664BDDC3F2 /* RLMPlatform.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 36867BC95C92E2B998AC9B60B3531E00 /* RLMPlatform.h */; }; - A98EDA02852C1FECBD518D8046499022 /* UIApplication+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = C1FE552BECE0FE2FA20EF5366E64F63B /* UIApplication+Rx.swift */; }; - AA131849E8E914513D9558C0A8E36A79 /* RLMProperty.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8147EA764021C40A6F41AAFD1D5BD9CE /* RLMProperty.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - AA6EAFA71E1A6862AA312D89A601C34F /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76B4D0EAC3019F6520D0B460B971C10F /* AsyncMatcherWrapper.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - AABD3667CBC3C1572C89411F9D9C4994 /* BehaviorSubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD2011369791BBA73E5236E0DEA7DDE8 /* BehaviorSubject.swift */; }; - ABEE3775B4FD25B3C86EE712BC2502B2 /* BeGreaterThanOrEqualTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A2FBA9ED711AFFD0E67EC02BFCF6CBC /* BeGreaterThanOrEqualTo.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - AC6FC297A452143D84D8EF2A770FEA5C /* RLMCollection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 55058D00734EF79A01FD662D16CA5CEA /* RLMCollection.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - AC833BA88C128573C8C75CD2E5E0B12A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - ACAF6D2F93EAA0A7BCC6345A842752FC /* _RX.m in Sources */ = {isa = PBXBuildFile; fileRef = C3258E2CF7232311543129625A67DF48 /* _RX.m */; }; - AD2B0E5BFF8EAD0EDF0449F8D198277C /* BeEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B3D331262EB0179A93ABC9CA9BFE9E0 /* BeEmpty.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - AD2C82CE8128C64F82C03B23A8681EE9 /* RLMAccessor.mm in Sources */ = {isa = PBXBuildFile; fileRef = CE31D89F2C8DB6F7C543B33758BE8144 /* RLMAccessor.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - AD62E15F84593890788801969BEE6C9E /* collection_change_builder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0AEEBAA5CB753B13E23FAADB71045F6B /* collection_change_builder.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - ADB13D888C18545F70BBE7A8D7D639CD /* RealmObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 423080DF5659C248A1ADF36D9ACF9BA9 /* RealmObserver.swift */; }; - AE95445163BFD49B0EE8A39E0E672143 /* RLMConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 68118C2B1163EF93144146168FBCF4C0 /* RLMConstants.h */; }; - AE9F0FFDF14E54045CCEDC363FA110A8 /* RLMSyncPermissionChange.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D2238DF1C631E9687D1D0067F3A0943 /* RLMSyncPermissionChange.m */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - AF757F72857DD78441F84A73293480AF /* index_set.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E7973DF3A2C40EE048550AECE194E1D3 /* index_set.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - AF7F875677FF3EB4B6ADDB1373B34249 /* BeLogical.swift in Sources */ = {isa = PBXBuildFile; fileRef = E70C6C218193F4B562DB83C729CAE65C /* BeLogical.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - AF814F353BF9C15BAED3E4067DCC3BF7 /* MatchError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC711F7CD1CA11D44C4CAFA7A36C0572 /* MatchError.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - AFB74BAA7028EB767AF7344CE6CA5D0D /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6065AA383756BA1BF1C085CEB4F0E82E /* Platform.Darwin.swift */; }; - B0219195EA87E45F0A80A6B651D750FA /* BlockingObservable+Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BD8D45A8BFC53034614C8ED73F27508 /* BlockingObservable+Operators.swift */; }; - B0679B38230AF213641E490B06278B8B /* InfiniteSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D6403B29CFAD6729212DED8DBCB98A3 /* InfiniteSequence.swift */; }; - B119A874F48DD3F44DC99E372DC66A88 /* Pods-RealmPlatform-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C24D5484E459E8A613CE9978E6A45D5 /* Pods-RealmPlatform-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B138DBC0F7D2656EE7E413BEA735C71D /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95FD775142302578A706350EF902E19D /* DSL+Wait.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - B16340143CE7FF40A32CD8082ED4152D /* CurrentTestCaseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = D58679AF1EC8AAAAD66EF4A53220097B /* CurrentTestCaseTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; - B1730DBC5C66E4B50D9DF756BC830DD2 /* transact_log_handler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3577AA9372DD24B3C3606CB2299856DC /* transact_log_handler.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - B1D59A1BD0FBDF3BA9A5B65ACFC25D56 /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75727C08605433E0C5B8DB8B3E188B8 /* ThrowError.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - B1D876C441B5F61984E35ABB5210AFE6 /* CwlDarwinDefinitions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A10AB4B5883276D772A29D431AA68414 /* CwlDarwinDefinitions.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - B23C55EFC23AEAE0EF3D9A4B661DD3C9 /* RxCocoa.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF0EB61780DB161C1ABC46C9C6E08ED2 /* RxCocoa.swift */; }; - B2B0F9DE6FF5C1B6CCC4CE6CBEF8520C /* Range.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA06600C4A44787728BACAC9DBEAFEC /* Range.swift */; }; - B2E11C60F69DF9C8D74E1720E4AE5476 /* RLMMigration.mm in Sources */ = {isa = PBXBuildFile; fileRef = 029892FACEB725CF1225E2F2BBB181AE /* RLMMigration.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - B300C5824BC3009D30783D33EFC9D7DB /* RLMRealmConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 2738DC94C928353E0D38A5463635400B /* RLMRealmConfiguration.h */; }; - B3212C499FDA598BEA27F16E68EA7395 /* Cancelable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53CC2CBA3B814AE063CA4BA09355A160 /* Cancelable.swift */; }; - B4771A1FCA5C1B7994BE90DAEEDE0EBD /* Queue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CF09B4FB5D88A264AA6DBE5F17F87FB /* Queue.swift */; }; - B4BFD5554CB9A56D403727D9F0E61253 /* RLMRealm_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = C5121AA168A2C53B33839BEFD2CD6751 /* RLMRealm_Private.h */; }; - B5B4538AAA5622A7529F73C6CA0FB424 /* AnonymousDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0BC2B8130EA21CDE8FF89AB1DC379AE6 /* AnonymousDisposable.swift */; }; - B612F1F906E3AF8B1FC6B893229E83B6 /* AssertionRecorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = EF4F2362C395821825BD02C6396133B1 /* AssertionRecorder.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - B69C7C16D588B2F921D8EFF023B5EB42 /* RLMSyncManager_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 60E0AEFD6A0696202E1127E8C6189CD6 /* RLMSyncManager_Private.h */; }; - B70460900853B886AB701599AB9E50E6 /* RecursiveLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEF657B58156636513E301EBE60961EE /* RecursiveLock.swift */; }; - B79A3B11799801E30713F09EC406FB8C /* CombineLatest+arity.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEA7B15AF655E0429125627CAD29E6DC /* CombineLatest+arity.swift */; }; - B83FBE44345739B8BFEB9C530B0404FA /* RLMSyncConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 237D4E8B60CF721ED681A3052F2BECA9 /* RLMSyncConfiguration.h */; }; - B8E016D627837401CA830F7B988C7A52 /* AnonymousObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BCE4B0CAE4354903CA6579B703AB088 /* AnonymousObserver.swift */; }; - B8E099CA7F923A89B01174B45E2EF53C /* HistoricalScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E2FA9D13239697489B913581CCD0C56 /* HistoricalScheduler.swift */; }; - B9902AF36885DA753BA8803DD7C10EFC /* URLSession+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0B99A3F832E6114A5FA74DDC29F5B76 /* URLSession+Rx.swift */; }; - BA1C087296A7720B586D63B56877F46E /* Predicate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4ED17F31DFDE3B6E0C33C6629E6430F0 /* Predicate.swift */; }; - BA6BE7687FDA697254A2E3C114F4DFA2 /* ConnectableObservableType.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7B828A7C8B940D81A0784CFDF60FA0F /* ConnectableObservableType.swift */; }; - BA764A9C1AE63320D6F06DD80450CD7F /* _RXKVOObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = AB2960AD97002F5514AAD4B25EA9593B /* _RXKVOObserver.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BB3776348EAC79C7B86FA71F7050F074 /* Pods-Domain-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 651D0FCCF49CF22AF21FF5640CF0A54D /* Pods-Domain-dummy.m */; }; - BB4C2EB17EEDC34897D1D40F80FC242D /* Observable.swift in Sources */ = {isa = PBXBuildFile; fileRef = CA59CF369E8DFDEC956FEE2FFC8BDDAB /* Observable.swift */; }; - BB5CC2BA77352613EE77E758F148718B /* String+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D800547C3EBF2872C4F31A793241E5F /* String+Rx.swift */; }; - BBCB6D45658246717408C9E955BD84A7 /* RLMListBase.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 51E80CDB97E97899BD0038B78302ADB3 /* RLMListBase.h */; }; - BC00B353AFDFBFD5ED960D702005BB88 /* PriorityQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B9D9E1ED1DE4010A0AFA0DC9A6AAFFE /* PriorityQueue.swift */; }; - BC83D7FD7CC72C78C1233D07ECC6DC67 /* DelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BB3A3210608688670C20F8B7E8D0E2C /* DelegateProxy.swift */; }; - BC8E2CD80717BD7362FCE876A59AD525 /* Pods-DomainTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 9ED1B6EBA5C332C3BAEBC7AB6BA83D48 /* Pods-DomainTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BCF8885A133EE3791ADB9E2B9F0C2CB2 /* RxTableViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F82EA101821C4410024CEB3AB1C46F3 /* RxTableViewDataSourceType.swift */; }; - BD082AEFE5645F715BB0DC8381B29C14 /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96D0A3DC63B077FB0B3093A31B3F420C /* DispatchQueue+Extensions.swift */; }; - BD1BABF63CC84F15E4047992E6E39BC6 /* RLMResults_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DE1A575C17A110965C2E6FB43F4D1E53 /* RLMResults_Private.h */; }; - BE3A0861289888C1C1E8542CE83F3F61 /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C79C28717823D848E9B9A46EDC8E820 /* Platform.Darwin.swift */; }; - BE75A00DC491210F3C159B76CE10D7DF /* Switch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 76A62E278B749564C6A15432577C6BB2 /* Switch.swift */; }; - BF97DF079E362E6E682AA7C9FF4702CC /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41A44C3D509431019F12AE5A7B8A6A83 /* CoreData.framework */; }; - BFAB7CFE6C6FC48ED00C5405C1194D65 /* RxTest-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = BB7586E4448903466B3CFBA9B32EA75A /* RxTest-dummy.m */; }; - BFDAE54FFD6F25C92DA85BEDCF02EB57 /* external_commit_helper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C76A953946D58DDBEE78786C00AE05D6 /* external_commit_helper.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - C08FCDC247B35C971F5AE7E58987E8AC /* SatisfyAnyOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5D004E53E1F05AD0B9634080BFE4E507 /* SatisfyAnyOf.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - C11983FF9FAA8B0D97955378989B9A82 /* RLMMigration.h in Headers */ = {isa = PBXBuildFile; fileRef = 19C9139587A0BA340E56221ED8C0BFDF /* RLMMigration.h */; }; - C147583840485265416A96860EBF159D /* object_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9E9240D8A27CB9ECF337F608D036AEB8 /* object_notifier.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - C1666EFC35501F3D385580232823C773 /* Timer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E68EB69B86F922932702A025124117C /* Timer.swift */; }; - C1CE1BE924CA442804B8D80455B9CB54 /* VirtualTimeScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FBCF4CCAA6BF84CCE63795808F9F12A /* VirtualTimeScheduler.swift */; }; - C26885CC817C342D6A534EDECBECC404 /* RLMPlatform.h in Headers */ = {isa = PBXBuildFile; fileRef = 36867BC95C92E2B998AC9B60B3531E00 /* RLMPlatform.h */; }; - C28A9469F34BD7D171BF9CE35EF855D1 /* RLMCollection.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 2952FBF26066799DBB635AE5EE3D6AC0 /* RLMCollection.h */; }; - C2D34F816D23FF0AF63A6F931E3FA36A /* RLMSyncCredentials.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 7AE7B534F16968B523BD7E569F148363 /* RLMSyncCredentials.h */; }; - C39921387DA273A0952A999B0CDC03F9 /* CwlCatchBadInstruction.m in Sources */ = {isa = PBXBuildFile; fileRef = 25B549B23810CFC78B1CFE19F7C955A7 /* CwlCatchBadInstruction.m */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - C403DC22CBAF5686E0A8EC72D45F246B /* RLMRealmConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = B302632112607AC79A5DB7385B3BCCBB /* RLMRealmConfiguration.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - C51C21645FB7664E061E51D7FC5E174A /* OperationQueueScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF93653A2314101FEE0FCEAEF6A2DA38 /* OperationQueueScheduler.swift */; }; - C5899FB50C8114B86965799A6C0A1AA2 /* RLMSyncPermissionChange_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = 0BFB4F3168E45943ABFB5A3C6F1095BB /* RLMSyncPermissionChange_Private.h */; }; - C63F01DA8FD6EF928A12E7570A440A8E /* RLMRealm.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 05BBFEBBC89AB7495B8AA058F7F2BE9E /* RLMRealm.h */; }; - C710B6A7B1A479349273B3AC04CF07C5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - C7772101DFEAE08E3D9C0D8067B197CD /* RecursiveScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58875D4B2FB45B2616D2F03A74D90AB5 /* RecursiveScheduler.swift */; }; - C77C6D1FE43D251868B33D937C6F56B9 /* object_schema.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2C4412760BEC0C7BD9C1C49E318C4339 /* object_schema.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - C7C1B01AF9F4D0831BE181D5830C8CE9 /* RxCollectionViewDataSourceProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37D650E2738F6CA0AEE9538D2212801A /* RxCollectionViewDataSourceProxy.swift */; }; - C889A695E421C80D29BF3EAB4683F17C /* SortDescriptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = F44C242A3E765B64B0946BF3074BDE73 /* SortDescriptor.swift */; }; - C9132B1E287B7ECA69A90F4766ADE9C2 /* DSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 3131FE971C2724941C7A8D2FA70F15E0 /* DSL.m */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - C91DF7AD24C596568E839F0F6C2D4392 /* Pods-RealmPlatformTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 00FBD3A4BE3A018F8FDA36EB65F0A353 /* Pods-RealmPlatformTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C970FC435DFECE8CF73AAA0B1DFCC851 /* UIScrollView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 263D4DB701F0F01734069546DA40E9D4 /* UIScrollView+Rx.swift */; }; - C97B9F51427BCD4C63EC7D75AB161833 /* Contain.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC6D7F0AAAC759C364165AB73273FF3B /* Contain.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - C98402A0DBDB91B72EA743311AFB2F19 /* RxCollectionViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D75334EF2399AE4F713E8C34AEEC1A4D /* RxCollectionViewDelegateProxy.swift */; }; - C9BDBA79B96D902E7CC25B007A32C522 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - CA10DD1E4009218EE97ACB06A6EDEB1E /* NSError+RLMSync.h in Headers */ = {isa = PBXBuildFile; fileRef = A3B9206E6EAB97E39A1B218C5DC6E21D /* NSError+RLMSync.h */; }; - CA99C30B281B801DC440AC32562529A0 /* Platform.Darwin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26D2E85604D64564339FC5A3BFBA4341 /* Platform.Darwin.swift */; }; - CA9C4A73559039BB23C49FFC213C5B79 /* Generate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 178501B9502D26D23613A114C84F2578 /* Generate.swift */; }; - CBD660FE5DF376E7A003F18730E1FE0D /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3163740E168659576828D1F52CF80F2D /* XCTest.framework */; }; - CBFBD4C0B4E631A2F32B7CC888DEA4B8 /* Queue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49A565AF840A908AD4DF2C8FF88266D6 /* Queue.swift */; }; - CC2472A3E0CDD47ED2F8516387727243 /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 079584E666EB760187090CA5E1AAD808 /* DispatchQueue+Extensions.swift */; }; - CC76A112623D4981E1D17E0C6EC6FF31 /* RLMArray_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = 9DAECC01EADF40818647F8793CF4BBF7 /* RLMArray_Private.h */; }; - CDA9C892E03EF1BD60F623358203073C /* RLMResults.mm in Sources */ = {isa = PBXBuildFile; fileRef = 305D2C9A4B4DB4B1974D364EF4C229C3 /* RLMResults.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - CDBFFD55E4D666A5C717DFFDB317894F /* RLMSyncSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B0E7614E593D71E05DE51065E273B00 /* RLMSyncSession.h */; }; - CDD3BE4F9E6094879FB244CF3A9FB4FD /* QueryKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = ABF1CEC0AADC895600F3803828C8CAC3 /* QueryKit-dummy.m */; }; - CDD4BDF82DA024CE2197BC9A79D3437E /* CombineLatest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 028869F8443663B70CD76DCD7D83454E /* CombineLatest.swift */; }; - CDD7DD7BCA332476947396AF11E7628C /* DispatchQueue+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2673F80412A2AE057049C4103503CA74 /* DispatchQueue+Extensions.swift */; }; - CE181EE6E4342F19D3BFE5ACABF110FF /* RLMUpdateChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = FD14D4DAA5A63334AB7CF75B4787CF43 /* RLMUpdateChecker.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - CE723FA3EB5B94FE61FB3DBD9890E4E0 /* Pods-CoreDataPlatform-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 766C72882D45E69565506BFCE1205BF5 /* Pods-CoreDataPlatform-dummy.m */; }; - D087C89FAF90A347A284AEF4FDB8566D /* RLMObjectStore.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2CCA9264024E06109045959D1EC7E3 /* RLMObjectStore.h */; }; - D1C4EF0CA043138F3C54AF31F9F7DC6D /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = E8B4885F3C548BBF6FFC834931C3FC55 /* Platform.Linux.swift */; }; - D2104E63AFA8F0B970701AE8523CA3E4 /* ToArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31A003A034E61D0BC6AEB473579781CC /* ToArray.swift */; }; - D221EED28AF707626011FEA6E5329C76 /* Bag.swift in Sources */ = {isa = PBXBuildFile; fileRef = C87BD9D3FAB79191092DE8A9A58F5435 /* Bag.swift */; }; - D23254C10D4B3B659DA5551F67DC1BCB /* RxBlocking-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9B1F72E6A71B6B7A163608E125535B /* RxBlocking-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D39A106632D5EFBC56B248F8100AC32E /* Do.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F10AF5A825229B36E1702D704B44CCC /* Do.swift */; }; - D3A00425ADB00C0E35B64E3A8E69124F /* UIViewController+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28F082D05322822F974934BEAFC970F /* UIViewController+Rx.swift */; }; - D478CE0AE724AD9A40C22629D457ED62 /* RxSearchControllerDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1A9BF9FBC00FE12E25776D24AF8433E /* RxSearchControllerDelegateProxy.swift */; }; - D4E417AAC2AC3E5E7B7B0B698E1E5333 /* Pods-CoreDataPlatformTests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EC2834B0D7626408A52212C60194957 /* Pods-CoreDataPlatformTests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D599F63437B83D2816E354FC725B8FF2 /* TailRecursiveSink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F1011E3BF49A2B2F987B00DB32F3965 /* TailRecursiveSink.swift */; }; - D5D4E8223C271A19448FCEAC36A9B441 /* AdapterProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 13C208D8232C936AFB19CB44F0687578 /* AdapterProtocols.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - D64CEDF289C3B143E4B225DB1548E170 /* InfiniteSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = EB51FF01BE46CC25221378CD845BC4A0 /* InfiniteSequence.swift */; }; - D661C4243A2A9A8CB80E5C31A381F488 /* Variable+SharedSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35D129172F068D27EA24649C6EC33640 /* Variable+SharedSequence.swift */; }; - D6A1634CFD5243D18DB762116C8CEF8F /* BeVoid.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E56051C914AA19D17127B65F8163C2 /* BeVoid.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - D7408861438442F67469ACE39D1604C1 /* BeCloseTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50C74801C762073F7DB0CDCD76B6E3FE /* BeCloseTo.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - D806904060EBCA0DFABDA666D8B45B11 /* Platform.Linux.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE73BF208E7B38E1BA4BCD70BC7FF518 /* Platform.Linux.swift */; }; - D86966A83FD813AAF2063B4614698A3A /* RxSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = E6633EA0D93D4B6AE1E7D77701B5BC79 /* RxSwift-dummy.m */; }; - D92F5684C2B940A5E0D0C049C148AB77 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - D93C5A1929F8FD53F7EF2C3CA16CCC95 /* Expectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68EAD1FFD6003414DAD602C06B759DB8 /* Expectation.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - D9600B2742C23AE11E97B3743DC98212 /* SectionedViewDataSourceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CAE3B5E6A9B5CB5DA3D2E7C16549BC9 /* SectionedViewDataSourceType.swift */; }; - D9921CDBA36587248C63AFDD5B3C1981 /* Equal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A9AF09A2BEAEBA835B01672295C3993 /* Equal.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - D99D9FE88B8E0EF3B32D925CC85E976B /* RLMObjectBase.h in Headers */ = {isa = PBXBuildFile; fileRef = B54E8EE5A67BAF0E3BA65C7AF73361F6 /* RLMObjectBase.h */; }; - D9BD6FFFCBBF8FA5D8DBE892BF32363F /* RLMSyncManager.h in Headers */ = {isa = PBXBuildFile; fileRef = DBFD2B4D84BE6F02957AA2D4188E318C /* RLMSyncManager.h */; }; - D9DF250EE6CAA65EC69D34B256F8BA57 /* RLMRealm_Dynamic.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = E870979F5C62F7A48BBA13C070842F12 /* RLMRealm_Dynamic.h */; }; - DA3036F47586D0CEBA519579788A2797 /* SubscriptionDisposable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 750E9F15C16D92388077575CEA7712A8 /* SubscriptionDisposable.swift */; }; - DA4D57C3EDFFD65BFE57D87BB17984AC /* ConcurrentMainScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46617FD4B1B797669A2C1114600DD34E /* ConcurrentMainScheduler.swift */; }; - DA68D1F076FF08F67FD9D9B0F706FD85 /* RLMAuthResponseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 53AAF25454CBD69509B3B72C6CB097E5 /* RLMAuthResponseModel.m */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - DB039F39038342DE5258F386F694A9A0 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 136AFA9689B711E029B581C792CE3A0E /* SourceLocation.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - DB5066EBB8C95A3F8818628C9CA6794D /* CwlCatchException.m in Sources */ = {isa = PBXBuildFile; fileRef = CD21F45AFD5FE86A1DB42E264B40DE2A /* CwlCatchException.m */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - DB73C3113FF14569536F565CE7F339D3 /* RLMRealmConfiguration_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = C555FD10571F74DAE34500F844CB34CA /* RLMRealmConfiguration_Private.h */; }; - DC73880B3D3FD342364BB052E2E332ED /* RLMSyncPermissionOffer.h in Headers */ = {isa = PBXBuildFile; fileRef = F8BAE64E30EA9DF69A3FB3B92FC4D690 /* RLMSyncPermissionOffer.h */; }; - DC83AE82875D9DC0371F85939FD34C30 /* ObjectSchema.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD10538785F57950A30FC93BB2235A23 /* ObjectSchema.swift */; }; - DC9C69D7524AFEECCDC73D5CF1F4C028 /* HaveCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD90D2AB53FA33B7CBDE9113E1BAFAD9 /* HaveCount.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - DD0F5D9EEF6422ED677A2FC9036DA84C /* ThreadSafeReference.swift in Sources */ = {isa = PBXBuildFile; fileRef = E79585EC3A1B2374F751C0A5CF376D96 /* ThreadSafeReference.swift */; }; - DD5257131F752B936FA1EFDA8951F732 /* RxRealm-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A2FDB31E4EA5A36354AD7345532825B /* RxRealm-dummy.m */; }; - DD5C32B9E0C197E78FCFA55F194015DE /* UISegmentedControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD07A521480F7B304630DBB4FBE34315 /* UISegmentedControl+Rx.swift */; }; - DD91B2D1A2BBBD055C9282E3AA91BC5D /* Throttle.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6762421CBA4B7F9E6760BEF91362ED2 /* Throttle.swift */; }; - DE52460D2BBF8D04582FC6C369D7635A /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1157481D2F368CAF1F9B68ACA0572CC /* Expression.swift */; }; - DEBA7257A0F6CE98CF3698BA752C38DC /* Variable+Driver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4004319B47C10CDA4EF68FAEFE680BF7 /* Variable+Driver.swift */; }; - DEEC09C8DAE3ACA8B9C0E3825B1FDAA2 /* ObserveOnSerialDispatchQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD6FA85A15D26B61CF56DC7EF9DE08BD /* ObserveOnSerialDispatchQueue.swift */; }; - DEF289C7BF4E97D42B06B1EB7CAE0951 /* CwlCatchException.h in Headers */ = {isa = PBXBuildFile; fileRef = A86464618F957668786B8EF062C78CDB /* CwlCatchException.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E029AAF9F297C89C3B3BA733724C7A23 /* Buffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4A4EC47B6EE359C279B465EA06249E65 /* Buffer.swift */; }; - E1554E6ED22E94CAD97E211C7FBA530B /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 525BBAE5E1D5FBF64B9826C4092AEDF1 /* MatcherProtocols.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - E2282ADDB414CBA4E8BA5A0AF9AB0C92 /* RLMSyncSession.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 4B0E7614E593D71E05DE51065E273B00 /* RLMSyncSession.h */; }; - E24DFCCF40BA25CFBB1C33D631443B78 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC779AAB6131AEB402A39824AB090711 /* RxSwift.framework */; }; - E31F8CF8D532ADF68F837678189E0EDE /* RLMThreadSafeReference.h in Headers */ = {isa = PBXBuildFile; fileRef = 6ABACBA2C9D315DC47A49C74A8B7C2A4 /* RLMThreadSafeReference.h */; }; - E3C596BD1963FA19FCCC5DC692076BAD /* RLMObject.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = FA5021148FF213AE082EF2C5A2958FC2 /* RLMObject.h */; }; - E459541DAC105180207C8EFE0372584C /* RLMSyncConfiguration_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 85D3B261B046352E80E38C49E4517546 /* RLMSyncConfiguration_Private.h */; }; - E529046ADA847803686D1DBDE2283DE8 /* RxSearchBarDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4AA2D939D8E8D6AE9DA9F8D7B271D82D /* RxSearchBarDelegateProxy.swift */; }; - E5BDCB8296952CD04C3997B8028FF0A7 /* UIRefreshControl+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9046C10DF3A711A09325597D815E642 /* UIRefreshControl+Rx.swift */; }; - E642CE945228A43D636F29DD216AD2DB /* Sample.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF58653ECA07C59AB6640587F777ED92 /* Sample.swift */; }; - E6916A70F961AB6F07E6139B31ABBEDE /* RLMRealm.h in Headers */ = {isa = PBXBuildFile; fileRef = 05BBFEBBC89AB7495B8AA058F7F2BE9E /* RLMRealm.h */; }; - E6DAC9C86173CA14D280D5D8A03DD85D /* KVORepresentable+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A8B7793D5448EE99219A35DA19CDD5A /* KVORepresentable+Swift.swift */; }; - E7991982F8254B272690ACED75B81FBB /* TestSchedulerVirtualTimeConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EA742BECA70255895A57D401A3A6CCD /* TestSchedulerVirtualTimeConverter.swift */; }; - E79E3B3B1D42B335BF8D3550AFA06624 /* Migration.swift in Sources */ = {isa = PBXBuildFile; fileRef = A8C627F09111D781B1E5806663B4BA35 /* Migration.swift */; }; - E8EA26ED8CEA1EB1A80A2DC9A599E016 /* KVORepresentable+CoreGraphics.swift in Sources */ = {isa = PBXBuildFile; fileRef = A313D72946CF65A31A5271AF35621830 /* KVORepresentable+CoreGraphics.swift */; }; - E8EE353986CDA9D4463265A77A30C865 /* RLMObjectSchema_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 38039087DC23815CCBF407685CADBECC /* RLMObjectSchema_Private.h */; }; - E90F24F57A9927E2F27C137A5FFA9169 /* thread_safe_reference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D20E2A97038719D7BEFEF436CB51AC6B /* thread_safe_reference.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - E90F66D0F09A00C785FFD5FE2DD90AEE /* Variable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF5A33C252816D101B9C6623DF7945AB /* Variable.swift */; }; - E9C4603CBC2D6A6A8022EF787325DC2D /* Driver+Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E182F088496B1909960A9BBE421C72F /* Driver+Subscription.swift */; }; - E9C5144BD91B6228AEE10B4D6A0595AF /* UIView+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82E590C4034DA657F3FD05E72AD2CF09 /* UIView+Rx.swift */; }; - E9CD7EF9DD6E75404E4264F6F0AC8D26 /* NMBExceptionCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A9222DCDF1EAEA433A8C04E7FB723E6 /* NMBExceptionCapture.h */; settings = {ATTRIBUTES = (Public, ); }; }; - EA2EED60BF65C08C93126F4AC5D74434 /* Sync.swift in Sources */ = {isa = PBXBuildFile; fileRef = 184EF4E324F18EA3D7A22187D6194E83 /* Sync.swift */; }; - EAC932D97CB968BC9F96B5FAAAD7689B /* HistoricalSchedulerTimeConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7698006130BFE2C96308386024F8EE19 /* HistoricalSchedulerTimeConverter.swift */; }; - EB6ACAB77B45315C8BD88A590F88F0E3 /* Amb.swift in Sources */ = {isa = PBXBuildFile; fileRef = A326BD661EDA3D826886B4A226F02BFB /* Amb.swift */; }; - EBC8BC5B675C4197F7B8BD186FC0847B /* RLMResults_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = DE1A575C17A110965C2E6FB43F4D1E53 /* RLMResults_Private.h */; }; - EC286ED821C9A94BA7198DCC721CFDAD /* UILabel+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 054A91F59859D171BD523D096B163ED3 /* UILabel+Rx.swift */; }; - ECCD0D1B793D9CB7367A5AE4086BE2C9 /* Pods-DomainTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 70805CBC75B69AC5D24785462BACE900 /* Pods-DomainTests-dummy.m */; }; - EDCD0360DB1E518AD01A0AB641E3770E /* RLMRealmConfiguration.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 2738DC94C928353E0D38A5463635400B /* RLMRealmConfiguration.h */; }; - EEA616CF45528064C8899C9FF0EB9CD3 /* RLMOptionalBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 996D4E51556FD2FC3D61A7136E60ABCD /* RLMOptionalBase.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - EEACC5B78AFB71C8594380C005C17A4B /* XCTestObservationCenter+Register.m in Sources */ = {isa = PBXBuildFile; fileRef = 77CC4DB011DDA939C0C72968B477901F /* XCTestObservationCenter+Register.m */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - EEF0BA275250A24A214590305A4E8438 /* RLMSyncSessionRefreshHandle.mm in Sources */ = {isa = PBXBuildFile; fileRef = B5C37C815B704CE983D68F11076255DC /* RLMSyncSessionRefreshHandle.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - EF000ABEEFDFA83EFB51DA41344138CC /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8BC37B11E78B44F63082BB22B6D284EF /* Event.swift */; }; - EFECDEF178827D27B8E53EA31D699AF6 /* RLMObjectSchema.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = AA2358C12FB2240A3DA7703004D3EF17 /* RLMObjectSchema.h */; }; - F01E50E7198011054FD44A8C397B939A /* Queue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21073C8D5D87488522A173376647FA7D /* Queue.swift */; }; - F02CD5AE519358EE1AF5D3191FD56268 /* RxTextStorageDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6CD153809273B5A278677D70BFA8C28 /* RxTextStorageDelegateProxy.swift */; }; - F03376C8A612EF07277B6F0DFF94F022 /* ObjectiveCSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECDF6CF651A49944A8B69F2691D7DCC7 /* ObjectiveCSupport.swift */; }; - F03B94926A8B4A7F3EFC5FC84D7066EC /* RLMObject.h in Headers */ = {isa = PBXBuildFile; fileRef = FA5021148FF213AE082EF2C5A2958FC2 /* RLMObject.h */; }; - F100D41C0564EE46CA47DA9E3540DA70 /* BeNil.swift in Sources */ = {isa = PBXBuildFile; fileRef = ECE64C1907963A888AD25A49054B3C1F /* BeNil.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - F14B3BF2A0ACB37EF431FFD3F2724BA0 /* InfiniteSequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = F02E16D11D5BE1429FC72E907936E62A /* InfiniteSequence.swift */; }; - F29AB8B5DC275C2A3BA8E0E3C5FEA0A3 /* Empty.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD69336C9FF50F5AC4C94C3087DD45B4 /* Empty.swift */; }; - F2ED0A18E020A07A092F957B2C7EF0E2 /* mach_excServer.c in Sources */ = {isa = PBXBuildFile; fileRef = CA2C25F591391F4A8A267326178CE596 /* mach_excServer.c */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - F2ED7EE7DA5041DC679FD991DCFB6D97 /* RLMSyncPermissionOfferResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F5BFCB6E3E5ECB905ED65B33EC661E /* RLMSyncPermissionOfferResponse.m */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - F328AEADEA0C35124301DD165618B038 /* Any+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B52F189427B8938EFEBECDF3BB41E62 /* Any+Equatable.swift */; }; - F331BA21FB473AD19E5ACC01FA2D66EF /* DelaySubscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7395C76AB3CA60B39405806587407D4B /* DelaySubscription.swift */; }; - F386911DD3EAC1FECCC7ED51E2401C89 /* RLMRealmConfiguration+Sync.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = A1C84A6BF14AB41A9CD563155675C452 /* RLMRealmConfiguration+Sync.h */; }; - F39D3A14DD659D8F51B6FE86B6F2AD0D /* RLMSyncPermissionOffer_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = A99D0A764F4145F96DCA40079603C8DA /* RLMSyncPermissionOffer_Private.h */; }; - F3C083D68BD79206362C1A1A85CBF01E /* collection_notifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3993AF868F7A8EDD1EAB67CF1CD28C2 /* collection_notifier.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - F4B39A48AD745AF8AE602695B3D4DEAC /* RLMSyncPermissionOfferResponse_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = 41A4EF93D766224EFFDA68623C54A7AF /* RLMSyncPermissionOfferResponse_Private.h */; }; - F7122FBCC6F238EFFBD0B2F634E7D8DE /* RLMSyncManager.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = DBFD2B4D84BE6F02957AA2D4188E318C /* RLMSyncManager.h */; }; - F799FFF1E4863A9F85986F71C086ED72 /* RLMSyncManager_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = 60E0AEFD6A0696202E1127E8C6189CD6 /* RLMSyncManager_Private.h */; }; - F811398DE37E88C2A95DBCD7037E5A9C /* RLMMigration_Private.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = 79587E31E603FA8B4DF3FABA69304C71 /* RLMMigration_Private.h */; }; - F88BC6DC73110231847F971C3895DB24 /* DefaultIfEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = E918723374177EFDBA5DCB0F2C860319 /* DefaultIfEmpty.swift */; }; - F88C1B26CDECF34A818AD045E5DFA336 /* ReplaySubject.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8ECCEFFF303418E9B3C78513C791ED99 /* ReplaySubject.swift */; }; - F8D7868BBAF5368D93F4D05E6F2E2E73 /* sync_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F57C90608F519FFA9A54FE5033F63FC /* sync_manager.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - F9062E255867BF6835DFF71CB27BF728 /* RLMAccessor.h in Copy . Private Headers */ = {isa = PBXBuildFile; fileRef = 9EE14CD66DEAC50B04FB05EC9EE4D7EE /* RLMAccessor.h */; }; - FA52642BD078CA309FB364699AFA7022 /* SchedulerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 68436A929FC24C5B08B4410FF0F3FE4E /* SchedulerType.swift */; }; - FA97456A6C4793CE7C48F92F79E588A2 /* RLMAnalytics.mm in Sources */ = {isa = PBXBuildFile; fileRef = E1D07FB8A794E8FB2ED5630ECA8E9CC1 /* RLMAnalytics.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - FAACCCDBE0D2785212E37468636AAB0A /* AllPass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 59F8320AA898ED121BDECB3666317FA7 /* AllPass.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - FB27F3A7CED8C9E253E2893C65752844 /* Pods-CoreDataPlatformTests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 0C70935926151AE13B56A284870F4468 /* Pods-CoreDataPlatformTests-dummy.m */; }; - FB65EA8ABE95703C21BE1E6B6BB07F85 /* RLMConstants.h in Copy . Public Headers */ = {isa = PBXBuildFile; fileRef = 68118C2B1163EF93144146168FBCF4C0 /* RLMConstants.h */; }; - FC4B876377725955F5231DB219A74544 /* keychain_helper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EEC86B6A1857601BF1A22F485299EFDB /* keychain_helper.cpp */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - FD035FD8A0AC8DDB0C3544012DF869FD /* AsyncLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FE87AF2EF9F402C90C5082447989B6E /* AsyncLock.swift */; }; - FD2DD163B4D854176A969BEA2B559E2C /* RLMSyncUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8BF7DC2FDBE199EDBEBF2DAF7E1A9DF2 /* RLMSyncUtil.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - FD69397CB8DA848C41A1735F7212D6D9 /* Merge.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D94E41581AAC3FC4854F275905059BA /* Merge.swift */; }; - FD9373DD3C1910FB513089F4CD39613B /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = C06DE4D1DD0630A97C784AA835602D8D /* RaisesException.swift */; settings = {COMPILER_FLAGS = "-DPRODUCT_NAME=Nimble/Nimble"; }; }; - FE0F7C529DE6C0897F61FAC951613D30 /* List.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53D068AA6C7568A79DB34061E4DA3E5B /* List.swift */; }; - FE3C83B43146A0278BAE1FCD7DFE5602 /* TestableObservable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D72F989F2C18CD5E8AFFABF58C569A6 /* TestableObservable.swift */; }; - FE5C02BACA2A1B098EDE04002720200E /* RxTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F2192C9597B9EFD767645E7DC17ACAD /* RxTarget.swift */; }; - FE6AE19923E0AF70ABC8629AB826B041 /* _RXDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = F828C4F53AC4B02E2057C7DEE457BE8E /* _RXDelegateProxy.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FF2FC25599DAADF1D06C95D2EDA4B251 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */; }; - FF6ACAF70D0C436399F65364405ECECD /* RLMSyncUser.mm in Sources */ = {isa = PBXBuildFile; fileRef = B9F784C757F4866A2C027B696446EACF /* RLMSyncUser.mm */; settings = {COMPILER_FLAGS = "-DREALM_HAVE_CONFIG -DREALM_COCOA_VERSION='@\"2.4.2\"' -D__ASSERTMACROS__ -DREALM_ENABLE_SYNC"; }; }; - FFE202110C31629681C5B76848B1A203 /* Realm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F6043C2988ECD8BBC9D2B2371E02E8A /* Realm.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 04A2C975B30996E029F71FF187824E8F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 09BA8CC5B372752A9BDD2D2F9D3FF3C3; - remoteInfo = QueryKit; - }; - 1E070DB394CC7AA4E57B8A4F6DF36990 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - 1F4BDB9C64F35A79D52EDE382D7E09B0 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - 237EAF805843A6338EC9DA29F27BF313 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 09BA8CC5B372752A9BDD2D2F9D3FF3C3; - remoteInfo = QueryKit; - }; - 271202732A0322638DC8AB835CC91F7F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = B4E37325D2457E5277018CBA42075AB3; - remoteInfo = Realm; - }; - 27DEE0F5CB962466A90ABAC16AA9BF9B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - 301F8493B36FDEAE631D50E40629934B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = B4E37325D2457E5277018CBA42075AB3; - remoteInfo = Realm; - }; - 414D70E8A097790A23663C1C301642A7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - 478FFFAC6DF454A0BB665C59C2BF104F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0FA880147422C0573B85D5EE25135ECB; - remoteInfo = RxBlocking; - }; - 4C57DD4F0EFE9080D128322B0ADDAB91 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 09BA8CC5B372752A9BDD2D2F9D3FF3C3; - remoteInfo = QueryKit; - }; - 52AD133906F86059CA918FF4C106D4FE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = B4E37325D2457E5277018CBA42075AB3; - remoteInfo = Realm; - }; - 54DBE46667BC89CD0AEB796307FC4A9B /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5307BD323DF75EDE6039AE386A3585C1; - remoteInfo = RxRealm; - }; - 5940D15C227FDCBE1130B3DE24D9E4F5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0921CC2F4398BE9A4F1CEACB30684B56; - remoteInfo = Nimble; - }; - 5B9B69499908D4E19F3146753C223221 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0FA880147422C0573B85D5EE25135ECB; - remoteInfo = RxBlocking; - }; - 60C18BA63ED338345864AE96CEF443C5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = C4DAB4A5F18928931142281FA545B3F1; - remoteInfo = RxTest; - }; - 6B0FACADD550DD3DBDD9356AC2CF5D62 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 87CB6B6F4E9B6DE92184C1B58B832F6D; - remoteInfo = RealmSwift; - }; - 71B53F65178CA2BBEE8BD444BB670AAE /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0FA880147422C0573B85D5EE25135ECB; - remoteInfo = RxBlocking; - }; - 7607DA3A6D7126F4D90D825F8CBB80EB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 09BA8CC5B372752A9BDD2D2F9D3FF3C3; - remoteInfo = QueryKit; - }; - 76FC13032E8B47F4CFD9A585D0890213 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 87CB6B6F4E9B6DE92184C1B58B832F6D; - remoteInfo = RealmSwift; - }; - 772B4923A70FE20654856B56AA71376D /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - 7FB9662A4E090AF7EC6A7764E7E37CBC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = C4DAB4A5F18928931142281FA545B3F1; - remoteInfo = RxTest; - }; - 808331F68CFB51E97314FC21E261C0D3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0921CC2F4398BE9A4F1CEACB30684B56; - remoteInfo = Nimble; - }; - 81BB638C5823F6F7337C6567D69FD6C8 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 09BA8CC5B372752A9BDD2D2F9D3FF3C3; - remoteInfo = QueryKit; - }; - 87D461EF4F5918FF88C7AF08703BD48A /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - 923A86F80ACBFAEABBFC7966C5883062 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = C4DAB4A5F18928931142281FA545B3F1; - remoteInfo = RxTest; - }; - 978AB414A4F8081DF72BB19F2E68E795 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 87CB6B6F4E9B6DE92184C1B58B832F6D; - remoteInfo = RealmSwift; - }; - 9B6E1C2C1BFDEAC8866CFAA05BC5E0C6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0921CC2F4398BE9A4F1CEACB30684B56; - remoteInfo = Nimble; - }; - A0BA5AFB384C0EE46612CC286775F2A7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0921CC2F4398BE9A4F1CEACB30684B56; - remoteInfo = Nimble; - }; - A656DA944586812EB843BBC73756A754 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - A9EA80443FA13C764B5C8F5D881D889C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5307BD323DF75EDE6039AE386A3585C1; - remoteInfo = RxRealm; - }; - ACC1B9317D3DB295E4043B244B618B3F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 87CB6B6F4E9B6DE92184C1B58B832F6D; - remoteInfo = RealmSwift; - }; - B4A2649C4D1018F105612C2F8F242C45 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - C2D76656AD27837CDFDF1510FD20E544 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = C4DAB4A5F18928931142281FA545B3F1; - remoteInfo = RxTest; - }; - C96ADF84CF672D3DBE0695A5DB2A5444 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - CA129C377A42741683F3A51A8605138F /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0FA880147422C0573B85D5EE25135ECB; - remoteInfo = RxBlocking; - }; - CF803DAD36E7622EDAD21880D0E517CD /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = B4E37325D2457E5277018CBA42075AB3; - remoteInfo = Realm; - }; - D2B94A7C93AB85695F378F04F6813516 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - DE1C8689FFD9240EC56DFA0C18ECC17D /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - E161C7CA1BD867A0571A21F2394B1E59 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = B4E37325D2457E5277018CBA42075AB3; - remoteInfo = Realm; - }; - E5C9DD4F5238DFFD6619F31087F0FCC1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = E7E430A4361D8E1469CCFBD6B006F55F; - remoteInfo = RxSwift; - }; - EE89A60B8F4358DB7A2A61C9E2384DAB /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 940A8F3B71CC96F0FEF292E8DF3597E2; - remoteInfo = RxCocoa; - }; - F46E290A832893AF854068F9F8096317 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 5307BD323DF75EDE6039AE386A3585C1; - remoteInfo = RxRealm; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 81F8112F88C33296011F7509C3059110 /* Copy . Public Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "$(PUBLIC_HEADERS_FOLDER_PATH)/."; - dstSubfolderSpec = 16; - files = ( - 2DC88DDB75B4F3AD2EAAFB6E9ECAACCA /* NSError+RLMSync.h in Copy . Public Headers */, - 794468717E1BF7B6C69DB625A6E2FF48 /* Realm.h in Copy . Public Headers */, - 82C9B744FDD1C25FFC5491A33C9596B5 /* RLMArray.h in Copy . Public Headers */, - C28A9469F34BD7D171BF9CE35EF855D1 /* RLMCollection.h in Copy . Public Headers */, - FB65EA8ABE95703C21BE1E6B6BB07F85 /* RLMConstants.h in Copy . Public Headers */, - BBCB6D45658246717408C9E955BD84A7 /* RLMListBase.h in Copy . Public Headers */, - 03C9E8960AB73B4BF98F390661C2B764 /* RLMMigration.h in Copy . Public Headers */, - E3C596BD1963FA19FCCC5DC692076BAD /* RLMObject.h in Copy . Public Headers */, - 00CAC914662A338E2865058F4BADD5A2 /* RLMObjectBase.h in Copy . Public Headers */, - 27A1C6A11842EDFB253A7A31D3902677 /* RLMObjectBase_Dynamic.h in Copy . Public Headers */, - EFECDEF178827D27B8E53EA31D699AF6 /* RLMObjectSchema.h in Copy . Public Headers */, - 6C76372BFB58A83CD36051C1B521FB84 /* RLMOptionalBase.h in Copy . Public Headers */, - A89F3A35EDBD8F49D96024664BDDC3F2 /* RLMPlatform.h in Copy . Public Headers */, - 274CD942EBC2FAF7E9DD5EDD7E988B17 /* RLMProperty.h in Copy . Public Headers */, - C63F01DA8FD6EF928A12E7570A440A8E /* RLMRealm.h in Copy . Public Headers */, - D9DF250EE6CAA65EC69D34B256F8BA57 /* RLMRealm_Dynamic.h in Copy . Public Headers */, - F386911DD3EAC1FECCC7ED51E2401C89 /* RLMRealmConfiguration+Sync.h in Copy . Public Headers */, - EDCD0360DB1E518AD01A0AB641E3770E /* RLMRealmConfiguration.h in Copy . Public Headers */, - 708B7E7A92AC1C3583C0F3B502CD5365 /* RLMResults.h in Copy . Public Headers */, - 9078ED5F28A296FCF92EFAA16393B43B /* RLMSchema.h in Copy . Public Headers */, - 498BA94B3767BB81531AE5BDEC5FC027 /* RLMSyncConfiguration.h in Copy . Public Headers */, - C2D34F816D23FF0AF63A6F931E3FA36A /* RLMSyncCredentials.h in Copy . Public Headers */, - F7122FBCC6F238EFFBD0B2F634E7D8DE /* RLMSyncManager.h in Copy . Public Headers */, - 028B1C4625DAF6FD648957CB649F1115 /* RLMSyncPermissionChange.h in Copy . Public Headers */, - 8AA47706BFC064659CF38507FF116092 /* RLMSyncPermissionOffer.h in Copy . Public Headers */, - 2E11F501621B848A83AF9A7A21BE21F0 /* RLMSyncPermissionOfferResponse.h in Copy . Public Headers */, - E2282ADDB414CBA4E8BA5A0AF9AB0C92 /* RLMSyncSession.h in Copy . Public Headers */, - 1156C06DA6A931174DCBC7948A15BA20 /* RLMSyncUser.h in Copy . Public Headers */, - 0CBAC4A242DB22A93BB0513CF11EEC3D /* RLMSyncUtil.h in Copy . Public Headers */, - 7777B8EB829C441942011FF91F4BD154 /* RLMThreadSafeReference.h in Copy . Public Headers */, - ); - name = "Copy . Public Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; - D3497221C92AA39222A7B990F71829CF /* Copy . Private Headers */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "$(PRIVATE_HEADERS_FOLDER_PATH)/."; - dstSubfolderSpec = 16; - files = ( - F9062E255867BF6835DFF71CB27BF728 /* RLMAccessor.h in Copy . Private Headers */, - CC76A112623D4981E1D17E0C6EC6FF31 /* RLMArray_Private.h in Copy . Private Headers */, - 7D73D65CE9BE1F8EEF943ADC46A1A5AF /* RLMListBase.h in Copy . Private Headers */, - F811398DE37E88C2A95DBCD7037E5A9C /* RLMMigration_Private.h in Copy . Private Headers */, - 485AA0A2AF45FB43ABCDA55C440F57DB /* RLMObject_Private.h in Copy . Private Headers */, - 5B310F12E65785EA98F0F8078C8DFD90 /* RLMObjectSchema_Private.h in Copy . Private Headers */, - A3A35910366400841E04E80391C8E31D /* RLMObjectStore.h in Copy . Private Headers */, - A67CD1439188015DD46B425EEA82E946 /* RLMOptionalBase.h in Copy . Private Headers */, - 027CE8DFB431262070F801BB3AB9DC90 /* RLMProperty_Private.h in Copy . Private Headers */, - B4BFD5554CB9A56D403727D9F0E61253 /* RLMRealm_Private.h in Copy . Private Headers */, - DB73C3113FF14569536F565CE7F339D3 /* RLMRealmConfiguration_Private.h in Copy . Private Headers */, - EBC8BC5B675C4197F7B8BD186FC0847B /* RLMResults_Private.h in Copy . Private Headers */, - 8D6C9667138F9296FA5B35F30E6A7A43 /* RLMSchema_Private.h in Copy . Private Headers */, - 5F7C33DAAF62C8FFE9F1C9C3AF159E4D /* RLMSyncConfiguration_Private.h in Copy . Private Headers */, - F799FFF1E4863A9F85986F71C086ED72 /* RLMSyncManager_Private.h in Copy . Private Headers */, - C5899FB50C8114B86965799A6C0A1AA2 /* RLMSyncPermissionChange_Private.h in Copy . Private Headers */, - F39D3A14DD659D8F51B6FE86B6F2AD0D /* RLMSyncPermissionOffer_Private.h in Copy . Private Headers */, - F4B39A48AD745AF8AE602695B3D4DEAC /* RLMSyncPermissionOfferResponse_Private.h in Copy . Private Headers */, - 995D9EDC65494F1B9F5690C827134FD1 /* RLMSyncUtil_Private.h in Copy . Private Headers */, - ); - name = "Copy . Private Headers"; - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 00245512723919720F6610B0FD5B5FA5 /* ObservableConvertibleType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObservableConvertibleType.swift; path = RxSwift/ObservableConvertibleType.swift; sourceTree = ""; }; - 00BC4A17CF3F1323C69BB2FB47C342D6 /* RLMRealmConfiguration+Sync.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = "RLMRealmConfiguration+Sync.mm"; path = "Realm/RLMRealmConfiguration+Sync.mm"; sourceTree = ""; }; - 00FBD3A4BE3A018F8FDA36EB65F0A353 /* Pods-RealmPlatformTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-RealmPlatformTests-umbrella.h"; sourceTree = ""; }; - 010615A01409020BA1C725CE32E0E35D /* Window.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Window.swift; path = RxSwift/Observables/Implementations/Window.swift; sourceTree = ""; }; - 01312618C8A9DE3BF0AB661508430F78 /* Zip.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Zip.swift; path = RxSwift/Observables/Implementations/Zip.swift; sourceTree = ""; }; - 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; - 01FA738286EDB78D4DEA81877FB6F38A /* Reduce.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Reduce.swift; path = RxSwift/Observables/Implementations/Reduce.swift; sourceTree = ""; }; - 028869F8443663B70CD76DCD7D83454E /* CombineLatest.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CombineLatest.swift; path = RxSwift/Observables/Implementations/CombineLatest.swift; sourceTree = ""; }; - 029892FACEB725CF1225E2F2BBB181AE /* RLMMigration.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMMigration.mm; path = Realm/RLMMigration.mm; sourceTree = ""; }; - 02C8097609AA8B6959CB5B30CD203514 /* RxTabBarDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTabBarDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTabBarDelegateProxy.swift; sourceTree = ""; }; - 0345ECE2099E714228B5AC19D4D68858 /* ObservableType+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ObservableType+Extensions.swift"; path = "RxSwift/ObservableType+Extensions.swift"; sourceTree = ""; }; - 03A66613668A36AB188D806792455DCF /* SerialDispatchQueueScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SerialDispatchQueueScheduler.swift; path = RxSwift/Schedulers/SerialDispatchQueueScheduler.swift; sourceTree = ""; }; - 04091A58B1790A6548EF098AE66CF3A9 /* Repeat.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Repeat.swift; path = RxSwift/Observables/Implementations/Repeat.swift; sourceTree = ""; }; - 045F751C52CF1B431127377D279309ED /* Pods-Domain.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Domain.release.xcconfig"; sourceTree = ""; }; - 04755FFA86DD547A2EC9D4A3832B0B2C /* NSObject+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSObject+Rx.swift"; path = "RxCocoa/Foundation/NSObject+Rx.swift"; sourceTree = ""; }; - 04EE35D0725F8F90CC75E788D19568FB /* RealmConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RealmConfiguration.swift; path = RealmSwift/RealmConfiguration.swift; sourceTree = ""; }; - 054A91F59859D171BD523D096B163ED3 /* UILabel+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UILabel+Rx.swift"; path = "RxCocoa/iOS/UILabel+Rx.swift"; sourceTree = ""; }; - 05BBFEBBC89AB7495B8AA058F7F2BE9E /* RLMRealm.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMRealm.h; path = include/RLMRealm.h; sourceTree = ""; }; - 05FBC618FE607B32B230E614F5E23BD4 /* InvocableType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InvocableType.swift; path = RxSwift/Schedulers/Internal/InvocableType.swift; sourceTree = ""; }; - 061B315CD14BB732ABE81D3E9A24E1F6 /* RLMSchema.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMSchema.mm; path = Realm/RLMSchema.mm; sourceTree = ""; }; - 079584E666EB760187090CA5E1AAD808 /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Extensions.swift"; path = "Platform/DispatchQueue+Extensions.swift"; sourceTree = ""; }; - 092FA86B8002A03741E806731B57D444 /* Producer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Producer.swift; path = RxSwift/Observables/Implementations/Producer.swift; sourceTree = ""; }; - 09A9B00781747A780375A164E3453854 /* object.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = object.cpp; path = Realm/ObjectStore/src/object.cpp; sourceTree = ""; }; - 09CA29D163C4A81B573A815A943B909E /* RLMSyncPermissionChange.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncPermissionChange.h; path = include/RLMSyncPermissionChange.h; sourceTree = ""; }; - 0A85BA326BCA9C57C225C39D9F0DB3C1 /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Extensions.swift"; path = "Platform/DispatchQueue+Extensions.swift"; sourceTree = ""; }; - 0AE740C98D7CFDF5038DA7D4F0EE9F90 /* Pods-CoreDataPlatformTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CoreDataPlatformTests.release.xcconfig"; sourceTree = ""; }; - 0AEC88EB83550D0CEE740F01AD3304F3 /* Observable+Multiple.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Observable+Multiple.swift"; path = "RxSwift/Observables/Observable+Multiple.swift"; sourceTree = ""; }; - 0AEEBAA5CB753B13E23FAADB71045F6B /* collection_change_builder.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = collection_change_builder.cpp; path = Realm/ObjectStore/src/impl/collection_change_builder.cpp; sourceTree = ""; }; - 0B204EC96A756B07F25AF71D7F3A0DB6 /* RxRealm-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxRealm-prefix.pch"; sourceTree = ""; }; - 0BC2B8130EA21CDE8FF89AB1DC379AE6 /* AnonymousDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnonymousDisposable.swift; path = RxSwift/Disposables/AnonymousDisposable.swift; sourceTree = ""; }; - 0BCE66A45226586BD7DF6BEC43E0434D /* Never.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Never.swift; path = RxSwift/Observables/Implementations/Never.swift; sourceTree = ""; }; - 0BFB4F3168E45943ABFB5A3C6F1095BB /* RLMSyncPermissionChange_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncPermissionChange_Private.h; path = include/RLMSyncPermissionChange_Private.h; sourceTree = ""; }; - 0C70935926151AE13B56A284870F4468 /* Pods-CoreDataPlatformTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CoreDataPlatformTests-dummy.m"; sourceTree = ""; }; - 0CBA7974D236DDD9E271202CE949519C /* Pods-DomainTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-DomainTests-frameworks.sh"; sourceTree = ""; }; - 0D67BEF4D9D22A8A0DFE2543AE09F23C /* RLMSyncConfiguration.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMSyncConfiguration.mm; path = Realm/RLMSyncConfiguration.mm; sourceTree = ""; }; - 0D6BF12283E0B530F91741DBA29B1319 /* Aliases.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Aliases.swift; path = RealmSwift/Aliases.swift; sourceTree = ""; }; - 0DFEB0B7CB2825572602F5F010201A06 /* Pods-RealmPlatformTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-RealmPlatformTests-acknowledgements.markdown"; sourceTree = ""; }; - 0F57C90608F519FFA9A54FE5033F63FC /* sync_manager.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = sync_manager.cpp; path = Realm/ObjectStore/src/sync/sync_manager.cpp; sourceTree = ""; }; - 0FB4B0C151C53589DDA9F00F0030A6E4 /* ThrowAssertion.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThrowAssertion.swift; path = Sources/Nimble/Matchers/ThrowAssertion.swift; sourceTree = ""; }; - 0FCF9752602870D62F4F883BFD687FDE /* Pods-CleanArchitectureRxSwiftTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-CleanArchitectureRxSwiftTests-acknowledgements.markdown"; sourceTree = ""; }; - 10FB1984BCE73F6D4CB9601C885A083C /* Pods-RealmPlatform-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-RealmPlatform-resources.sh"; sourceTree = ""; }; - 119538EEE489B3E27AA49D1FE48283F4 /* RealmSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "RealmSwift-dummy.m"; sourceTree = ""; }; - 119DC06AE581F74CB5C3B6B890F896E9 /* list.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = list.cpp; path = Realm/ObjectStore/src/list.cpp; sourceTree = ""; }; - 136A584F0B6A3A1978B654F11781FD46 /* Pods-CleanArchitectureRxSwiftTests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CleanArchitectureRxSwiftTests-resources.sh"; sourceTree = ""; }; - 136AFA9689B711E029B581C792CE3A0E /* SourceLocation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SourceLocation.swift; path = Sources/Nimble/Utils/SourceLocation.swift; sourceTree = ""; }; - 137E976E469CFB6D8C628C752EEF26AB /* RLMThreadSafeReference.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMThreadSafeReference.mm; path = Realm/RLMThreadSafeReference.mm; sourceTree = ""; }; - 13C208D8232C936AFB19CB44F0687578 /* AdapterProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AdapterProtocols.swift; path = Sources/Nimble/Adapters/AdapterProtocols.swift; sourceTree = ""; }; - 147B789AB94E510D2BF6BB8A33E9624E /* Pods_CleanArchitectureRxSwiftTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_CleanArchitectureRxSwiftTests.framework; path = "Pods-CleanArchitectureRxSwiftTests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - 14F213114CE9516889AF0C47CCFC8644 /* RxCollectionViewReactiveArrayDataSource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewReactiveArrayDataSource.swift; path = RxCocoa/iOS/DataSources/RxCollectionViewReactiveArrayDataSource.swift; sourceTree = ""; }; - 1543FA1B38905618379CEAC6A4136358 /* SynchronizedDisposeType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SynchronizedDisposeType.swift; path = RxSwift/Concurrency/SynchronizedDisposeType.swift; sourceTree = ""; }; - 16328397D269057A1C0D76E728ED85F5 /* Pods-CoreDataPlatform.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CoreDataPlatform.release.xcconfig"; sourceTree = ""; }; - 174DE8C4304E4DE07714C32E3A792E71 /* RxBlocking.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RxBlocking.framework; path = RxBlocking.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 178501B9502D26D23613A114C84F2578 /* Generate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Generate.swift; path = RxSwift/Observables/Implementations/Generate.swift; sourceTree = ""; }; - 17880DD8A71DD766D4C5BF068866C398 /* RLMNetworkClient.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = RLMNetworkClient.m; path = Realm/RLMNetworkClient.m; sourceTree = ""; }; - 18251AFE1D92A264FF23E4B4BB099AD5 /* SerialDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SerialDisposable.swift; path = RxSwift/Disposables/SerialDisposable.swift; sourceTree = ""; }; - 184EF4E324F18EA3D7A22187D6194E83 /* Sync.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Sync.swift; path = RealmSwift/Sync.swift; sourceTree = ""; }; - 187CB18ECDE52D77BEB23E286DF86FA7 /* SynchronizedSubscribeType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SynchronizedSubscribeType.swift; path = RxSwift/Concurrency/SynchronizedSubscribeType.swift; sourceTree = ""; }; - 18CF0CACF92757CC2590C03214C9CC7E /* UIButton+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIButton+Rx.swift"; path = "RxCocoa/iOS/UIButton+Rx.swift"; sourceTree = ""; }; - 197A704378E5C9A322E08AC37188B3B8 /* Pods_CoreDataPlatform.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_CoreDataPlatform.framework; path = "Pods-CoreDataPlatform.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - 19C9139587A0BA340E56221ED8C0BFDF /* RLMMigration.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMMigration.h; path = include/RLMMigration.h; sourceTree = ""; }; - 19EA56528221F157A574C7B4B1D7112D /* UIPageControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIPageControl+Rx.swift"; path = "RxCocoa/iOS/UIPageControl+Rx.swift"; sourceTree = ""; }; - 1A2FBA9ED711AFFD0E67EC02BFCF6CBC /* BeGreaterThanOrEqualTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeGreaterThanOrEqualTo.swift; path = Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift; sourceTree = ""; }; - 1AF5E8E6E9B553B5DC77EDB7153C5267 /* SharedSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SharedSequence.swift; path = RxCocoa/CocoaUnits/SharedSequence/SharedSequence.swift; sourceTree = ""; }; - 1B6630E2BCC0325A3B9010075A6EA253 /* NMBExceptionCapture.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NMBExceptionCapture.m; path = Sources/NimbleObjectiveC/NMBExceptionCapture.m; sourceTree = ""; }; - 1BF3FA788E8E5602FEE9A5F090EE93C6 /* MatcherFunc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MatcherFunc.swift; path = Sources/Nimble/Matchers/MatcherFunc.swift; sourceTree = ""; }; - 1C6939167CFD590D922C61EC97874F3A /* Just.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Just.swift; path = RxSwift/Observables/Implementations/Just.swift; sourceTree = ""; }; - 1CB5CB6AC67FFD9DA0B592F391800792 /* ControlProperty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ControlProperty.swift; path = RxCocoa/CocoaUnits/ControlProperty.swift; sourceTree = ""; }; - 1CC63AB5E7C63726A6DB408222F484CF /* Object.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Object.swift; path = RealmSwift/Object.swift; sourceTree = ""; }; - 1D2B9940FB9B64166D596E8557D5A808 /* RLMSyncUtil.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncUtil.h; path = include/RLMSyncUtil.h; sourceTree = ""; }; - 1D6403B29CFAD6729212DED8DBCB98A3 /* InfiniteSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InfiniteSequence.swift; path = Platform/DataStructures/InfiniteSequence.swift; sourceTree = ""; }; - 1D72F989F2C18CD5E8AFFABF58C569A6 /* TestableObservable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TestableObservable.swift; path = RxTest/TestableObservable.swift; sourceTree = ""; }; - 1E182F088496B1909960A9BBE421C72F /* Driver+Subscription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Driver+Subscription.swift"; path = "RxCocoa/CocoaUnits/Driver/Driver+Subscription.swift"; sourceTree = ""; }; - 1E38A3BBA7C1B086C3EB1D2E492298C8 /* RxSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxSwift-umbrella.h"; sourceTree = ""; }; - 1EC2834B0D7626408A52212C60194957 /* Pods-CoreDataPlatformTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-CoreDataPlatformTests-umbrella.h"; sourceTree = ""; }; - 1ED7481D13A8E415D0CFDA2342C7BA12 /* Pods-DomainTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-DomainTests.modulemap"; sourceTree = ""; }; - 1EE2FBEC0F4C6DB320F908FBDE43951A /* FailureMessage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FailureMessage.swift; path = Sources/Nimble/FailureMessage.swift; sourceTree = ""; }; - 1FB1C45406525141D43BD202BFD4601F /* PostNotification.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PostNotification.swift; path = Sources/Nimble/Matchers/PostNotification.swift; sourceTree = ""; }; - 209F4C1D14383101977209F0972A8D40 /* Skip.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Skip.swift; path = RxSwift/Observables/Implementations/Skip.swift; sourceTree = ""; }; - 20BC21E8D260DF654A13E8B8A04D0651 /* Bag+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Bag+Rx.swift"; path = "RxSwift/Extensions/Bag+Rx.swift"; sourceTree = ""; }; - 20E445C57299B1DBB8FA1B6BFEE1E777 /* Pods-CoreDataPlatformTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-CoreDataPlatformTests-acknowledgements.markdown"; sourceTree = ""; }; - 20EE488911C00166EFE0933D311A49C6 /* Pods-Domain.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-Domain.modulemap"; sourceTree = ""; }; - 21073C8D5D87488522A173376647FA7D /* Queue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Queue.swift; path = Platform/DataStructures/Queue.swift; sourceTree = ""; }; - 218C350B11A80A2817C1141FF95F54A1 /* object_store.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = object_store.cpp; path = Realm/ObjectStore/src/object_store.cpp; sourceTree = ""; }; - 224C1458C0153EC325A06AE9F8224501 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 226F053FF2041508860647259F595B96 /* Observable+Binding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Observable+Binding.swift"; path = "RxSwift/Observables/Observable+Binding.swift"; sourceTree = ""; }; - 22EFBBF4C9278AAD5FDC3DE2BDBEDF4C /* Pods-RealmPlatformTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-RealmPlatformTests.release.xcconfig"; sourceTree = ""; }; - 22F13FC131FEBD6B1E0EA44C27EAA523 /* Pods-CleanArchitectureRxSwiftTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-CleanArchitectureRxSwiftTests-umbrella.h"; sourceTree = ""; }; - 237D4E8B60CF721ED681A3052F2BECA9 /* RLMSyncConfiguration.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncConfiguration.h; path = include/RLMSyncConfiguration.h; sourceTree = ""; }; - 23AA7BD6E4CBCFC8AFA0A6E8BBEDF33C /* Realm-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Realm-dummy.m"; sourceTree = ""; }; - 23E3CA0E92CF4E32082E5FB0CD7632ED /* UIDatePicker+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIDatePicker+Rx.swift"; path = "RxCocoa/iOS/UIDatePicker+Rx.swift"; sourceTree = ""; }; - 248B75378699A4E685CFDADA3B8CAC41 /* RLMRealmUtil.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMRealmUtil.mm; path = Realm/RLMRealmUtil.mm; sourceTree = ""; }; - 250E69A7472F260432F4A1F1B1C42AC7 /* QueryKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "QueryKit-prefix.pch"; sourceTree = ""; }; - 256A7CC03DD807F0C92D64B350C9A815 /* Observable+Debug.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Observable+Debug.swift"; path = "RxSwift/Observables/Observable+Debug.swift"; sourceTree = ""; }; - 256AF63FA29E54ABA829F3EB9D900316 /* RLMOptionalBase.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMOptionalBase.h; path = include/RLMOptionalBase.h; sourceTree = ""; }; - 25B4A84FDB33A5C82AF22FA7ED7101A5 /* RxCocoaObjCRuntimeError+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "RxCocoaObjCRuntimeError+Extensions.swift"; path = "RxCocoa/Common/RxCocoaObjCRuntimeError+Extensions.swift"; sourceTree = ""; }; - 25B549B23810CFC78B1CFE19F7C955A7 /* CwlCatchBadInstruction.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = CwlCatchBadInstruction.m; path = Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.m; sourceTree = ""; }; - 25F6FE9E90ADD5EFBDC9180B8712045C /* Pods-CoreDataPlatform-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-CoreDataPlatform-acknowledgements.markdown"; sourceTree = ""; }; - 263D4DB701F0F01734069546DA40E9D4 /* UIScrollView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIScrollView+Rx.swift"; path = "RxCocoa/iOS/UIScrollView+Rx.swift"; sourceTree = ""; }; - 2673F80412A2AE057049C4103503CA74 /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Extensions.swift"; path = "Platform/DispatchQueue+Extensions.swift"; sourceTree = ""; }; - 26D2E85604D64564339FC5A3BFBA4341 /* Platform.Darwin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Darwin.swift; path = Platform/Platform.Darwin.swift; sourceTree = ""; }; - 26FA3B549953A29FBCBDFE55C8AF6AF6 /* CurrentThreadScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CurrentThreadScheduler.swift; path = RxSwift/Schedulers/CurrentThreadScheduler.swift; sourceTree = ""; }; - 2738DC94C928353E0D38A5463635400B /* RLMRealmConfiguration.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMRealmConfiguration.h; path = include/RLMRealmConfiguration.h; sourceTree = ""; }; - 290E91EC5CB09B9DE450FDC4F42BB6BE /* UIPickerView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIPickerView+Rx.swift"; path = "RxCocoa/iOS/UIPickerView+Rx.swift"; sourceTree = ""; }; - 292DBC9AD470A408306D9D1B89CDFE7B /* ShareReplay1WhileConnected.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ShareReplay1WhileConnected.swift; path = RxSwift/Observables/Implementations/ShareReplay1WhileConnected.swift; sourceTree = ""; }; - 2952FBF26066799DBB635AE5EE3D6AC0 /* RLMCollection.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMCollection.h; path = include/RLMCollection.h; sourceTree = ""; }; - 2A8B7793D5448EE99219A35DA19CDD5A /* KVORepresentable+Swift.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "KVORepresentable+Swift.swift"; path = "RxCocoa/Foundation/KVORepresentable+Swift.swift"; sourceTree = ""; }; - 2AF62868E365F049ADBB266DD2924B64 /* RxCocoa.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxCocoa.xcconfig; sourceTree = ""; }; - 2B06C1ABD281629E49000C81F0B87E8D /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 2B52F189427B8938EFEBECDF3BB41E62 /* Any+Equatable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Any+Equatable.swift"; path = "RxTest/Any+Equatable.swift"; sourceTree = ""; }; - 2B6FAEB331EB95EA708A46D197CC4168 /* RxCollectionViewDataSourceType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewDataSourceType.swift; path = RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift; sourceTree = ""; }; - 2BEDB59B2607DBB61E2BF6AE6133FECB /* Bag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Bag.swift; path = Platform/DataStructures/Bag.swift; sourceTree = ""; }; - 2C4412760BEC0C7BD9C1C49E318C4339 /* object_schema.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = object_schema.cpp; path = Realm/ObjectStore/src/object_schema.cpp; sourceTree = ""; }; - 2C814A8BF612F67498C6C2BC34E6C2C4 /* Error.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Error.swift; path = RealmSwift/Error.swift; sourceTree = ""; }; - 2CBDC78B19B72BF7FD1FABD2769EEFE9 /* ScheduledItemType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScheduledItemType.swift; path = RxSwift/Schedulers/Internal/ScheduledItemType.swift; sourceTree = ""; }; - 2D028F3ACD2C5A54F2FB6F606C91431A /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 2D800547C3EBF2872C4F31A793241E5F /* String+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "String+Rx.swift"; path = "RxSwift/Extensions/String+Rx.swift"; sourceTree = ""; }; - 2DF8F0E2233CD8F6B901DFE255E381F7 /* collection_notifications.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = collection_notifications.cpp; path = Realm/ObjectStore/src/collection_notifications.cpp; sourceTree = ""; }; - 2E651B8C4B3321D6784A7A05DD142E59 /* BeIdenticalTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeIdenticalTo.swift; path = Sources/Nimble/Matchers/BeIdenticalTo.swift; sourceTree = ""; }; - 2E68EB69B86F922932702A025124117C /* Timer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Timer.swift; path = RxSwift/Observables/Implementations/Timer.swift; sourceTree = ""; }; - 2E7B7DF0DDDC3AA6C08D571EF57C4BB4 /* ObservableConvertibleType+SharedSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ObservableConvertibleType+SharedSequence.swift"; path = "RxCocoa/CocoaUnits/SharedSequence/ObservableConvertibleType+SharedSequence.swift"; sourceTree = ""; }; - 2F82EA101821C4410024CEB3AB1C46F3 /* RxTableViewDataSourceType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewDataSourceType.swift; path = RxCocoa/iOS/Protocols/RxTableViewDataSourceType.swift; sourceTree = ""; }; - 3007808C7A2C2295B71CB84F98CB8788 /* RLMSyncPermissionOffer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = RLMSyncPermissionOffer.m; path = Realm/RLMSyncPermissionOffer.m; sourceTree = ""; }; - 305D2C9A4B4DB4B1974D364EF4C229C3 /* RLMResults.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMResults.mm; path = Realm/RLMResults.mm; sourceTree = ""; }; - 30A2AD49ADBEB510AAE92AECA5A3E518 /* Pods-CleanArchitectureRxSwift-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CleanArchitectureRxSwift-resources.sh"; sourceTree = ""; }; - 3131FE971C2724941C7A8D2FA70F15E0 /* DSL.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = DSL.m; path = Sources/NimbleObjectiveC/DSL.m; sourceTree = ""; }; - 3163740E168659576828D1F52CF80F2D /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/System/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; - 316F8E7FB83F1A5CC5A658AFFB427E63 /* RxCocoa.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = RxCocoa.modulemap; sourceTree = ""; }; - 318B8F2DB12388587F176B1280DCC748 /* NMBStringify.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = NMBStringify.h; path = Sources/NimbleObjectiveC/NMBStringify.h; sourceTree = ""; }; - 31A003A034E61D0BC6AEB473579781CC /* ToArray.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ToArray.swift; path = RxSwift/Observables/Implementations/ToArray.swift; sourceTree = ""; }; - 322D2CBEC7964F87AC4A568C1C159173 /* Timeout.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Timeout.swift; path = RxSwift/Observables/Implementations/Timeout.swift; sourceTree = ""; }; - 3240D2B858783CF606E7BF315F7A6B41 /* Pods_CoreDataPlatformTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_CoreDataPlatformTests.framework; path = "Pods-CoreDataPlatformTests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - 32BCBA134D69CD39AE23D5A005F035E2 /* RLMObjectBase.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMObjectBase.mm; path = Realm/RLMObjectBase.mm; sourceTree = ""; }; - 3350808D8DA58BD08215D753B72B13CC /* RxTest.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = RxTest.modulemap; sourceTree = ""; }; - 347E05CBC887B0FDE925DD40E560A429 /* schema.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = schema.cpp; path = Realm/ObjectStore/src/schema.cpp; sourceTree = ""; }; - 355C96D7E6DA49624176F800F4276141 /* ContainElementSatisfying.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ContainElementSatisfying.swift; path = Sources/Nimble/Matchers/ContainElementSatisfying.swift; sourceTree = ""; }; - 3577AA9372DD24B3C3606CB2299856DC /* transact_log_handler.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = transact_log_handler.cpp; path = Realm/ObjectStore/src/impl/transact_log_handler.cpp; sourceTree = ""; }; - 35D129172F068D27EA24649C6EC33640 /* Variable+SharedSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Variable+SharedSequence.swift"; path = "RxCocoa/CocoaUnits/SharedSequence/Variable+SharedSequence.swift"; sourceTree = ""; }; - 36028945D70850B4DA139519DA759A8C /* Pods-CleanArchitectureRxSwift-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CleanArchitectureRxSwift-frameworks.sh"; sourceTree = ""; }; - 365A23A9D17A8ACEA664210B80849378 /* weak_realm_notifier.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = weak_realm_notifier.cpp; path = Realm/ObjectStore/src/impl/weak_realm_notifier.cpp; sourceTree = ""; }; - 36867BC95C92E2B998AC9B60B3531E00 /* RLMPlatform.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMPlatform.h; path = include/RLMPlatform.h; sourceTree = ""; }; - 369A442F8D4A7AC7D1EF096638AF9426 /* SwitchIfEmpty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwitchIfEmpty.swift; path = RxSwift/Observables/Implementations/SwitchIfEmpty.swift; sourceTree = ""; }; - 37D650E2738F6CA0AEE9538D2212801A /* RxCollectionViewDataSourceProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewDataSourceProxy.swift; path = RxCocoa/iOS/Proxies/RxCollectionViewDataSourceProxy.swift; sourceTree = ""; }; - 38039087DC23815CCBF407685CADBECC /* RLMObjectSchema_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMObjectSchema_Private.h; path = include/RLMObjectSchema_Private.h; sourceTree = ""; }; - 386DBF2AF0D86DCC5DE2C9DD0ECC95CB /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 3995157AED191D50B373A29AD950FF44 /* PublishSubject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PublishSubject.swift; path = RxSwift/Subjects/PublishSubject.swift; sourceTree = ""; }; - 39A3F66ED64B7DBFE07F75C4E93FBCEC /* RLMObservation.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMObservation.mm; path = Realm/RLMObservation.mm; sourceTree = ""; }; - 3A9AF09A2BEAEBA835B01672295C3993 /* Equal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Equal.swift; path = Sources/Nimble/Matchers/Equal.swift; sourceTree = ""; }; - 3B781C46CC5C0FC0A551DA04BFF6D6A3 /* RxPickerViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxPickerViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxPickerViewDelegateProxy.swift; sourceTree = ""; }; - 3BCE4B0CAE4354903CA6579B703AB088 /* AnonymousObserver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnonymousObserver.swift; path = RxSwift/Observers/AnonymousObserver.swift; sourceTree = ""; }; - 3BFA5EF6BB4E0E297CB404369B9818EB /* UIImageView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIImageView+Rx.swift"; path = "RxCocoa/iOS/UIImageView+Rx.swift"; sourceTree = ""; }; - 3CF09B4FB5D88A264AA6DBE5F17F87FB /* Queue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Queue.swift; path = Platform/DataStructures/Queue.swift; sourceTree = ""; }; - 3DBCFE9863A0A6B6210470BB4D337978 /* Realm.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Realm.xcconfig; sourceTree = ""; }; - 3E0AFF0058AE0D7DBDE696D463411122 /* RxTest.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RxTest.framework; path = RxTest.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 3E7EA59D83453AA5D9B1CA183A6A322E /* Pods-CoreDataPlatform-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-CoreDataPlatform-acknowledgements.plist"; sourceTree = ""; }; - 3E92742A4FDFA16695FA81A88278F08D /* InfiniteSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InfiniteSequence.swift; path = Platform/DataStructures/InfiniteSequence.swift; sourceTree = ""; }; - 3F1011E3BF49A2B2F987B00DB32F3965 /* TailRecursiveSink.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TailRecursiveSink.swift; path = RxSwift/Observers/TailRecursiveSink.swift; sourceTree = ""; }; - 3F10AF5A825229B36E1702D704B44CCC /* Do.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Do.swift; path = RxSwift/Observables/Implementations/Do.swift; sourceTree = ""; }; - 3FF39F3BD1D678CA9BACAEEFD39DCB8F /* UISearchController+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UISearchController+Rx.swift"; path = "RxCocoa/iOS/UISearchController+Rx.swift"; sourceTree = ""; }; - 4004319B47C10CDA4EF68FAEFE680BF7 /* Variable+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Variable+Driver.swift"; path = "RxCocoa/CocoaUnits/Driver/Variable+Driver.swift"; sourceTree = ""; }; - 401D1E82C19C3B6C274E1C789AE35EAB /* Pods-DomainTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-DomainTests-acknowledgements.markdown"; sourceTree = ""; }; - 40A91CAD49F801AEF2040179CF6FB9D0 /* SharedSequence+Operators.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SharedSequence+Operators.swift"; path = "RxCocoa/CocoaUnits/SharedSequence/SharedSequence+Operators.swift"; sourceTree = ""; }; - 41759AABE84C08A37113D6E35E9A53EE /* RLMObjectStore.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMObjectStore.mm; path = Realm/RLMObjectStore.mm; sourceTree = ""; }; - 41A44C3D509431019F12AE5A7B8A6A83 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk/System/Library/Frameworks/CoreData.framework; sourceTree = DEVELOPER_DIR; }; - 41A4EF93D766224EFFDA68623C54A7AF /* RLMSyncPermissionOfferResponse_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncPermissionOfferResponse_Private.h; path = include/RLMSyncPermissionOfferResponse_Private.h; sourceTree = ""; }; - 423080DF5659C248A1ADF36D9ACF9BA9 /* RealmObserver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RealmObserver.swift; path = Pod/Classes/RealmObserver.swift; sourceTree = ""; }; - 428E0EA94CAF38B592D33171034CAF3E /* Results.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Results.swift; path = RealmSwift/Results.swift; sourceTree = ""; }; - 4292DCD72C6D25F38487976F95E8A1DE /* Observable+Aggregate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Observable+Aggregate.swift"; path = "RxSwift/Observables/Observable+Aggregate.swift"; sourceTree = ""; }; - 42B5181B66BB6301D8A587B7054964E6 /* Pods-RealmPlatformTests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-RealmPlatformTests-resources.sh"; sourceTree = ""; }; - 42FE02AEBE305BC7FAE845A81D26873E /* Pods-CleanArchitectureRxSwiftTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CleanArchitectureRxSwiftTests.debug.xcconfig"; sourceTree = ""; }; - 437748C82613E2EE8BE3BDDBB9CD429D /* BeAnInstanceOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeAnInstanceOf.swift; path = Sources/Nimble/Matchers/BeAnInstanceOf.swift; sourceTree = ""; }; - 43BCABD2C41BE5F24FBFA0F5A79F790B /* RxBlocking.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = RxBlocking.modulemap; sourceTree = ""; }; - 443F33B06112DC634060BEA1738DF92D /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 449223001FD790A403F78B3E34186EF5 /* UIGestureRecognizer+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIGestureRecognizer+Rx.swift"; path = "RxCocoa/iOS/UIGestureRecognizer+Rx.swift"; sourceTree = ""; }; - 44C2C85A52F1FAE6B3B17CEB044A4AB7 /* Bag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Bag.swift; path = Platform/DataStructures/Bag.swift; sourceTree = ""; }; - 453FAF80D4E039A7FE62AFD5A8240609 /* UIActivityIndicatorView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIActivityIndicatorView+Rx.swift"; path = "RxCocoa/iOS/UIActivityIndicatorView+Rx.swift"; sourceTree = ""; }; - 456C4D0CC020D0F5B34472CED5436D76 /* Pods-RealmPlatformTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-RealmPlatformTests-dummy.m"; sourceTree = ""; }; - 45E01FCCB15FE2B030460E029DE6FE60 /* Pods-DomainTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-DomainTests-acknowledgements.plist"; sourceTree = ""; }; - 46617FD4B1B797669A2C1114600DD34E /* ConcurrentMainScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConcurrentMainScheduler.swift; path = RxSwift/Schedulers/ConcurrentMainScheduler.swift; sourceTree = ""; }; - 46B11D9ED9998049254C57399B0671D3 /* DelegateProxyType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DelegateProxyType.swift; path = RxCocoa/Common/DelegateProxyType.swift; sourceTree = ""; }; - 474822C52CBE972860E8DC255086CAC6 /* SingleAsync.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SingleAsync.swift; path = RxSwift/Observables/Implementations/SingleAsync.swift; sourceTree = ""; }; - 475FD510C5E88D7756730D9BE72F0434 /* RLMArrayLinkView.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMArrayLinkView.mm; path = Realm/RLMArrayLinkView.mm; sourceTree = ""; }; - 47C68F048DCEF29C6EE5EED2C5538BC8 /* Pods-RealmPlatform-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-RealmPlatform-acknowledgements.markdown"; sourceTree = ""; }; - 47D75A8BFFF4212F4969780ECF3AEE1B /* WithLatestFrom.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = WithLatestFrom.swift; path = RxSwift/Observables/Implementations/WithLatestFrom.swift; sourceTree = ""; }; - 487C60B08B1A939CB47EC4D53043DB9A /* Pods-CleanArchitectureRxSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-CleanArchitectureRxSwift.modulemap"; sourceTree = ""; }; - 48E4D2FF3238DCF2F4E7CF0EFDF6A0CC /* Concat.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Concat.swift; path = RxSwift/Observables/Implementations/Concat.swift; sourceTree = ""; }; - 48FB25AD5881C46160F03C3B8FC705DC /* RxSwift.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxSwift.xcconfig; sourceTree = ""; }; - 490B2302297DFB82C7D87440BB0F2024 /* Map.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Map.swift; path = RxSwift/Observables/Implementations/Map.swift; sourceTree = ""; }; - 49A565AF840A908AD4DF2C8FF88266D6 /* Queue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Queue.swift; path = Platform/DataStructures/Queue.swift; sourceTree = ""; }; - 4A4EC47B6EE359C279B465EA06249E65 /* Buffer.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Buffer.swift; path = RxSwift/Observables/Implementations/Buffer.swift; sourceTree = ""; }; - 4A60855035ED5F2D12CDC72AEF2946C7 /* RxTest-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxTest-prefix.pch"; sourceTree = ""; }; - 4A78EA70789CFED1187666227105C133 /* NotificationCenter+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NotificationCenter+Rx.swift"; path = "RxCocoa/Foundation/NotificationCenter+Rx.swift"; sourceTree = ""; }; - 4AA2D939D8E8D6AE9DA9F8D7B271D82D /* RxSearchBarDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxSearchBarDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxSearchBarDelegateProxy.swift; sourceTree = ""; }; - 4ACEDAB72DD6F89B6EF216AA2E234CFD /* Queue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Queue.swift; path = Platform/DataStructures/Queue.swift; sourceTree = ""; }; - 4B0E7614E593D71E05DE51065E273B00 /* RLMSyncSession.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncSession.h; path = include/RLMSyncSession.h; sourceTree = ""; }; - 4B55EA40F4928799825E9C22AD36D1C1 /* TestScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TestScheduler.swift; path = RxTest/Schedulers/TestScheduler.swift; sourceTree = ""; }; - 4BA27878FE6C0B9657EAF8BCA96C71C8 /* RecursiveLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecursiveLock.swift; path = Platform/RecursiveLock.swift; sourceTree = ""; }; - 4BCE4F1C204A76349723E6450F8FB06D /* Platform.Linux.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Linux.swift; path = Platform/Platform.Linux.swift; sourceTree = ""; }; - 4C675C0A74C682A44C4E08772DA6F3B0 /* Functional.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Functional.swift; path = Sources/Nimble/Utils/Functional.swift; sourceTree = ""; }; - 4D4DF4A1A9FA96B8ACCA6E3A702F0D1C /* Pods-RealmPlatform.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-RealmPlatform.release.xcconfig"; sourceTree = ""; }; - 4D4F870392098A336DBBE73DB36D7565 /* Stringers.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Stringers.swift; path = Sources/Nimble/Utils/Stringers.swift; sourceTree = ""; }; - 4D94E41581AAC3FC4854F275905059BA /* Merge.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Merge.swift; path = RxSwift/Observables/Implementations/Merge.swift; sourceTree = ""; }; - 4DFF991D5D6EC73F086137666782689A /* MainScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MainScheduler.swift; path = RxSwift/Schedulers/MainScheduler.swift; sourceTree = ""; }; - 4E9F674E5D41EFBB3474C816A789F644 /* UIControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIControl+Rx.swift"; path = "RxCocoa/iOS/UIControl+Rx.swift"; sourceTree = ""; }; - 4ED17F31DFDE3B6E0C33C6629E6430F0 /* Predicate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Predicate.swift; path = QueryKit/Predicate.swift; sourceTree = ""; }; - 4F470FA82B84E31947213CEE002EE612 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 50C74801C762073F7DB0CDCD76B6E3FE /* BeCloseTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeCloseTo.swift; path = Sources/Nimble/Matchers/BeCloseTo.swift; sourceTree = ""; }; - 51E80CDB97E97899BD0038B78302ADB3 /* RLMListBase.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMListBase.h; path = include/RLMListBase.h; sourceTree = ""; }; - 5239B3D651CB232F32021273593EDD83 /* BeGreaterThan.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeGreaterThan.swift; path = Sources/Nimble/Matchers/BeGreaterThan.swift; sourceTree = ""; }; - 525BBAE5E1D5FBF64B9826C4092AEDF1 /* MatcherProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MatcherProtocols.swift; path = Sources/Nimble/Matchers/MatcherProtocols.swift; sourceTree = ""; }; - 526D107DEADDC8A7A1884D7D2169343B /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 53AAF25454CBD69509B3B72C6CB097E5 /* RLMAuthResponseModel.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = RLMAuthResponseModel.m; path = Realm/RLMAuthResponseModel.m; sourceTree = ""; }; - 53CB3018CC908AE0B39B5FAD841C02E4 /* RealmSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 53CC2CBA3B814AE063CA4BA09355A160 /* Cancelable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Cancelable.swift; path = RxSwift/Cancelable.swift; sourceTree = ""; }; - 53D068AA6C7568A79DB34061E4DA3E5B /* List.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = List.swift; path = RealmSwift/List.swift; sourceTree = ""; }; - 53E45728C9B84C40AB189F1F078A6367 /* Pods_CleanArchitectureRxSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_CleanArchitectureRxSwift.framework; path = "Pods-CleanArchitectureRxSwift.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - 540BBF4DB174D011B42C5A7CD928749E /* Disposables.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Disposables.swift; path = RxSwift/Disposables/Disposables.swift; sourceTree = ""; }; - 54168AB68346D9C62335D17484B6BD5B /* RLMTokenModels.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = RLMTokenModels.m; path = Realm/RLMTokenModels.m; sourceTree = ""; }; - 55058D00734EF79A01FD662D16CA5CEA /* RLMCollection.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMCollection.mm; path = Realm/RLMCollection.mm; sourceTree = ""; }; - 5513B8FA21F53EA856639800CCDEDB4F /* NimbleXCTestHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NimbleXCTestHandler.swift; path = Sources/Nimble/Adapters/NimbleXCTestHandler.swift; sourceTree = ""; }; - 5599270D0CDAB890664985587BCBA77B /* Scan.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Scan.swift; path = RxSwift/Observables/Implementations/Scan.swift; sourceTree = ""; }; - 56C8638CE774B8A8C12676C28219318C /* Pods-RealmPlatform-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-RealmPlatform-dummy.m"; sourceTree = ""; }; - 58875D4B2FB45B2616D2F03A74D90AB5 /* RecursiveScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecursiveScheduler.swift; path = RxSwift/Schedulers/RecursiveScheduler.swift; sourceTree = ""; }; - 58BCF5F062C8E6C62F884D1209C368A0 /* RxSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RxSwift.framework; path = RxSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 58C066AD56238C1D6F01C12799C6BA49 /* ShareReplay1.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ShareReplay1.swift; path = RxSwift/Observables/Implementations/ShareReplay1.swift; sourceTree = ""; }; - 58D838E0C989E43553DA5E09B9FF5750 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 5976406626019A4510709DEC0D775315 /* DistinctUntilChanged.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DistinctUntilChanged.swift; path = RxSwift/Observables/Implementations/DistinctUntilChanged.swift; sourceTree = ""; }; - 59F8320AA898ED121BDECB3666317FA7 /* AllPass.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AllPass.swift; path = Sources/Nimble/Matchers/AllPass.swift; sourceTree = ""; }; - 5AAB6D50DAC127911F2AE131727672EE /* _RXObjCRuntime.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RXObjCRuntime.h; path = RxCocoa/Runtime/include/_RXObjCRuntime.h; sourceTree = ""; }; - 5AB78650825C442F4DB5617DF9A60D6D /* AnonymousInvocable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnonymousInvocable.swift; path = RxSwift/Schedulers/Internal/AnonymousInvocable.swift; sourceTree = ""; }; - 5B16EF6020F24C00DA5420E8B89BE1E8 /* ConcurrentDispatchQueueScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConcurrentDispatchQueueScheduler.swift; path = RxSwift/Schedulers/ConcurrentDispatchQueueScheduler.swift; sourceTree = ""; }; - 5BACD7D12DBE83767BEB0ECD5EAC5610 /* Take.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Take.swift; path = RxSwift/Observables/Implementations/Take.swift; sourceTree = ""; }; - 5C863F1B3DEDA62678903E6864DB63F2 /* SharedSequence+Operators+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SharedSequence+Operators+arity.swift"; path = "RxCocoa/CocoaUnits/SharedSequence/SharedSequence+Operators+arity.swift"; sourceTree = ""; }; - 5CC1DBAEAA8F292B0AC6B46152333850 /* QueryKit.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = QueryKit.xcconfig; sourceTree = ""; }; - 5D004E53E1F05AD0B9634080BFE4E507 /* SatisfyAnyOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SatisfyAnyOf.swift; path = Sources/Nimble/Matchers/SatisfyAnyOf.swift; sourceTree = ""; }; - 5DB873EE8F7C5FD34C4C6578A1072B9F /* KVORepresentable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KVORepresentable.swift; path = RxCocoa/Foundation/KVORepresentable.swift; sourceTree = ""; }; - 5F2BA74199972EA19E73ECDD991CE244 /* Pods-CleanArchitectureRxSwift.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CleanArchitectureRxSwift.debug.xcconfig"; sourceTree = ""; }; - 5F3462BE4A577BA487B2A9108E90F763 /* RLMResults.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMResults.h; path = include/RLMResults.h; sourceTree = ""; }; - 5FC1312795717FDCEFC84ADD8B8E0A2C /* PriorityQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PriorityQueue.swift; path = Platform/DataStructures/PriorityQueue.swift; sourceTree = ""; }; - 6000C7FD72123C0DF8EC0819EF0F0D2F /* list_notifier.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = list_notifier.cpp; path = Realm/ObjectStore/src/impl/list_notifier.cpp; sourceTree = ""; }; - 60282D96FD06BDAC343AF6E6E86F8673 /* mach_excServer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = mach_excServer.h; path = Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/mach_excServer.h; sourceTree = ""; }; - 6031907F5FB40AC1819F8F4D5DD23CB8 /* RLMSyncUtil_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncUtil_Private.h; path = include/RLMSyncUtil_Private.h; sourceTree = ""; }; - 6065AA383756BA1BF1C085CEB4F0E82E /* Platform.Darwin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Darwin.swift; path = Platform/Platform.Darwin.swift; sourceTree = ""; }; - 60E0AEFD6A0696202E1127E8C6189CD6 /* RLMSyncManager_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncManager_Private.h; path = include/RLMSyncManager_Private.h; sourceTree = ""; }; - 60F4DA3E272522E6F726267F07AC2F68 /* RxSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = RxSwift.modulemap; sourceTree = ""; }; - 60FF3B71AC7101C80B214BD79D4CA436 /* Pods_DomainTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_DomainTests.framework; path = "Pods-DomainTests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - 61030C41963A862333D5C9379AA0CD4E /* QueryKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = QueryKit.framework; path = QueryKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 617F97FAC54C3C016E9BD5962051E6AA /* ScheduledDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScheduledDisposable.swift; path = RxSwift/Disposables/ScheduledDisposable.swift; sourceTree = ""; }; - 618E7A71AADE30E6782BF2984DB54E15 /* StartWith.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StartWith.swift; path = RxSwift/Observables/Implementations/StartWith.swift; sourceTree = ""; }; - 61C9F8D486A8FA5BF2BF5FAAD0A86557 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 61D417F6E7B599D4140BF59F1A7C0ED4 /* Pods-CleanArchitectureRxSwift-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-CleanArchitectureRxSwift-acknowledgements.plist"; sourceTree = ""; }; - 61F184C1814FC935FE344475AD58E920 /* Pods-CoreDataPlatformTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-CoreDataPlatformTests.modulemap"; sourceTree = ""; }; - 620CFD2A642307BF12177D65F4747CB0 /* RxMutableBox.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxMutableBox.swift; path = RxSwift/RxMutableBox.swift; sourceTree = ""; }; - 6228AD269FC9D2FD2CBFA0F7BCE4FD82 /* Pods-Domain-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Domain-acknowledgements.markdown"; sourceTree = ""; }; - 63117D92D9C1C46672E8C21CDEA8A6CA /* ObserveOn.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObserveOn.swift; path = RxSwift/Observables/Implementations/ObserveOn.swift; sourceTree = ""; }; - 63A5B8694F48D714670D67A575D03C8B /* Pods-RealmPlatformTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-RealmPlatformTests.modulemap"; sourceTree = ""; }; - 644DE3C0D63D9FE3B9AE49F99A77086C /* Pods-CleanArchitectureRxSwiftTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CleanArchitectureRxSwiftTests.release.xcconfig"; sourceTree = ""; }; - 647B2D7490F994843E8AF357DA2D339D /* Reactive.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Reactive.swift; path = RxSwift/Reactive.swift; sourceTree = ""; }; - 64874678E2E994CD7DABE98B323BDB65 /* RealmSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = RealmSwift.modulemap; sourceTree = ""; }; - 651D0FCCF49CF22AF21FF5640CF0A54D /* Pods-Domain-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Domain-dummy.m"; sourceTree = ""; }; - 659BF5AFED33E42956343E8559221A17 /* SchedulerServices+Emulation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "SchedulerServices+Emulation.swift"; path = "RxSwift/Schedulers/SchedulerServices+Emulation.swift"; sourceTree = ""; }; - 65E03150924581C5CDF3FF73CEDD4C44 /* RLMSyncErrorResponseModel.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = RLMSyncErrorResponseModel.m; path = Realm/RLMSyncErrorResponseModel.m; sourceTree = ""; }; - 65F6A58026C6EED2818FCE1A270C466C /* Filter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Filter.swift; path = RxSwift/Observables/Implementations/Filter.swift; sourceTree = ""; }; - 669B841F9EC4C2581BE126E5A666B8D4 /* Pods-CleanArchitectureRxSwiftTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CleanArchitectureRxSwiftTests-frameworks.sh"; sourceTree = ""; }; - 66F960C5CB35AA50C12D2CF398D2E7C6 /* RefCountDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RefCountDisposable.swift; path = RxSwift/Disposables/RefCountDisposable.swift; sourceTree = ""; }; - 67115DA69219E676AA2E904D1BFB0425 /* RxCocoa.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RxCocoa.framework; path = RxCocoa.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 67B67D32CD6BA52879F9362A323F74EE /* RLMSyncCredentials.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = RLMSyncCredentials.m; path = Realm/RLMSyncCredentials.m; sourceTree = ""; }; - 680F8C82FE30FC925A6F0EBA92CC93A6 /* BeAKindOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeAKindOf.swift; path = Sources/Nimble/Matchers/BeAKindOf.swift; sourceTree = ""; }; - 68118C2B1163EF93144146168FBCF4C0 /* RLMConstants.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMConstants.h; path = include/RLMConstants.h; sourceTree = ""; }; - 68436A929FC24C5B08B4410FF0F3FE4E /* SchedulerType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SchedulerType.swift; path = RxSwift/SchedulerType.swift; sourceTree = ""; }; - 68B808DD1239D92B2CD72AA1D534FE02 /* DispatchQueueConfiguration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DispatchQueueConfiguration.swift; path = RxSwift/Schedulers/Internal/DispatchQueueConfiguration.swift; sourceTree = ""; }; - 68EAD1FFD6003414DAD602C06B759DB8 /* Expectation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expectation.swift; path = Sources/Nimble/Expectation.swift; sourceTree = ""; }; - 69179C45B2DE5D08778AC6669F98A187 /* AnonymousObservable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnonymousObservable.swift; path = RxSwift/Observables/Implementations/AnonymousObservable.swift; sourceTree = ""; }; - 6A70BC8106A92C9B6BCD22E56083E124 /* Pods-CleanArchitectureRxSwiftTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CleanArchitectureRxSwiftTests-dummy.m"; sourceTree = ""; }; - 6A9222DCDF1EAEA433A8C04E7FB723E6 /* NMBExceptionCapture.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = NMBExceptionCapture.h; path = Sources/NimbleObjectiveC/NMBExceptionCapture.h; sourceTree = ""; }; - 6ABACBA2C9D315DC47A49C74A8B7C2A4 /* RLMThreadSafeReference.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMThreadSafeReference.h; path = include/RLMThreadSafeReference.h; sourceTree = ""; }; - 6B536283BDC4C41292388887CD7B37AA /* RealmCollection.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RealmCollection.swift; path = RealmSwift/RealmCollection.swift; sourceTree = ""; }; - 6BB3A3210608688670C20F8B7E8D0E2C /* DelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DelegateProxy.swift; path = RxCocoa/Common/DelegateProxy.swift; sourceTree = ""; }; - 6BD8D45A8BFC53034614C8ED73F27508 /* BlockingObservable+Operators.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "BlockingObservable+Operators.swift"; path = "RxBlocking/BlockingObservable+Operators.swift"; sourceTree = ""; }; - 6C126DC815AA11F53B7102B2291C9C0B /* SubjectType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SubjectType.swift; path = RxSwift/Subjects/SubjectType.swift; sourceTree = ""; }; - 6C24D5484E459E8A613CE9978E6A45D5 /* Pods-RealmPlatform-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-RealmPlatform-umbrella.h"; sourceTree = ""; }; - 6C2F88B8545B66CBC3BEC7250E684A54 /* BinaryDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BinaryDisposable.swift; path = RxSwift/Disposables/BinaryDisposable.swift; sourceTree = ""; }; - 6CAE3B5E6A9B5CB5DA3D2E7C16549BC9 /* SectionedViewDataSourceType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SectionedViewDataSourceType.swift; path = RxCocoa/Common/SectionedViewDataSourceType.swift; sourceTree = ""; }; - 6D2238DF1C631E9687D1D0067F3A0943 /* RLMSyncPermissionChange.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = RLMSyncPermissionChange.m; path = Realm/RLMSyncPermissionChange.m; sourceTree = ""; }; - 6D61230AB12E85F7216633A581A8247F /* RxTest.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxTest.xcconfig; sourceTree = ""; }; - 6E2FA9D13239697489B913581CCD0C56 /* HistoricalScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HistoricalScheduler.swift; path = RxSwift/Schedulers/HistoricalScheduler.swift; sourceTree = ""; }; - 6E33742CD0E675E708288D4EB15A67EE /* Platform.Darwin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Darwin.swift; path = Platform/Platform.Darwin.swift; sourceTree = ""; }; - 6E4364B3BE46946A20F3237CDDBD3056 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 6EA742BECA70255895A57D401A3A6CCD /* TestSchedulerVirtualTimeConverter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TestSchedulerVirtualTimeConverter.swift; path = RxTest/Schedulers/TestSchedulerVirtualTimeConverter.swift; sourceTree = ""; }; - 6EBB488FCFB93905CF0BFE1F0512968C /* QuerySet.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = QuerySet.swift; path = QueryKit/QuerySet.swift; sourceTree = ""; }; - 6F2192C9597B9EFD767645E7DC17ACAD /* RxTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTarget.swift; path = RxCocoa/Common/RxTarget.swift; sourceTree = ""; }; - 6F526232925C1A53B777B03207F790D9 /* TakeLast.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TakeLast.swift; path = RxSwift/Observables/Implementations/TakeLast.swift; sourceTree = ""; }; - 70805CBC75B69AC5D24785462BACE900 /* Pods-DomainTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-DomainTests-dummy.m"; sourceTree = ""; }; - 70D181751AE81CDA7BB7711225488CA3 /* ObserverType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObserverType.swift; path = RxSwift/ObserverType.swift; sourceTree = ""; }; - 70F75573558C74C5D956088A81ABA583 /* QueryKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = QueryKit.modulemap; sourceTree = ""; }; - 724B6A7A40410FF36907A9E6A18EC799 /* Pods-DomainTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DomainTests.debug.xcconfig"; sourceTree = ""; }; - 726420484910C96B97F929C082CA0243 /* Pods-CleanArchitectureRxSwiftTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-CleanArchitectureRxSwiftTests.modulemap"; sourceTree = ""; }; - 7317476BA27FBB154B32279BBEA315E5 /* Pods-Domain-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Domain-acknowledgements.plist"; sourceTree = ""; }; - 737B50270378DB7DB4F3948B4AF9F59F /* RxRealm-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxRealm-umbrella.h"; sourceTree = ""; }; - 7395C76AB3CA60B39405806587407D4B /* DelaySubscription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DelaySubscription.swift; path = RxSwift/Observables/Implementations/DelaySubscription.swift; sourceTree = ""; }; - 73D5044680BB9382E25FDC882F516522 /* RunLoopLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RunLoopLock.swift; path = RxBlocking/RunLoopLock.swift; sourceTree = ""; }; - 73FB40DDCBAAB504D3EA21A28D77E2CE /* Catch.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Catch.swift; path = RxSwift/Observables/Implementations/Catch.swift; sourceTree = ""; }; - 74FE60E9D19651328FED8B65E315257E /* UICollectionView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UICollectionView+Rx.swift"; path = "RxCocoa/iOS/UICollectionView+Rx.swift"; sourceTree = ""; }; - 750E9F15C16D92388077575CEA7712A8 /* SubscriptionDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SubscriptionDisposable.swift; path = RxSwift/Disposables/SubscriptionDisposable.swift; sourceTree = ""; }; - 75150084CD6CFCF2F4A99BA5E7580F35 /* sync_user.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = sync_user.cpp; path = Realm/ObjectStore/src/sync/sync_user.cpp; sourceTree = ""; }; - 75327AB63E4F7E973B826E8D33D0A655 /* NMBStringify.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NMBStringify.m; path = Sources/NimbleObjectiveC/NMBStringify.m; sourceTree = ""; }; - 7538D00F21F7D591ABDA749CF6C3959B /* CompositeDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CompositeDisposable.swift; path = RxSwift/Disposables/CompositeDisposable.swift; sourceTree = ""; }; - 7598CF4B5C61DDA6CBB4D59CD0BAA801 /* RxCocoa.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RxCocoa.h; path = RxCocoa/RxCocoa.h; sourceTree = ""; }; - 75F6471591B80647ED7E7F982A70F078 /* LockOwnerType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LockOwnerType.swift; path = RxSwift/Concurrency/LockOwnerType.swift; sourceTree = ""; }; - 763EF4959E0C4B33459C3D414E0DFEEE /* _RXKVOObserver.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RXKVOObserver.m; path = RxCocoa/Runtime/_RXKVOObserver.m; sourceTree = ""; }; - 766C72882D45E69565506BFCE1205BF5 /* Pods-CoreDataPlatform-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CoreDataPlatform-dummy.m"; sourceTree = ""; }; - 7698006130BFE2C96308386024F8EE19 /* HistoricalSchedulerTimeConverter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HistoricalSchedulerTimeConverter.swift; path = RxSwift/Schedulers/HistoricalSchedulerTimeConverter.swift; sourceTree = ""; }; - 76A62E278B749564C6A15432577C6BB2 /* Switch.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Switch.swift; path = RxSwift/Observables/Implementations/Switch.swift; sourceTree = ""; }; - 76B4D0EAC3019F6520D0B460B971C10F /* AsyncMatcherWrapper.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncMatcherWrapper.swift; path = Sources/Nimble/Matchers/AsyncMatcherWrapper.swift; sourceTree = ""; }; - 76F609DEF8E2FE7A4C17AD233F295E74 /* Pods-CleanArchitectureRxSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-CleanArchitectureRxSwift-umbrella.h"; sourceTree = ""; }; - 77CC4DB011DDA939C0C72968B477901F /* XCTestObservationCenter+Register.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "XCTestObservationCenter+Register.m"; path = "Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m"; sourceTree = ""; }; - 77E60632538C3F8962F2E0432C087CAD /* Pods-CoreDataPlatformTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CoreDataPlatformTests.debug.xcconfig"; sourceTree = ""; }; - 79587E31E603FA8B4DF3FABA69304C71 /* RLMMigration_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMMigration_Private.h; path = include/RLMMigration_Private.h; sourceTree = ""; }; - 7A2EEEA2D447627757BE4857F136CC5B /* Resources.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Resources.swift; path = RxBlocking/Resources.swift; sourceTree = ""; }; - 7AE7B534F16968B523BD7E569F148363 /* RLMSyncCredentials.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncCredentials.h; path = include/RLMSyncCredentials.h; sourceTree = ""; }; - 7B3E77E11E365F562B26CE30D3CC144B /* UIBarButtonItem+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIBarButtonItem+Rx.swift"; path = "RxCocoa/iOS/UIBarButtonItem+Rx.swift"; sourceTree = ""; }; - 7C457E30ED78639FDBAD11D32F2E5D35 /* PriorityQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PriorityQueue.swift; path = Platform/DataStructures/PriorityQueue.swift; sourceTree = ""; }; - 7C9B1F72E6A71B6B7A163608E125535B /* RxBlocking-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxBlocking-umbrella.h"; sourceTree = ""; }; - 7DCDC3E80BD1902283A39F5F01A9D86E /* BeLessThanOrEqual.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLessThanOrEqual.swift; path = Sources/Nimble/Matchers/BeLessThanOrEqual.swift; sourceTree = ""; }; - 7DD58885A41DF6D92C8AC75BF36D8845 /* Pods-Domain-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Domain-resources.sh"; sourceTree = ""; }; - 7F6043C2988ECD8BBC9D2B2371E02E8A /* Realm.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Realm.swift; path = RealmSwift/Realm.swift; sourceTree = ""; }; - 807776598A55DA33235962FD69086035 /* Nimble.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Nimble.xcconfig; sourceTree = ""; }; - 8147EA764021C40A6F41AAFD1D5BD9CE /* RLMProperty.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMProperty.mm; path = Realm/RLMProperty.mm; sourceTree = ""; }; - 8228DD6D4CB3FE2917439A9502282852 /* RxCocoaRuntime.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RxCocoaRuntime.h; path = RxCocoa/Runtime/include/RxCocoaRuntime.h; sourceTree = ""; }; - 827829900FDED975E2E0C53B2EDC8A63 /* RLMSyncManager.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMSyncManager.mm; path = Realm/RLMSyncManager.mm; sourceTree = ""; }; - 82CF0AC20AA633380BB32EFCD43569A7 /* sync_session.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = sync_session.cpp; path = Realm/ObjectStore/src/sync/sync_session.cpp; sourceTree = ""; }; - 82D866DD022BC145686ED68C49589590 /* RxTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTests.swift; path = RxTest/RxTests.swift; sourceTree = ""; }; - 82E590C4034DA657F3FD05E72AD2CF09 /* UIView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIView+Rx.swift"; path = "RxCocoa/iOS/UIView+Rx.swift"; sourceTree = ""; }; - 82F60631C865A4D18BB6AC807121D734 /* SynchronizedOnType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SynchronizedOnType.swift; path = RxSwift/Concurrency/SynchronizedOnType.swift; sourceTree = ""; }; - 82FEAFA0FC4D69B31FDE29DB838B3CE7 /* Nimble-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Nimble-umbrella.h"; sourceTree = ""; }; - 83E711AC617EE79D5719C77D84568D61 /* RxTableViewDataSourceProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewDataSourceProxy.swift; path = RxCocoa/iOS/Proxies/RxTableViewDataSourceProxy.swift; sourceTree = ""; }; - 83EC45B0515EC5AA0B8BEE99D3A98DC7 /* Nimble.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Nimble.h; path = Sources/Nimble/Nimble.h; sourceTree = ""; }; - 845D0EA8611F2FB24CD712D978D6ACFA /* Platform.Linux.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Linux.swift; path = Platform/Platform.Linux.swift; sourceTree = ""; }; - 84F1C0AC877B51B7ACF21232AE9CEFB3 /* CwlCatchException.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CwlCatchException.swift; path = Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.swift; sourceTree = ""; }; - 85CABC513996516722136DD552AAAC99 /* Debounce.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Debounce.swift; path = RxSwift/Observables/Implementations/Debounce.swift; sourceTree = ""; }; - 85D3B261B046352E80E38C49E4517546 /* RLMSyncConfiguration_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncConfiguration_Private.h; path = include/RLMSyncConfiguration_Private.h; sourceTree = ""; }; - 85F7317AA13674AF45FF061C2B34AD65 /* HotObservable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HotObservable.swift; path = RxTest/HotObservable.swift; sourceTree = ""; }; - 86F75BCD0221A6D3B29AA45BD76A4FE8 /* NimbleEnvironment.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NimbleEnvironment.swift; path = Sources/Nimble/Adapters/NimbleEnvironment.swift; sourceTree = ""; }; - 8714A665CD919AF83A3D6358E2FF31CF /* Lock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Lock.swift; path = RxSwift/Concurrency/Lock.swift; sourceTree = ""; }; - 8799EAE23AC4B38F89FB70248DB44D5A /* AssertionDispatcher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AssertionDispatcher.swift; path = Sources/Nimble/Adapters/AssertionDispatcher.swift; sourceTree = ""; }; - 87A68AFF74DF578CD9C34F9CD082051C /* RLMClassInfo.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMClassInfo.mm; path = Realm/RLMClassInfo.mm; sourceTree = ""; }; - 87A84264C64C45ED2BD758C26F02FD6B /* Sink.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Sink.swift; path = RxSwift/Observables/Implementations/Sink.swift; sourceTree = ""; }; - 87FAB44ABC252FE3A6CA52CAEE54FF41 /* RecursiveLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecursiveLock.swift; path = Platform/RecursiveLock.swift; sourceTree = ""; }; - 882321445A72F8929C05DD7AEC0DC5E1 /* Pods-RealmPlatformTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-RealmPlatformTests-frameworks.sh"; sourceTree = ""; }; - 8895468BF142846DD869960F6D3AEFE9 /* BooleanDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BooleanDisposable.swift; path = RxSwift/Disposables/BooleanDisposable.swift; sourceTree = ""; }; - 8A2FDB31E4EA5A36354AD7345532825B /* RxRealm-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "RxRealm-dummy.m"; sourceTree = ""; }; - 8A66C29263F83D1690626D06AB176B1B /* Pods-RealmPlatform.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-RealmPlatform.debug.xcconfig"; sourceTree = ""; }; - 8B3D331262EB0179A93ABC9CA9BFE9E0 /* BeEmpty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeEmpty.swift; path = Sources/Nimble/Matchers/BeEmpty.swift; sourceTree = ""; }; - 8BAC6E491F8BC026534F1C45737643A5 /* RealmSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RealmSwift-prefix.pch"; sourceTree = ""; }; - 8BBB7E0B4D592B340B7627F9E7E47938 /* RxBlocking-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "RxBlocking-dummy.m"; sourceTree = ""; }; - 8BC37B11E78B44F63082BB22B6D284EF /* Event.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Event.swift; path = RxSwift/Event.swift; sourceTree = ""; }; - 8BF7DC2FDBE199EDBEBF2DAF7E1A9DF2 /* RLMSyncUtil.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMSyncUtil.mm; path = Realm/RLMSyncUtil.mm; sourceTree = ""; }; - 8C155F3210E736DC8F707C661517CA3C /* format.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = format.cpp; path = Realm/ObjectStore/src/util/format.cpp; sourceTree = ""; }; - 8C79C28717823D848E9B9A46EDC8E820 /* Platform.Darwin.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Darwin.swift; path = Platform/Platform.Darwin.swift; sourceTree = ""; }; - 8CC994EB560618D04579BC84C503DF01 /* Subscription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Subscription.swift; path = RxTest/Subscription.swift; sourceTree = ""; }; - 8CCE033306547A0E208151520F52A803 /* Pods-CleanArchitectureRxSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-CleanArchitectureRxSwift-dummy.m"; sourceTree = ""; }; - 8D149BB26C33A57D55049C3C3D440A74 /* Expression.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expression.swift; path = Sources/Nimble/Expression.swift; sourceTree = ""; }; - 8DCD9A35F302AA2A689F93A69C685B0C /* NSTextStorage+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSTextStorage+Rx.swift"; path = "RxCocoa/iOS/NSTextStorage+Rx.swift"; sourceTree = ""; }; - 8E2686CB51C73A7C37264F9AF994744A /* TakeUntil.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TakeUntil.swift; path = RxSwift/Observables/Implementations/TakeUntil.swift; sourceTree = ""; }; - 8E6BC43A1E8D721B8AC29C3C8E35EB6E /* AnyObserver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AnyObserver.swift; path = RxSwift/AnyObserver.swift; sourceTree = ""; }; - 8EA94F6951EDBCE65EE3ABA35A6E8F6E /* RLMSyncPermissionOfferResponse.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncPermissionOfferResponse.h; path = include/RLMSyncPermissionOfferResponse.h; sourceTree = ""; }; - 8ECCEFFF303418E9B3C78513C791ED99 /* ReplaySubject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ReplaySubject.swift; path = RxSwift/Subjects/ReplaySubject.swift; sourceTree = ""; }; - 8FAD1573476230902C96233E3146AE68 /* UITabBarController+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITabBarController+Rx.swift"; path = "RxCocoa/iOS/UITabBarController+Rx.swift"; sourceTree = ""; }; - 8FBCF4CCAA6BF84CCE63795808F9F12A /* VirtualTimeScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = VirtualTimeScheduler.swift; path = RxSwift/Schedulers/VirtualTimeScheduler.swift; sourceTree = ""; }; - 9142FC789F4E3E454D4CEA249BE53885 /* GroupBy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GroupBy.swift; path = RxSwift/Observables/Implementations/GroupBy.swift; sourceTree = ""; }; - 9263B3A050D8F0206EE9674A65052154 /* SwiftVersion.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwiftVersion.swift; path = RealmSwift/SwiftVersion.swift; sourceTree = ""; }; - 9272BB7EC05AAB42EAEEB81CB1674CE7 /* UISearchBar+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UISearchBar+Rx.swift"; path = "RxCocoa/iOS/UISearchBar+Rx.swift"; sourceTree = ""; }; - 92C78267D5E8A49298BCA74BC43ED918 /* RealmSwift.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RealmSwift.xcconfig; sourceTree = ""; }; - 93903E44E4D224E95DA35509ABB84766 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - 956C6ED2267E772D5C6BA90A5939066B /* DisposeBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DisposeBase.swift; path = RxSwift/Disposables/DisposeBase.swift; sourceTree = ""; }; - 9589E038DA4969D52DF2D43FDD685A93 /* InvocableScheduledItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InvocableScheduledItem.swift; path = RxSwift/Schedulers/Internal/InvocableScheduledItem.swift; sourceTree = ""; }; - 95FD775142302578A706350EF902E19D /* DSL+Wait.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DSL+Wait.swift"; path = "Sources/Nimble/DSL+Wait.swift"; sourceTree = ""; }; - 9604E66751F69896AD323181D092CAF3 /* RLMObjectSchema.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMObjectSchema.mm; path = Realm/RLMObjectSchema.mm; sourceTree = ""; }; - 9627E7DD73D5851D73ABDA76F10A27F2 /* UITextField+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITextField+Rx.swift"; path = "RxCocoa/iOS/UITextField+Rx.swift"; sourceTree = ""; }; - 96BBA5CDAC52B30D246E512DD3D26532 /* RxTest-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxTest-umbrella.h"; sourceTree = ""; }; - 96D0A3DC63B077FB0B3093A31B3F420C /* DispatchQueue+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Extensions.swift"; path = "Platform/DispatchQueue+Extensions.swift"; sourceTree = ""; }; - 96FABFEB04483364161939DB70C05606 /* RxCocoa-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxCocoa-prefix.pch"; sourceTree = ""; }; - 978F38FE83D29E7EF9C4E95C1BADEB6C /* NMBObjCMatcher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NMBObjCMatcher.swift; path = Sources/Nimble/Adapters/NMBObjCMatcher.swift; sourceTree = ""; }; - 97BF34CE2B91BE3374D79FBD1AE7EFE8 /* Pods-DomainTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-DomainTests.release.xcconfig"; sourceTree = ""; }; - 9949BF61505A3724B810B5CFFEE9CED4 /* RLMObject.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMObject.mm; path = Realm/RLMObject.mm; sourceTree = ""; }; - 995BA9212A352337D7E710CE8C1FAA1E /* RealmSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RealmSwift.framework; path = RealmSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 995BDF2455E81580FD2A095156AACBB9 /* Pods-RealmPlatformTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-RealmPlatformTests.debug.xcconfig"; sourceTree = ""; }; - 996D4E51556FD2FC3D61A7136E60ABCD /* RLMOptionalBase.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMOptionalBase.mm; path = Realm/RLMOptionalBase.mm; sourceTree = ""; }; - 99FF802CC6AA32414FF845B4E422D063 /* NSLayoutConstraint+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSLayoutConstraint+Rx.swift"; path = "RxCocoa/Common/NSLayoutConstraint+Rx.swift"; sourceTree = ""; }; - 9A87A2EA0FB26333CDE81BFD3B6AD4C7 /* SkipUntil.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SkipUntil.swift; path = RxSwift/Observables/Implementations/SkipUntil.swift; sourceTree = ""; }; - 9AF941F3C8CC0E7B773DB318A6D2A2CB /* SortDescriptor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SortDescriptor.swift; path = QueryKit/SortDescriptor.swift; sourceTree = ""; }; - 9B9D9E1ED1DE4010A0AFA0DC9A6AAFFE /* PriorityQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PriorityQueue.swift; path = Platform/DataStructures/PriorityQueue.swift; sourceTree = ""; }; - 9B9F9F8D327301B5D0920362F19116D9 /* UIBindingObserver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = UIBindingObserver.swift; path = RxCocoa/CocoaUnits/UIBindingObserver.swift; sourceTree = ""; }; - 9BFE207BAB34C549F199FDFFB6798281 /* RxCocoa-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "RxCocoa-dummy.m"; sourceTree = ""; }; - 9C3D32B58B6052BC084EEA9DEE3384E5 /* RxTableViewReactiveArrayDataSource.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewReactiveArrayDataSource.swift; path = RxCocoa/iOS/DataSources/RxTableViewReactiveArrayDataSource.swift; sourceTree = ""; }; - 9CDFB51C334E9637BB0AAAC5E7055307 /* UITableView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITableView+Rx.swift"; path = "RxCocoa/iOS/UITableView+Rx.swift"; sourceTree = ""; }; - 9D40B8EB25FE62AA6D6D3D2D48BDD0D6 /* shared_realm.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = shared_realm.cpp; path = Realm/ObjectStore/src/shared_realm.cpp; sourceTree = ""; }; - 9D48431617F5E01019D3D46F2F5FC2F1 /* RxTextViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTextViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTextViewDelegateProxy.swift; sourceTree = ""; }; - 9DA27DE4949B925372DA7B65665C783B /* Realm.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = Realm.modulemap; sourceTree = ""; }; - 9DAECC01EADF40818647F8793CF4BBF7 /* RLMArray_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMArray_Private.h; path = include/RLMArray_Private.h; sourceTree = ""; }; - 9DBB9B657E9422DE4900989C0DAD462A /* ImmediateScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImmediateScheduler.swift; path = RxSwift/Schedulers/ImmediateScheduler.swift; sourceTree = ""; }; - 9E50327A23EF351887CC4AD8EE17D139 /* RxBlocking-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxBlocking-prefix.pch"; sourceTree = ""; }; - 9E9240D8A27CB9ECF337F608D036AEB8 /* object_notifier.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = object_notifier.cpp; path = Realm/ObjectStore/src/impl/object_notifier.cpp; sourceTree = ""; }; - 9ED1B6EBA5C332C3BAEBC7AB6BA83D48 /* Pods-DomainTests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-DomainTests-umbrella.h"; sourceTree = ""; }; - 9EE14CD66DEAC50B04FB05EC9EE4D7EE /* RLMAccessor.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMAccessor.h; path = include/RLMAccessor.h; sourceTree = ""; }; - 9FC9E366D9C32EAEDFB1AE49EB284463 /* RxRealm.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxRealm.xcconfig; sourceTree = ""; }; - 9FE87AF2EF9F402C90C5082447989B6E /* AsyncLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncLock.swift; path = RxSwift/Concurrency/AsyncLock.swift; sourceTree = ""; }; - A00C7D904474DBCC0A4DCE1F5442CDAF /* ObservableConvertibleType+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ObservableConvertibleType+Driver.swift"; path = "RxCocoa/CocoaUnits/Driver/ObservableConvertibleType+Driver.swift"; sourceTree = ""; }; - A10AB4B5883276D772A29D431AA68414 /* CwlDarwinDefinitions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CwlDarwinDefinitions.swift; path = Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlDarwinDefinitions.swift; sourceTree = ""; }; - A1157481D2F368CAF1F9B68ACA0572CC /* Expression.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expression.swift; path = QueryKit/Expression.swift; sourceTree = ""; }; - A1653BBD0DE3ED52FDF86C9C59A70B12 /* Pods-CoreDataPlatform.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-CoreDataPlatform.modulemap"; sourceTree = ""; }; - A1C84A6BF14AB41A9CD563155675C452 /* RLMRealmConfiguration+Sync.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "RLMRealmConfiguration+Sync.h"; path = "include/RLMRealmConfiguration+Sync.h"; sourceTree = ""; }; - A313D72946CF65A31A5271AF35621830 /* KVORepresentable+CoreGraphics.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "KVORepresentable+CoreGraphics.swift"; path = "RxCocoa/Foundation/KVORepresentable+CoreGraphics.swift"; sourceTree = ""; }; - A326BD661EDA3D826886B4A226F02BFB /* Amb.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Amb.swift; path = RxSwift/Observables/Implementations/Amb.swift; sourceTree = ""; }; - A34E5639FD366712F3924C743CB50378 /* Error.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Error.swift; path = RxSwift/Observables/Implementations/Error.swift; sourceTree = ""; }; - A3B9206E6EAB97E39A1B218C5DC6E21D /* NSError+RLMSync.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSError+RLMSync.h"; path = "include/NSError+RLMSync.h"; sourceTree = ""; }; - A3D7B0334A9F9928FF52C6050967CD30 /* results_notifier.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = results_notifier.cpp; path = Realm/ObjectStore/src/impl/results_notifier.cpp; sourceTree = ""; }; - A3E73C12117ABCB9685A1573BB44D10A /* TestableObserver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TestableObserver.swift; path = RxTest/TestableObserver.swift; sourceTree = ""; }; - A4456366A2BF3546CF5EBB700106AC35 /* Observable+Single.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Observable+Single.swift"; path = "RxSwift/Observables/Observable+Single.swift"; sourceTree = ""; }; - A49165FBF66400DC663F3483248F40E0 /* Pods-CoreDataPlatformTests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CoreDataPlatformTests-frameworks.sh"; sourceTree = ""; }; - A4D7EAC9D7DDECFF26379A565A656DC8 /* UIStepper+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIStepper+Rx.swift"; path = "RxCocoa/iOS/UIStepper+Rx.swift"; sourceTree = ""; }; - A5707648E42DDFCC4B19502E48E2780E /* Sequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Sequence.swift; path = RxSwift/Observables/Implementations/Sequence.swift; sourceTree = ""; }; - A5B5A413CCB125AE95B36D10B52C498E /* BeginWith.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeginWith.swift; path = Sources/Nimble/Matchers/BeginWith.swift; sourceTree = ""; }; - A5D0298759E5DFA638C73ACB659BA696 /* Nimble-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Nimble-prefix.pch"; sourceTree = ""; }; - A6587BBA0993061ACD6A225501F6C907 /* RLMArray.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMArray.h; path = include/RLMArray.h; sourceTree = ""; }; - A6A21F53393A351653982660E8D3B7E9 /* RetryWhen.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RetryWhen.swift; path = RxSwift/Observables/Implementations/RetryWhen.swift; sourceTree = ""; }; - A787E97336FD45CDDF79B761294A02D2 /* SubscribeOn.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SubscribeOn.swift; path = RxSwift/Observables/Implementations/SubscribeOn.swift; sourceTree = ""; }; - A7B828A7C8B940D81A0784CFDF60FA0F /* ConnectableObservableType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConnectableObservableType.swift; path = RxSwift/ConnectableObservableType.swift; sourceTree = ""; }; - A7E38F7A5F6F7B7F221ACC5C0AAB201F /* UITabBar+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITabBar+Rx.swift"; path = "RxCocoa/iOS/UITabBar+Rx.swift"; sourceTree = ""; }; - A86464618F957668786B8EF062C78CDB /* CwlCatchException.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = CwlCatchException.h; path = Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.h; sourceTree = ""; }; - A8C627F09111D781B1E5806663B4BA35 /* Migration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Migration.swift; path = RealmSwift/Migration.swift; sourceTree = ""; }; - A9873284E3734D478A44DB5469041A77 /* UIProgressView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIProgressView+Rx.swift"; path = "RxCocoa/iOS/UIProgressView+Rx.swift"; sourceTree = ""; }; - A99D0A764F4145F96DCA40079603C8DA /* RLMSyncPermissionOffer_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncPermissionOffer_Private.h; path = include/RLMSyncPermissionOffer_Private.h; sourceTree = ""; }; - A9A3F969C497BD91AD3F5DD9396FF96B /* ObservableConvertibleType+Blocking.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ObservableConvertibleType+Blocking.swift"; path = "RxBlocking/ObservableConvertibleType+Blocking.swift"; sourceTree = ""; }; - A9AB4E3B5E6E0EA3B8B9B99DF46CD96A /* XCTest+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "XCTest+Rx.swift"; path = "RxTest/XCTest+Rx.swift"; sourceTree = ""; }; - AA2358C12FB2240A3DA7703004D3EF17 /* RLMObjectSchema.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMObjectSchema.h; path = include/RLMObjectSchema.h; sourceTree = ""; }; - AB2960AD97002F5514AAD4B25EA9593B /* _RXKVOObserver.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RXKVOObserver.h; path = RxCocoa/Runtime/include/_RXKVOObserver.h; sourceTree = ""; }; - ABE583707D2E82BCC386E782B54DF72E /* BeLessThan.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLessThan.swift; path = Sources/Nimble/Matchers/BeLessThan.swift; sourceTree = ""; }; - ABF1CEC0AADC895600F3803828C8CAC3 /* QueryKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "QueryKit-dummy.m"; sourceTree = ""; }; - ACC48F782F7667876412E9401C618C48 /* NSObject+Rx+KVORepresentable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSObject+Rx+KVORepresentable.swift"; path = "RxCocoa/Foundation/NSObject+Rx+KVORepresentable.swift"; sourceTree = ""; }; - AD07A521480F7B304630DBB4FBE34315 /* UISegmentedControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UISegmentedControl+Rx.swift"; path = "RxCocoa/iOS/UISegmentedControl+Rx.swift"; sourceTree = ""; }; - AD69336C9FF50F5AC4C94C3087DD45B4 /* Empty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Empty.swift; path = RxSwift/Observables/Implementations/Empty.swift; sourceTree = ""; }; - ADC6A2DAA3C7B805A6B65430E7FE9A6A /* RLMSchema.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSchema.h; path = include/RLMSchema.h; sourceTree = ""; }; - ADFAB4721B073AD66157837FAD1C4BF7 /* Realm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - ADFBCA755396F244B2CFFDA38918CED5 /* Disposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Disposable.swift; path = RxSwift/Disposable.swift; sourceTree = ""; }; - AE01D1AC9BFFAA2CE3F505BFB99E2D71 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AE0ECAB8F86782C26B2920BF87A56CF1 /* Match.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Match.swift; path = Sources/Nimble/Matchers/Match.swift; sourceTree = ""; }; - AE208C7710B81B7DB545B3C47BCE671A /* _RXDelegateProxy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RXDelegateProxy.m; path = RxCocoa/Runtime/_RXDelegateProxy.m; sourceTree = ""; }; - AE73BF208E7B38E1BA4BCD70BC7FF518 /* Platform.Linux.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Linux.swift; path = Platform/Platform.Linux.swift; sourceTree = ""; }; - AEA7B15AF655E0429125627CAD29E6DC /* CombineLatest+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "CombineLatest+arity.swift"; path = "RxSwift/Observables/Implementations/CombineLatest+arity.swift"; sourceTree = ""; }; - AF3A5C25271B4BD6628FB518199F4A76 /* Pods-CleanArchitectureRxSwiftTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-CleanArchitectureRxSwiftTests-acknowledgements.plist"; sourceTree = ""; }; - AF5A33C252816D101B9C6623DF7945AB /* Variable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Variable.swift; path = RxSwift/Subjects/Variable.swift; sourceTree = ""; }; - B08D726E62BB67BA300B3BEC98BD0227 /* RLMObjectBase_Dynamic.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMObjectBase_Dynamic.h; path = include/RLMObjectBase_Dynamic.h; sourceTree = ""; }; - B0E48F61B0569430EAB76A9301709383 /* _RXObjCRuntime.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RXObjCRuntime.m; path = RxCocoa/Runtime/_RXObjCRuntime.m; sourceTree = ""; }; - B302632112607AC79A5DB7385B3BCCBB /* RLMRealmConfiguration.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMRealmConfiguration.mm; path = Realm/RLMRealmConfiguration.mm; sourceTree = ""; }; - B3633623DA2155149867CB54C3AA4540 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - B36C40EE40CB92DDC99B65592FF6BF0F /* RLMPredicateUtil.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMPredicateUtil.mm; path = Realm/RLMPredicateUtil.mm; sourceTree = ""; }; - B3A4870B24422E3B82672BBC037886AB /* QueryKit-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "QueryKit-umbrella.h"; sourceTree = ""; }; - B3A4EAB6B11F014FE29FF10E4616E668 /* SingleAssignmentDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SingleAssignmentDisposable.swift; path = RxSwift/Disposables/SingleAssignmentDisposable.swift; sourceTree = ""; }; - B43027225C56E595F5E913D502663CAE /* DSL.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = DSL.h; path = Sources/NimbleObjectiveC/DSL.h; sourceTree = ""; }; - B4FA9E8E2A2AD6E667D3034957393773 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - B5440177F5179769B6F62D590A26E693 /* Pods-CoreDataPlatform-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-CoreDataPlatform-umbrella.h"; sourceTree = ""; }; - B54E0D7C11D62423A37856C07A5503D1 /* RLMQueryUtil.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMQueryUtil.mm; path = Realm/RLMQueryUtil.mm; sourceTree = ""; }; - B54E8EE5A67BAF0E3BA65C7AF73361F6 /* RLMObjectBase.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMObjectBase.h; path = include/RLMObjectBase.h; sourceTree = ""; }; - B58A17614C170BB578C0CF4B63E4A805 /* Observable+Concurrency.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Observable+Concurrency.swift"; path = "RxSwift/Observables/Observable+Concurrency.swift"; sourceTree = ""; }; - B5C37C815B704CE983D68F11076255DC /* RLMSyncSessionRefreshHandle.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMSyncSessionRefreshHandle.mm; path = Realm/RLMSyncSessionRefreshHandle.mm; sourceTree = ""; }; - B6261ABB26A06A5A78C1882286643E8C /* placeholder.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = placeholder.cpp; path = Realm/ObjectStore/src/placeholder.cpp; sourceTree = ""; }; - B650171DA812528FC08ADDDA2C7FECB4 /* Pods_RealmPlatformTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_RealmPlatformTests.framework; path = "Pods-RealmPlatformTests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - B6BFE4CFD55F24BD664C94EA62163719 /* RefCount.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RefCount.swift; path = RxSwift/Observables/Implementations/RefCount.swift; sourceTree = ""; }; - B6E898DB323FEB82CD23EEF97B674B41 /* Pods-CleanArchitectureRxSwift.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CleanArchitectureRxSwift.release.xcconfig"; sourceTree = ""; }; - B7ACEB311ECFA84D9FD17B6E87C05CFE /* UISwitch+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UISwitch+Rx.swift"; path = "RxCocoa/iOS/UISwitch+Rx.swift"; sourceTree = ""; }; - B8381718F65F50C2F878283CCC802FA6 /* Observable+Bind.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Observable+Bind.swift"; path = "RxCocoa/Common/Observable+Bind.swift"; sourceTree = ""; }; - B9046C10DF3A711A09325597D815E642 /* UIRefreshControl+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIRefreshControl+Rx.swift"; path = "RxCocoa/iOS/UIRefreshControl+Rx.swift"; sourceTree = ""; }; - B99F3FB2FC5C707FB7FF466786E4E749 /* CwlCatchBadInstruction.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = CwlCatchBadInstruction.h; path = Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.h; sourceTree = ""; }; - B9F784C757F4866A2C027B696446EACF /* RLMSyncUser.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMSyncUser.mm; path = Realm/RLMSyncUser.mm; sourceTree = ""; }; - BB068DC0F039D5F81258E7C270B36CCB /* RxCocoa-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxCocoa-umbrella.h"; sourceTree = ""; }; - BB7586E4448903466B3CFBA9B32EA75A /* RxTest-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "RxTest-dummy.m"; sourceTree = ""; }; - BBA06600C4A44787728BACAC9DBEAFEC /* Range.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Range.swift; path = RxSwift/Observables/Implementations/Range.swift; sourceTree = ""; }; - BBEC25DC81B1ABDCB21C52F89DA8A509 /* DSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DSL.swift; path = Sources/Nimble/DSL.swift; sourceTree = ""; }; - BC8979BACCB986B1895235C7A8862251 /* RxRealm.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxRealm.swift; path = Pod/Classes/RxRealm.swift; sourceTree = ""; }; - BC9C07BFD9E5285640958FD1F757A3B1 /* Observable+Creation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Observable+Creation.swift"; path = "RxSwift/Observables/Observable+Creation.swift"; sourceTree = ""; }; - BD0D3D502C52C530869CB471A41E1EB0 /* RLMListBase.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMListBase.mm; path = Realm/RLMListBase.mm; sourceTree = ""; }; - BD16B879B46399C1A79AE65F9429917B /* Multicast.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Multicast.swift; path = RxSwift/Observables/Implementations/Multicast.swift; sourceTree = ""; }; - BD5F14DC655D910221783AA947DD700A /* DisposeBag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DisposeBag.swift; path = RxSwift/Disposables/DisposeBag.swift; sourceTree = ""; }; - BE87C88221EBDF94A4D0CD98E637BE5B /* RLMRealm.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMRealm.mm; path = Realm/RLMRealm.mm; sourceTree = ""; }; - C05DDD4799193E1D553A931B33F90393 /* Recorded.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Recorded.swift; path = RxTest/Recorded.swift; sourceTree = ""; }; - C06DE4D1DD0630A97C784AA835602D8D /* RaisesException.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RaisesException.swift; path = Sources/Nimble/Matchers/RaisesException.swift; sourceTree = ""; }; - C12E18EB9076B86DCB54CB5CEA607A82 /* UISlider+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UISlider+Rx.swift"; path = "RxCocoa/iOS/UISlider+Rx.swift"; sourceTree = ""; }; - C19A57FED1E6BAEEB96AD5D4942B31D3 /* CwlBadInstructionException.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CwlBadInstructionException.swift; path = Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlBadInstructionException.swift; sourceTree = ""; }; - C1FE552BECE0FE2FA20EF5366E64F63B /* UIApplication+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIApplication+Rx.swift"; path = "RxCocoa/iOS/UIApplication+Rx.swift"; sourceTree = ""; }; - C22CE36AFE7517678FA6060BC4A56D66 /* Schema.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Schema.swift; path = RealmSwift/Schema.swift; sourceTree = ""; }; - C25316696EA3FD3FCBCCD3E7E5E60DF1 /* sync_metadata.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = sync_metadata.cpp; path = Realm/ObjectStore/src/sync/impl/sync_metadata.cpp; sourceTree = ""; }; - C29ABA36121FE751CD24C2CB2CA2CCD0 /* RxBlocking.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = RxBlocking.xcconfig; sourceTree = ""; }; - C3258E2CF7232311543129625A67DF48 /* _RX.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = _RX.m; path = RxCocoa/Runtime/_RX.m; sourceTree = ""; }; - C3993AF868F7A8EDD1EAB67CF1CD28C2 /* collection_notifier.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = collection_notifier.cpp; path = Realm/ObjectStore/src/impl/collection_notifier.cpp; sourceTree = ""; }; - C3F0BD38330F99A377C46B21C0210793 /* Realm-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Realm-prefix.pch"; sourceTree = ""; }; - C3F5BFCB6E3E5ECB905ED65B33EC661E /* RLMSyncPermissionOfferResponse.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = RLMSyncPermissionOfferResponse.m; path = Realm/RLMSyncPermissionOfferResponse.m; sourceTree = ""; }; - C5121AA168A2C53B33839BEFD2CD6751 /* RLMRealm_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMRealm_Private.h; path = include/RLMRealm_Private.h; sourceTree = ""; }; - C555FD10571F74DAE34500F844CB34CA /* RLMRealmConfiguration_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMRealmConfiguration_Private.h; path = include/RLMRealmConfiguration_Private.h; sourceTree = ""; }; - C57476FAC6A0C52BA090C6D4B5BB9649 /* BlockingObservable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BlockingObservable.swift; path = RxBlocking/BlockingObservable.swift; sourceTree = ""; }; - C61C62CBB65B867F80D32CF5E6A0FFE8 /* Errors.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Errors.swift; path = Sources/Nimble/Utils/Errors.swift; sourceTree = ""; }; - C6CD153809273B5A278677D70BFA8C28 /* RxTextStorageDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTextStorageDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTextStorageDelegateProxy.swift; sourceTree = ""; }; - C76A953946D58DDBEE78786C00AE05D6 /* external_commit_helper.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = external_commit_helper.cpp; path = Realm/ObjectStore/src/impl/apple/external_commit_helper.cpp; sourceTree = ""; }; - C87BD9D3FAB79191092DE8A9A58F5435 /* Bag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Bag.swift; path = Platform/DataStructures/Bag.swift; sourceTree = ""; }; - C93F74F2EDCEBA93D7710BD08CDCB725 /* Pods-Domain-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Domain-umbrella.h"; sourceTree = ""; }; - C965109204C6C72427A9D61E931164D1 /* Nimble-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Nimble-dummy.m"; sourceTree = ""; }; - CA2C25F591391F4A8A267326178CE596 /* mach_excServer.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mach_excServer.c; path = Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/mach_excServer.c; sourceTree = ""; }; - CA2D0F53DBA0078A870976910A7C078B /* Debug.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Debug.swift; path = RxSwift/Observables/Implementations/Debug.swift; sourceTree = ""; }; - CA59CF369E8DFDEC956FEE2FFC8BDDAB /* Observable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Observable.swift; path = RxSwift/Observable.swift; sourceTree = ""; }; - CAB57A78D701A804B22FEF812B0BB979 /* AddRef.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AddRef.swift; path = RxSwift/Observables/Implementations/AddRef.swift; sourceTree = ""; }; - CAF071D8F638574AA04A43378F800E5B /* Deferred.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Deferred.swift; path = RxSwift/Observables/Implementations/Deferred.swift; sourceTree = ""; }; - CB1FB9D374AE5AA968003FE72D707271 /* ImmediateSchedulerType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImmediateSchedulerType.swift; path = RxSwift/ImmediateSchedulerType.swift; sourceTree = ""; }; - CB4593CE90B1844E45C9EB2F9A1617D5 /* Nimble.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = Nimble.modulemap; sourceTree = ""; }; - CB56B533DB96A224DFABAED89D4D96CA /* UITextView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITextView+Rx.swift"; path = "RxCocoa/iOS/UITextView+Rx.swift"; sourceTree = ""; }; - CB9CAA431B02149E5221455001A1AE31 /* Util.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Util.swift; path = RealmSwift/Util.swift; sourceTree = ""; }; - CBC006F1F0DBD8AC1A0B890646852B4B /* TextInput.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TextInput.swift; path = RxCocoa/Common/TextInput.swift; sourceTree = ""; }; - CBE2E0B290CF9163911607C23E090D9C /* RLMProperty.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMProperty.h; path = include/RLMProperty.h; sourceTree = ""; }; - CBED89F2DC54B20A504A4AAAE40CB4AA /* ConnectableObservable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConnectableObservable.swift; path = RxSwift/Observables/Implementations/ConnectableObservable.swift; sourceTree = ""; }; - CC1954DF826907EEC9FF1742C99C88F5 /* Pods-Domain.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Domain.debug.xcconfig"; sourceTree = ""; }; - CC56074901EBEF20D23A74EAE9253DDD /* Attribute.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Attribute.swift; path = QueryKit/Attribute.swift; sourceTree = ""; }; - CC5FAA30414B06944F6763C7A849859A /* Event+Equatable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Event+Equatable.swift"; path = "RxTest/Event+Equatable.swift"; sourceTree = ""; }; - CC711F7CD1CA11D44C4CAFA7A36C0572 /* MatchError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MatchError.swift; path = Sources/Nimble/Matchers/MatchError.swift; sourceTree = ""; }; - CD2011369791BBA73E5236E0DEA7DDE8 /* BehaviorSubject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BehaviorSubject.swift; path = RxSwift/Subjects/BehaviorSubject.swift; sourceTree = ""; }; - CD21F45AFD5FE86A1DB42E264B40DE2A /* CwlCatchException.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = CwlCatchException.m; path = Sources/Lib/CwlPreconditionTesting/CwlCatchException/CwlCatchException/CwlCatchException.m; sourceTree = ""; }; - CD6FA85A15D26B61CF56DC7EF9DE08BD /* ObserveOnSerialDispatchQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObserveOnSerialDispatchQueue.swift; path = RxSwift/Observables/Implementations/ObserveOnSerialDispatchQueue.swift; sourceTree = ""; }; - CE31D89F2C8DB6F7C543B33758BE8144 /* RLMAccessor.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMAccessor.mm; path = Realm/RLMAccessor.mm; sourceTree = ""; }; - CE8220D6464C1EB4A670642D437E73CA /* Zip+arity.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Zip+arity.swift"; path = "RxSwift/Observables/Implementations/Zip+arity.swift"; sourceTree = ""; }; - CECD5B91706E6F398912E7F13BD6384A /* CombineLatest+Collection.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "CombineLatest+Collection.swift"; path = "RxSwift/Observables/Implementations/CombineLatest+Collection.swift"; sourceTree = ""; }; - CEF657B58156636513E301EBE60961EE /* RecursiveLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecursiveLock.swift; path = Platform/RecursiveLock.swift; sourceTree = ""; }; - CF0EB61780DB161C1ABC46C9C6E08ED2 /* RxCocoa.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCocoa.swift; path = RxCocoa/RxCocoa.swift; sourceTree = ""; }; - CF93653A2314101FEE0FCEAEF6A2DA38 /* OperationQueueScheduler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = OperationQueueScheduler.swift; path = RxSwift/Schedulers/OperationQueueScheduler.swift; sourceTree = ""; }; - CFC2CB297B7568B9481BA1075998CB58 /* RLMSyncSession.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMSyncSession.mm; path = Realm/RLMSyncSession.mm; sourceTree = ""; }; - CFF1CE5B512B5B4B43F9B47CA3639948 /* Realm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Realm.framework; path = Realm.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D0B99A3F832E6114A5FA74DDC29F5B76 /* URLSession+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "URLSession+Rx.swift"; path = "RxCocoa/Foundation/URLSession+Rx.swift"; sourceTree = ""; }; - D1617E4A776B209644FAA060C19A9AB4 /* Pods_RealmPlatform.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_RealmPlatform.framework; path = "Pods-RealmPlatform.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - D18AE140B42060652DA722A18B4581D6 /* NSError+RLMSync.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSError+RLMSync.m"; path = "Realm/NSError+RLMSync.m"; sourceTree = ""; }; - D20E2A97038719D7BEFEF436CB51AC6B /* thread_safe_reference.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = thread_safe_reference.cpp; path = Realm/ObjectStore/src/thread_safe_reference.cpp; sourceTree = ""; }; - D28F082D05322822F974934BEAFC970F /* UIViewController+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIViewController+Rx.swift"; path = "RxCocoa/iOS/UIViewController+Rx.swift"; sourceTree = ""; }; - D2A1FB18B7E477EE3BD21E3FFE700B50 /* PriorityQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PriorityQueue.swift; path = Platform/DataStructures/PriorityQueue.swift; sourceTree = ""; }; - D2E56051C914AA19D17127B65F8163C2 /* BeVoid.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeVoid.swift; path = Sources/Nimble/Matchers/BeVoid.swift; sourceTree = ""; }; - D339EB8E0C5AD7056277F1B708D49A0E /* Pods-CoreDataPlatform.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-CoreDataPlatform.debug.xcconfig"; sourceTree = ""; }; - D3F4B3E20EC2AC39A861AAACC78EA132 /* VirtualTimeConverterType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = VirtualTimeConverterType.swift; path = RxSwift/Schedulers/VirtualTimeConverterType.swift; sourceTree = ""; }; - D481473374DD16525B37E0B777FEE151 /* RLMArray.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMArray.mm; path = Realm/RLMArray.mm; sourceTree = ""; }; - D58679AF1EC8AAAAD66EF4A53220097B /* CurrentTestCaseTracker.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = CurrentTestCaseTracker.h; path = Sources/NimbleObjectiveC/CurrentTestCaseTracker.h; sourceTree = ""; }; - D5D15835D0AB5E9B05210AB236D8952B /* RxTabBarControllerDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTabBarControllerDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTabBarControllerDelegateProxy.swift; sourceTree = ""; }; - D60C73374AF1C9A11387557CCDE4485F /* RLMObject_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMObject_Private.h; path = include/RLMObject_Private.h; sourceTree = ""; }; - D61929A5ABE4042C09417168DF233F3C /* NMBExpectation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NMBExpectation.swift; path = Sources/Nimble/Adapters/NMBExpectation.swift; sourceTree = ""; }; - D640BC3EB4D9032D0A4F36670BCCA86E /* NSObject+Rx+RawRepresentable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSObject+Rx+RawRepresentable.swift"; path = "RxCocoa/Foundation/NSObject+Rx+RawRepresentable.swift"; sourceTree = ""; }; - D6762421CBA4B7F9E6760BEF91362ED2 /* Throttle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Throttle.swift; path = RxSwift/Observables/Implementations/Throttle.swift; sourceTree = ""; }; - D69A9FD89F7773AC0DE5317CB4690A3B /* ControlEvent.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ControlEvent.swift; path = RxCocoa/CocoaUnits/ControlEvent.swift; sourceTree = ""; }; - D69F3BF5A79C4983DA88212C4D69DD15 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Nimble.framework; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - D6C95112385932116CE17EB9AB8D181A /* GroupedObservable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GroupedObservable.swift; path = RxSwift/GroupedObservable.swift; sourceTree = ""; }; - D73B8E9DFA10E77D6BBB7C2C0B29A483 /* Realm.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Realm.h; path = include/Realm.h; sourceTree = ""; }; - D75334EF2399AE4F713E8C34AEEC1A4D /* RxCollectionViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxCollectionViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxCollectionViewDelegateProxy.swift; sourceTree = ""; }; - D75727C08605433E0C5B8DB8B3E188B8 /* ThrowError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThrowError.swift; path = Sources/Nimble/Matchers/ThrowError.swift; sourceTree = ""; }; - D80DAD9DCF476D933384B3CCBA0F4C2B /* RLMSyncUser.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncUser.h; path = include/RLMSyncUser.h; sourceTree = ""; }; - D82F882024EF9E73620A4FBB0D4DA834 /* UITabBarItem+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UITabBarItem+Rx.swift"; path = "RxCocoa/iOS/UITabBarItem+Rx.swift"; sourceTree = ""; }; - D8A20375F4A84061C6B4E3EF2DAB140F /* RLMSchema_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSchema_Private.h; path = include/RLMSchema_Private.h; sourceTree = ""; }; - DA0217A5F5ABB713A825C6E4B8A0E649 /* librealm-ios.a */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = archive.ar; name = "librealm-ios.a"; path = "core/librealm-ios.a"; sourceTree = ""; }; - DA642526C373285055DF7A048E6653DA /* Optional.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Optional.swift; path = RxSwift/Observables/Implementations/Optional.swift; sourceTree = ""; }; - DA764D488DA21265DCB666D506B91F36 /* Observable+StandardSequenceOperators.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Observable+StandardSequenceOperators.swift"; path = "RxSwift/Observables/Observable+StandardSequenceOperators.swift"; sourceTree = ""; }; - DA91C5789039F5EE1DF36450BC6FCEA7 /* Bag.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Bag.swift; path = Platform/DataStructures/Bag.swift; sourceTree = ""; }; - DAD3127158220FA5FDFC00B86E1E3F8C /* ElementAt.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ElementAt.swift; path = RxSwift/Observables/Implementations/ElementAt.swift; sourceTree = ""; }; - DAEAA9EE9B3496B70B3A080292393D87 /* ObservableType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObservableType.swift; path = RxSwift/ObservableType.swift; sourceTree = ""; }; - DB6F36CC9B7AA1EBA88BC20EF65605A6 /* SkipWhile.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SkipWhile.swift; path = RxSwift/Observables/Implementations/SkipWhile.swift; sourceTree = ""; }; - DBFD2B4D84BE6F02957AA2D4188E318C /* RLMSyncManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncManager.h; path = include/RLMSyncManager.h; sourceTree = ""; }; - DC6D7F0AAAC759C364165AB73273FF3B /* Contain.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Contain.swift; path = Sources/Nimble/Matchers/Contain.swift; sourceTree = ""; }; - DD10538785F57950A30FC93BB2235A23 /* ObjectSchema.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObjectSchema.swift; path = RealmSwift/ObjectSchema.swift; sourceTree = ""; }; - DD70AF42B51227529EC85C61C290A6E6 /* RLMUtil.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMUtil.mm; path = Realm/RLMUtil.mm; sourceTree = ""; }; - DD90D2AB53FA33B7CBDE9113E1BAFAD9 /* HaveCount.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HaveCount.swift; path = Sources/Nimble/Matchers/HaveCount.swift; sourceTree = ""; }; - DE1A575C17A110965C2E6FB43F4D1E53 /* RLMResults_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMResults_Private.h; path = include/RLMResults_Private.h; sourceTree = ""; }; - DEC184AC85553054659581B7240F098D /* RLMConstants.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = RLMConstants.m; path = Realm/RLMConstants.m; sourceTree = ""; }; - DF89AA745937A2D0427115965F6783B3 /* Pods-CoreDataPlatformTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-CoreDataPlatformTests-acknowledgements.plist"; sourceTree = ""; }; - E03AA51CE98C0E25831A651363252F01 /* RecursiveLock.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RecursiveLock.swift; path = Platform/RecursiveLock.swift; sourceTree = ""; }; - E03F4258E17C30AB8353F67FCAC54713 /* UIAlertAction+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIAlertAction+Rx.swift"; path = "RxCocoa/iOS/UIAlertAction+Rx.swift"; sourceTree = ""; }; - E160F93F4C043688D81D2F3471469690 /* CwlCatchBadInstruction.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CwlCatchBadInstruction.swift; path = Sources/Lib/CwlPreconditionTesting/CwlPreconditionTesting/CwlCatchBadInstruction.swift; sourceTree = ""; }; - E1A560DF846C100753A99E9A04F177D9 /* Logging.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Logging.swift; path = RxCocoa/Foundation/Logging.swift; sourceTree = ""; }; - E1A9BF9FBC00FE12E25776D24AF8433E /* RxSearchControllerDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxSearchControllerDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxSearchControllerDelegateProxy.swift; sourceTree = ""; }; - E1D07FB8A794E8FB2ED5630ECA8E9CC1 /* RLMAnalytics.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMAnalytics.mm; path = Realm/RLMAnalytics.mm; sourceTree = ""; }; - E1E60499526BA32B339B2EE534752CB9 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E1E6547B9D6243D4CF71A0C77BE85465 /* ColdObservable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ColdObservable.swift; path = RxTest/ColdObservable.swift; sourceTree = ""; }; - E1F8667B805F0A3DA04D10BE51C936C2 /* Pods-RealmPlatformTests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-RealmPlatformTests-acknowledgements.plist"; sourceTree = ""; }; - E2005A2F0B8500820258925CE1765C34 /* ItemEvents.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ItemEvents.swift; path = RxCocoa/iOS/Events/ItemEvents.swift; sourceTree = ""; }; - E2783992A84439EA1893A28DF0A37757 /* NopDisposable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NopDisposable.swift; path = RxSwift/Disposables/NopDisposable.swift; sourceTree = ""; }; - E2F68543479C90FA720A187305542FA0 /* Pods-RealmPlatform-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-RealmPlatform-acknowledgements.plist"; sourceTree = ""; }; - E31FCD0AEA3AFD5AB8F1A9CB36071E14 /* SynchronizedUnsubscribeType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SynchronizedUnsubscribeType.swift; path = RxSwift/Concurrency/SynchronizedUnsubscribeType.swift; sourceTree = ""; }; - E46FA50B8211DF43D1E755CC6DDEF607 /* Pods-DomainTests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-DomainTests-resources.sh"; sourceTree = ""; }; - E58053D64E5CAF32528EB1D63F9DA215 /* Delay.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Delay.swift; path = RxSwift/Observables/Implementations/Delay.swift; sourceTree = ""; }; - E5EFD66E6BD218495B48E96BA9B3CD2F /* ControlProperty+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ControlProperty+Driver.swift"; path = "RxCocoa/CocoaUnits/Driver/ControlProperty+Driver.swift"; sourceTree = ""; }; - E6212B5E1406A44C5AF532CAF7B94511 /* Async.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Async.swift; path = Sources/Nimble/Utils/Async.swift; sourceTree = ""; }; - E6633EA0D93D4B6AE1E7D77701B5BC79 /* RxSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "RxSwift-dummy.m"; sourceTree = ""; }; - E6873A67EC8C5D2358006907B3F7A770 /* Pods-CoreDataPlatformTests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CoreDataPlatformTests-resources.sh"; sourceTree = ""; }; - E70C6C218193F4B562DB83C729CAE65C /* BeLogical.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLogical.swift; path = Sources/Nimble/Matchers/BeLogical.swift; sourceTree = ""; }; - E726364160961DC7CA6554453D9B3C38 /* TakeWhile.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TakeWhile.swift; path = RxSwift/Observables/Implementations/TakeWhile.swift; sourceTree = ""; }; - E74965087A941114772D04B6C982AF19 /* Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Driver.swift; path = RxCocoa/CocoaUnits/Driver/Driver.swift; sourceTree = ""; }; - E75BC693E7D92E8F3D03FA21EE9AD428 /* Observable+Time.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Observable+Time.swift"; path = "RxSwift/Observables/Observable+Time.swift"; sourceTree = ""; }; - E79585EC3A1B2374F751C0A5CF376D96 /* ThreadSafeReference.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThreadSafeReference.swift; path = RealmSwift/ThreadSafeReference.swift; sourceTree = ""; }; - E7973DF3A2C40EE048550AECE194E1D3 /* index_set.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = index_set.cpp; path = Realm/ObjectStore/src/index_set.cpp; sourceTree = ""; }; - E870979F5C62F7A48BBA13C070842F12 /* RLMRealm_Dynamic.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMRealm_Dynamic.h; path = include/RLMRealm_Dynamic.h; sourceTree = ""; }; - E87990ECD2EFCEE49E762C8BF8548B18 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E8B4885F3C548BBF6FFC834931C3FC55 /* Platform.Linux.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Platform.Linux.swift; path = Platform/Platform.Linux.swift; sourceTree = ""; }; - E918723374177EFDBA5DCB0F2C860319 /* DefaultIfEmpty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DefaultIfEmpty.swift; path = RxSwift/Observables/Implementations/DefaultIfEmpty.swift; sourceTree = ""; }; - E96371DF4BBAA27834C93DAEA5F0DD3D /* RealmSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RealmSwift-umbrella.h"; sourceTree = ""; }; - EA125B544144AE7113CA11C137B5370E /* UIWebView+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UIWebView+Rx.swift"; path = "RxCocoa/iOS/UIWebView+Rx.swift"; sourceTree = ""; }; - EA718E5A284E4A6A87F0DFB46E8440E9 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - EA98B93E0B97D8B7E1C7D158CAC17D4D /* Zip+Collection.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "Zip+Collection.swift"; path = "RxSwift/Observables/Implementations/Zip+Collection.swift"; sourceTree = ""; }; - EAADEF34790ABC1117C0FCFC197FBD03 /* RxWebViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxWebViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxWebViewDelegateProxy.swift; sourceTree = ""; }; - EB51FF01BE46CC25221378CD845BC4A0 /* InfiniteSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InfiniteSequence.swift; path = Platform/DataStructures/InfiniteSequence.swift; sourceTree = ""; }; - EC779AAB6131AEB402A39824AB090711 /* RxSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = RxSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - EC936A807878C4A12B3F79CB60B8E42C /* Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Rx.swift; path = RxSwift/Rx.swift; sourceTree = ""; }; - ECC90D48452775CBC3EA19EDC518EFED /* RxRealm.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = RxRealm.modulemap; sourceTree = ""; }; - ECDF6CF651A49944A8B69F2691D7DCC7 /* ObjectiveCSupport.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObjectiveCSupport.swift; path = RealmSwift/ObjectiveCSupport.swift; sourceTree = ""; }; - ECE64C1907963A888AD25A49054B3C1F /* BeNil.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeNil.swift; path = Sources/Nimble/Matchers/BeNil.swift; sourceTree = ""; }; - EE0CAA07155179BF3F081117D6587F8A /* results.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = results.cpp; path = Realm/ObjectStore/src/results.cpp; sourceTree = ""; }; - EEC86B6A1857601BF1A22F485299EFDB /* keychain_helper.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = keychain_helper.cpp; path = Realm/ObjectStore/src/impl/apple/keychain_helper.cpp; sourceTree = ""; }; - EF4F2362C395821825BD02C6396133B1 /* AssertionRecorder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AssertionRecorder.swift; path = Sources/Nimble/Adapters/AssertionRecorder.swift; sourceTree = ""; }; - EF88472545EDF4E24240E50B66C44174 /* _RX.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RX.h; path = RxCocoa/Runtime/include/_RX.h; sourceTree = ""; }; - F02E16D11D5BE1429FC72E907936E62A /* InfiniteSequence.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = InfiniteSequence.swift; path = Platform/DataStructures/InfiniteSequence.swift; sourceTree = ""; }; - F223660F9BBE73DE7F388D3595377AD1 /* RxSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "RxSwift-prefix.pch"; sourceTree = ""; }; - F23B137F530D39D6691F56296C847AAC /* Pods_Domain.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_Domain.framework; path = "Pods-Domain.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - F37EEEA6DF79DE035BF9694CDE83749D /* Property.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Property.swift; path = RealmSwift/Property.swift; sourceTree = ""; }; - F3F88767FB9DAAE2147BA4AFC0F324D5 /* EndWith.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = EndWith.swift; path = Sources/Nimble/Matchers/EndWith.swift; sourceTree = ""; }; - F44C242A3E765B64B0946BF3074BDE73 /* SortDescriptor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SortDescriptor.swift; path = RealmSwift/SortDescriptor.swift; sourceTree = ""; }; - F5455DB9934B6E9608CEE0A65CF1F2AB /* ObserverBase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ObserverBase.swift; path = RxSwift/Observers/ObserverBase.swift; sourceTree = ""; }; - F54B3455EB7F4E95E92F49FB557459BB /* Pods-CoreDataPlatform-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-CoreDataPlatform-resources.sh"; sourceTree = ""; }; - F62981846211AB9A56BC9DE108E81476 /* LinkingObjects.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LinkingObjects.swift; path = RealmSwift/LinkingObjects.swift; sourceTree = ""; }; - F74C17B54E2A32A16313F180719BCB4D /* Pods-CleanArchitectureRxSwift-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-CleanArchitectureRxSwift-acknowledgements.markdown"; sourceTree = ""; }; - F764790299E276D41B15B956E08DF02F /* ControlTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ControlTarget.swift; path = RxCocoa/Common/ControlTarget.swift; sourceTree = ""; }; - F7F276851D1124CC7AA77B7CA5729547 /* Pods-RealmPlatform.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; path = "Pods-RealmPlatform.modulemap"; sourceTree = ""; }; - F7FF34C24A309A56D5E558BFC9DC5EE5 /* RxTableViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxTableViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxTableViewDelegateProxy.swift; sourceTree = ""; }; - F828C4F53AC4B02E2057C7DEE457BE8E /* _RXDelegateProxy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = _RXDelegateProxy.h; path = RxCocoa/Runtime/include/_RXDelegateProxy.h; sourceTree = ""; }; - F8B1D24C4BC6E7A939373F908196AB54 /* UINavigationItem+Rx.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UINavigationItem+Rx.swift"; path = "RxCocoa/iOS/UINavigationItem+Rx.swift"; sourceTree = ""; }; - F8BAE64E30EA9DF69A3FB3B92FC4D690 /* RLMSyncPermissionOffer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMSyncPermissionOffer.h; path = include/RLMSyncPermissionOffer.h; sourceTree = ""; }; - FA5021148FF213AE082EF2C5A2958FC2 /* RLMObject.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMObject.h; path = include/RLMObject.h; sourceTree = ""; }; - FA831E78C82E138DCFADB062EB62CC22 /* RxScrollViewDelegateProxy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RxScrollViewDelegateProxy.swift; path = RxCocoa/iOS/Proxies/RxScrollViewDelegateProxy.swift; sourceTree = ""; }; - FBBF44D77690F11DE05093230CB4E696 /* ControlEvent+Driver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ControlEvent+Driver.swift"; path = "RxCocoa/CocoaUnits/Driver/ControlEvent+Driver.swift"; sourceTree = ""; }; - FBC32FCE9A7D8DB312E6DE40B882E6C5 /* realm_coordinator.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = realm_coordinator.cpp; path = Realm/ObjectStore/src/impl/realm_coordinator.cpp; sourceTree = ""; }; - FBD37B96914326B6D403C752454FB28F /* ScheduledItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ScheduledItem.swift; path = RxSwift/Schedulers/Internal/ScheduledItem.swift; sourceTree = ""; }; - FC207590A5FC79B5F2876F39287DDD34 /* RLMProperty_Private.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMProperty_Private.h; path = include/RLMProperty_Private.h; sourceTree = ""; }; - FCE55DB8FB0AB2E413DB6F50F46406DE /* Optional.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Optional.swift; path = RealmSwift/Optional.swift; sourceTree = ""; }; - FD14D4DAA5A63334AB7CF75B4787CF43 /* RLMUpdateChecker.mm */ = {isa = PBXFileReference; includeInIndex = 1; name = RLMUpdateChecker.mm; path = Realm/RLMUpdateChecker.mm; sourceTree = ""; }; - FD46E1B417F0A908BC72E6198B90EAFB /* sync_file.cpp */ = {isa = PBXFileReference; includeInIndex = 1; name = sync_file.cpp; path = Realm/ObjectStore/src/sync/impl/sync_file.cpp; sourceTree = ""; }; - FD4F0F4F7611B59EB7B852A2897AEB06 /* Errors.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Errors.swift; path = RxSwift/Errors.swift; sourceTree = ""; }; - FD520CE7E7239BF77CCE073A8BF2EB8E /* Using.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Using.swift; path = RxSwift/Observables/Implementations/Using.swift; sourceTree = ""; }; - FDE46C6CAA2FBECD5CA170EEA7ACE4AC /* RxRealm.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = RxRealm.framework; path = RxRealm.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FE2CCA9264024E06109045959D1EC7E3 /* RLMObjectStore.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RLMObjectStore.h; path = include/RLMObjectStore.h; sourceTree = ""; }; - FEB18B36D3EE307D7CA204E17B0EEEFA /* RLMSwiftSupport.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = RLMSwiftSupport.m; path = Realm/RLMSwiftSupport.m; sourceTree = ""; }; - FF58653ECA07C59AB6640587F777ED92 /* Sample.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Sample.swift; path = RxSwift/Observables/Implementations/Sample.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 029FEAF727C4B59BDAFC04625EA93DFD /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - C9BDBA79B96D902E7CC25B007A32C522 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 085C70296632E14BDF5E1434416A1E09 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9EE6A8A11BFB9CD5C2482F7FA044E8FF /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 1F57DF9CCE3D2FA8AF46DD7836B5E1D9 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - BF97DF079E362E6E682AA7C9FF4702CC /* CoreData.framework in Frameworks */, - A7DF0C050AF71110B5D7CE0F43D65306 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 355ACB9F08AC0F5EC6F97C15145ECD4A /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 98F0C338F886F65AE03A987983A229F9 /* Foundation.framework in Frameworks */, - 9362900463464DFBEF3A1D53984D521B /* Realm.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3FDA250F9EBEF7F54C0AA598F8DA5F53 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 5666FFE8CEB3F28A62E834AC0E2FB76A /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 49AE3902ACE145960CA3C66C5B1D32DE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 273B7E556D46FA80BB7BD3B8F83A581D /* Foundation.framework in Frameworks */, - 07E27E76E425DE09CE7D615B1C48D729 /* RxSwift.framework in Frameworks */, - CBD660FE5DF376E7A003F18730E1FE0D /* XCTest.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 53282E99D747AFFF70DF685DF8496BC4 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 35FAA1CD88C538E3B7CDBE983BB68123 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9E68B1045CA1DCDD4C136C0A1D39A335 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 469C7D38B75CEBB7C580CA06EE97E1BC /* Foundation.framework in Frameworks */, - 34AECA25BD452A0C649518DD95C27538 /* RxSwift.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A0673853CCFEF089C0BF4D09E710CC4F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - C710B6A7B1A479349273B3AC04CF07C5 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A1316E518FF9537C47C159D8EBBBBC07 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - AC833BA88C128573C8C75CD2E5E0B12A /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A4477D6C5F2B67446475D4B381B60ACB /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 580A589494EEB227F32674BC2FC4C930 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - B4FE59DBC1B4614D33D872C69A7594FA /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 982DA9B12EBD0EE37FC22DCD40D6A09C /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - B6D03A2C0B65B4F586D2154FE64196BE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FF2FC25599DAADF1D06C95D2EDA4B251 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DA52AAB54ACA536EBF1309A5154861FF /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8A085CEF31B24ECA942E9A0F64CC3D1F /* Foundation.framework in Frameworks */, - E24DFCCF40BA25CFBB1C33D631443B78 /* RxSwift.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EE7054F970BBE381414FAB833824BEE4 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - D92F5684C2B940A5E0D0C049C148AB77 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F8DD8951DB71E9BE63BC09F2C8E78ECE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8599B573F453A986A64236D1B7175AAC /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F9D0D912DC8CD62610F9B31A8CB4FCCA /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 9CB4FDBBA9CCCC990ED8AFE76A80734B /* Foundation.framework in Frameworks */, - 48FBD0ADD4877FC7EDF916833F156A59 /* Realm.framework in Frameworks */, - 2B1034E4C47757714971C72F594602B0 /* RealmSwift.framework in Frameworks */, - 79ED1EAEEF241EE089D0588577B0E33F /* RxSwift.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0E520E4CB3D265E8E4878E91F7CAA5B2 /* Nimble */ = { - isa = PBXGroup; - children = ( - 13C208D8232C936AFB19CB44F0687578 /* AdapterProtocols.swift */, - 59F8320AA898ED121BDECB3666317FA7 /* AllPass.swift */, - 8799EAE23AC4B38F89FB70248DB44D5A /* AssertionDispatcher.swift */, - EF4F2362C395821825BD02C6396133B1 /* AssertionRecorder.swift */, - E6212B5E1406A44C5AF532CAF7B94511 /* Async.swift */, - 76B4D0EAC3019F6520D0B460B971C10F /* AsyncMatcherWrapper.swift */, - 680F8C82FE30FC925A6F0EBA92CC93A6 /* BeAKindOf.swift */, - 437748C82613E2EE8BE3BDDBB9CD429D /* BeAnInstanceOf.swift */, - 50C74801C762073F7DB0CDCD76B6E3FE /* BeCloseTo.swift */, - 8B3D331262EB0179A93ABC9CA9BFE9E0 /* BeEmpty.swift */, - A5B5A413CCB125AE95B36D10B52C498E /* BeginWith.swift */, - 5239B3D651CB232F32021273593EDD83 /* BeGreaterThan.swift */, - 1A2FBA9ED711AFFD0E67EC02BFCF6CBC /* BeGreaterThanOrEqualTo.swift */, - 2E651B8C4B3321D6784A7A05DD142E59 /* BeIdenticalTo.swift */, - ABE583707D2E82BCC386E782B54DF72E /* BeLessThan.swift */, - 7DCDC3E80BD1902283A39F5F01A9D86E /* BeLessThanOrEqual.swift */, - E70C6C218193F4B562DB83C729CAE65C /* BeLogical.swift */, - ECE64C1907963A888AD25A49054B3C1F /* BeNil.swift */, - D2E56051C914AA19D17127B65F8163C2 /* BeVoid.swift */, - DC6D7F0AAAC759C364165AB73273FF3B /* Contain.swift */, - 355C96D7E6DA49624176F800F4276141 /* ContainElementSatisfying.swift */, - D58679AF1EC8AAAAD66EF4A53220097B /* CurrentTestCaseTracker.h */, - C19A57FED1E6BAEEB96AD5D4942B31D3 /* CwlBadInstructionException.swift */, - B99F3FB2FC5C707FB7FF466786E4E749 /* CwlCatchBadInstruction.h */, - 25B549B23810CFC78B1CFE19F7C955A7 /* CwlCatchBadInstruction.m */, - E160F93F4C043688D81D2F3471469690 /* CwlCatchBadInstruction.swift */, - A86464618F957668786B8EF062C78CDB /* CwlCatchException.h */, - CD21F45AFD5FE86A1DB42E264B40DE2A /* CwlCatchException.m */, - 84F1C0AC877B51B7ACF21232AE9CEFB3 /* CwlCatchException.swift */, - A10AB4B5883276D772A29D431AA68414 /* CwlDarwinDefinitions.swift */, - B43027225C56E595F5E913D502663CAE /* DSL.h */, - 3131FE971C2724941C7A8D2FA70F15E0 /* DSL.m */, - BBEC25DC81B1ABDCB21C52F89DA8A509 /* DSL.swift */, - 95FD775142302578A706350EF902E19D /* DSL+Wait.swift */, - F3F88767FB9DAAE2147BA4AFC0F324D5 /* EndWith.swift */, - 3A9AF09A2BEAEBA835B01672295C3993 /* Equal.swift */, - C61C62CBB65B867F80D32CF5E6A0FFE8 /* Errors.swift */, - 68EAD1FFD6003414DAD602C06B759DB8 /* Expectation.swift */, - 8D149BB26C33A57D55049C3C3D440A74 /* Expression.swift */, - 1EE2FBEC0F4C6DB320F908FBDE43951A /* FailureMessage.swift */, - 4C675C0A74C682A44C4E08772DA6F3B0 /* Functional.swift */, - DD90D2AB53FA33B7CBDE9113E1BAFAD9 /* HaveCount.swift */, - CA2C25F591391F4A8A267326178CE596 /* mach_excServer.c */, - 60282D96FD06BDAC343AF6E6E86F8673 /* mach_excServer.h */, - AE0ECAB8F86782C26B2920BF87A56CF1 /* Match.swift */, - 1BF3FA788E8E5602FEE9A5F090EE93C6 /* MatcherFunc.swift */, - 525BBAE5E1D5FBF64B9826C4092AEDF1 /* MatcherProtocols.swift */, - CC711F7CD1CA11D44C4CAFA7A36C0572 /* MatchError.swift */, - 83EC45B0515EC5AA0B8BEE99D3A98DC7 /* Nimble.h */, - 86F75BCD0221A6D3B29AA45BD76A4FE8 /* NimbleEnvironment.swift */, - 5513B8FA21F53EA856639800CCDEDB4F /* NimbleXCTestHandler.swift */, - 6A9222DCDF1EAEA433A8C04E7FB723E6 /* NMBExceptionCapture.h */, - 1B6630E2BCC0325A3B9010075A6EA253 /* NMBExceptionCapture.m */, - D61929A5ABE4042C09417168DF233F3C /* NMBExpectation.swift */, - 978F38FE83D29E7EF9C4E95C1BADEB6C /* NMBObjCMatcher.swift */, - 318B8F2DB12388587F176B1280DCC748 /* NMBStringify.h */, - 75327AB63E4F7E973B826E8D33D0A655 /* NMBStringify.m */, - 1FB1C45406525141D43BD202BFD4601F /* PostNotification.swift */, - C06DE4D1DD0630A97C784AA835602D8D /* RaisesException.swift */, - 5D004E53E1F05AD0B9634080BFE4E507 /* SatisfyAnyOf.swift */, - 136AFA9689B711E029B581C792CE3A0E /* SourceLocation.swift */, - 4D4F870392098A336DBBE73DB36D7565 /* Stringers.swift */, - 0FB4B0C151C53589DDA9F00F0030A6E4 /* ThrowAssertion.swift */, - D75727C08605433E0C5B8DB8B3E188B8 /* ThrowError.swift */, - 77CC4DB011DDA939C0C72968B477901F /* XCTestObservationCenter+Register.m */, - A5EF0CDA05BCCF5E5B180CA6B9AA9A2E /* Support Files */, - ); - name = Nimble; - path = Nimble; - sourceTree = ""; - }; - 1659A85B545CDE916DE35420635F7ED8 /* Support Files */ = { - isa = PBXGroup; - children = ( - 4F470FA82B84E31947213CEE002EE612 /* Info.plist */, - 3350808D8DA58BD08215D753B72B13CC /* RxTest.modulemap */, - 6D61230AB12E85F7216633A581A8247F /* RxTest.xcconfig */, - BB7586E4448903466B3CFBA9B32EA75A /* RxTest-dummy.m */, - 4A60855035ED5F2D12CDC72AEF2946C7 /* RxTest-prefix.pch */, - 96BBA5CDAC52B30D246E512DD3D26532 /* RxTest-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/RxTest"; - sourceTree = ""; - }; - 18BEB4402389AFF257C691C54358AA24 /* Support Files */ = { - isa = PBXGroup; - children = ( - 61C9F8D486A8FA5BF2BF5FAAD0A86557 /* Info.plist */, - 316F8E7FB83F1A5CC5A658AFFB427E63 /* RxCocoa.modulemap */, - 2AF62868E365F049ADBB266DD2924B64 /* RxCocoa.xcconfig */, - 9BFE207BAB34C549F199FDFFB6798281 /* RxCocoa-dummy.m */, - 96FABFEB04483364161939DB70C05606 /* RxCocoa-prefix.pch */, - BB068DC0F039D5F81258E7C270B36CCB /* RxCocoa-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/RxCocoa"; - sourceTree = ""; - }; - 1DAF96EEEE6FF5D9FC694D6CF3F5B0AE /* RxRealm */ = { - isa = PBXGroup; - children = ( - 423080DF5659C248A1ADF36D9ACF9BA9 /* RealmObserver.swift */, - BC8979BACCB986B1895235C7A8862251 /* RxRealm.swift */, - 317E16908A4A8CF32C1AB7516B86E750 /* Support Files */, - ); - name = RxRealm; - path = RxRealm; - sourceTree = ""; - }; - 216BC3FD88C3D53231858C7AE85CDBAB /* RealmSwift */ = { - isa = PBXGroup; - children = ( - 0D6BF12283E0B530F91741DBA29B1319 /* Aliases.swift */, - 2C814A8BF612F67498C6C2BC34E6C2C4 /* Error.swift */, - F62981846211AB9A56BC9DE108E81476 /* LinkingObjects.swift */, - 53D068AA6C7568A79DB34061E4DA3E5B /* List.swift */, - A8C627F09111D781B1E5806663B4BA35 /* Migration.swift */, - 1CC63AB5E7C63726A6DB408222F484CF /* Object.swift */, - ECDF6CF651A49944A8B69F2691D7DCC7 /* ObjectiveCSupport.swift */, - DD10538785F57950A30FC93BB2235A23 /* ObjectSchema.swift */, - FCE55DB8FB0AB2E413DB6F50F46406DE /* Optional.swift */, - F37EEEA6DF79DE035BF9694CDE83749D /* Property.swift */, - 7F6043C2988ECD8BBC9D2B2371E02E8A /* Realm.swift */, - 6B536283BDC4C41292388887CD7B37AA /* RealmCollection.swift */, - 04EE35D0725F8F90CC75E788D19568FB /* RealmConfiguration.swift */, - 428E0EA94CAF38B592D33171034CAF3E /* Results.swift */, - C22CE36AFE7517678FA6060BC4A56D66 /* Schema.swift */, - F44C242A3E765B64B0946BF3074BDE73 /* SortDescriptor.swift */, - 9263B3A050D8F0206EE9674A65052154 /* SwiftVersion.swift */, - 184EF4E324F18EA3D7A22187D6194E83 /* Sync.swift */, - E79585EC3A1B2374F751C0A5CF376D96 /* ThreadSafeReference.swift */, - CB9CAA431B02149E5221455001A1AE31 /* Util.swift */, - 76C448C43EBC63608B6050E6E87DD983 /* Support Files */, - ); - name = RealmSwift; - path = RealmSwift; - sourceTree = ""; - }; - 21FCEFCB078EEA9E7285B33C355A135F /* RxCocoa */ = { - isa = PBXGroup; - children = ( - EF88472545EDF4E24240E50B66C44174 /* _RX.h */, - C3258E2CF7232311543129625A67DF48 /* _RX.m */, - F828C4F53AC4B02E2057C7DEE457BE8E /* _RXDelegateProxy.h */, - AE208C7710B81B7DB545B3C47BCE671A /* _RXDelegateProxy.m */, - AB2960AD97002F5514AAD4B25EA9593B /* _RXKVOObserver.h */, - 763EF4959E0C4B33459C3D414E0DFEEE /* _RXKVOObserver.m */, - 5AAB6D50DAC127911F2AE131727672EE /* _RXObjCRuntime.h */, - B0E48F61B0569430EAB76A9301709383 /* _RXObjCRuntime.m */, - 44C2C85A52F1FAE6B3B17CEB044A4AB7 /* Bag.swift */, - D69A9FD89F7773AC0DE5317CB4690A3B /* ControlEvent.swift */, - FBBF44D77690F11DE05093230CB4E696 /* ControlEvent+Driver.swift */, - 1CB5CB6AC67FFD9DA0B592F391800792 /* ControlProperty.swift */, - E5EFD66E6BD218495B48E96BA9B3CD2F /* ControlProperty+Driver.swift */, - F764790299E276D41B15B956E08DF02F /* ControlTarget.swift */, - 6BB3A3210608688670C20F8B7E8D0E2C /* DelegateProxy.swift */, - 46B11D9ED9998049254C57399B0671D3 /* DelegateProxyType.swift */, - 2673F80412A2AE057049C4103503CA74 /* DispatchQueue+Extensions.swift */, - E74965087A941114772D04B6C982AF19 /* Driver.swift */, - 1E182F088496B1909960A9BBE421C72F /* Driver+Subscription.swift */, - F02E16D11D5BE1429FC72E907936E62A /* InfiniteSequence.swift */, - E2005A2F0B8500820258925CE1765C34 /* ItemEvents.swift */, - 5DB873EE8F7C5FD34C4C6578A1072B9F /* KVORepresentable.swift */, - A313D72946CF65A31A5271AF35621830 /* KVORepresentable+CoreGraphics.swift */, - 2A8B7793D5448EE99219A35DA19CDD5A /* KVORepresentable+Swift.swift */, - E1A560DF846C100753A99E9A04F177D9 /* Logging.swift */, - 4A78EA70789CFED1187666227105C133 /* NotificationCenter+Rx.swift */, - 99FF802CC6AA32414FF845B4E422D063 /* NSLayoutConstraint+Rx.swift */, - 04755FFA86DD547A2EC9D4A3832B0B2C /* NSObject+Rx.swift */, - ACC48F782F7667876412E9401C618C48 /* NSObject+Rx+KVORepresentable.swift */, - D640BC3EB4D9032D0A4F36670BCCA86E /* NSObject+Rx+RawRepresentable.swift */, - 8DCD9A35F302AA2A689F93A69C685B0C /* NSTextStorage+Rx.swift */, - B8381718F65F50C2F878283CCC802FA6 /* Observable+Bind.swift */, - A00C7D904474DBCC0A4DCE1F5442CDAF /* ObservableConvertibleType+Driver.swift */, - 2E7B7DF0DDDC3AA6C08D571EF57C4BB4 /* ObservableConvertibleType+SharedSequence.swift */, - 6E33742CD0E675E708288D4EB15A67EE /* Platform.Darwin.swift */, - 845D0EA8611F2FB24CD712D978D6ACFA /* Platform.Linux.swift */, - 5FC1312795717FDCEFC84ADD8B8E0A2C /* PriorityQueue.swift */, - 49A565AF840A908AD4DF2C8FF88266D6 /* Queue.swift */, - E03AA51CE98C0E25831A651363252F01 /* RecursiveLock.swift */, - 7598CF4B5C61DDA6CBB4D59CD0BAA801 /* RxCocoa.h */, - CF0EB61780DB161C1ABC46C9C6E08ED2 /* RxCocoa.swift */, - 25B4A84FDB33A5C82AF22FA7ED7101A5 /* RxCocoaObjCRuntimeError+Extensions.swift */, - 8228DD6D4CB3FE2917439A9502282852 /* RxCocoaRuntime.h */, - 37D650E2738F6CA0AEE9538D2212801A /* RxCollectionViewDataSourceProxy.swift */, - 2B6FAEB331EB95EA708A46D197CC4168 /* RxCollectionViewDataSourceType.swift */, - D75334EF2399AE4F713E8C34AEEC1A4D /* RxCollectionViewDelegateProxy.swift */, - 14F213114CE9516889AF0C47CCFC8644 /* RxCollectionViewReactiveArrayDataSource.swift */, - 3B781C46CC5C0FC0A551DA04BFF6D6A3 /* RxPickerViewDelegateProxy.swift */, - FA831E78C82E138DCFADB062EB62CC22 /* RxScrollViewDelegateProxy.swift */, - 4AA2D939D8E8D6AE9DA9F8D7B271D82D /* RxSearchBarDelegateProxy.swift */, - E1A9BF9FBC00FE12E25776D24AF8433E /* RxSearchControllerDelegateProxy.swift */, - D5D15835D0AB5E9B05210AB236D8952B /* RxTabBarControllerDelegateProxy.swift */, - 02C8097609AA8B6959CB5B30CD203514 /* RxTabBarDelegateProxy.swift */, - 83E711AC617EE79D5719C77D84568D61 /* RxTableViewDataSourceProxy.swift */, - 2F82EA101821C4410024CEB3AB1C46F3 /* RxTableViewDataSourceType.swift */, - F7FF34C24A309A56D5E558BFC9DC5EE5 /* RxTableViewDelegateProxy.swift */, - 9C3D32B58B6052BC084EEA9DEE3384E5 /* RxTableViewReactiveArrayDataSource.swift */, - 6F2192C9597B9EFD767645E7DC17ACAD /* RxTarget.swift */, - C6CD153809273B5A278677D70BFA8C28 /* RxTextStorageDelegateProxy.swift */, - 9D48431617F5E01019D3D46F2F5FC2F1 /* RxTextViewDelegateProxy.swift */, - EAADEF34790ABC1117C0FCFC197FBD03 /* RxWebViewDelegateProxy.swift */, - 6CAE3B5E6A9B5CB5DA3D2E7C16549BC9 /* SectionedViewDataSourceType.swift */, - 1AF5E8E6E9B553B5DC77EDB7153C5267 /* SharedSequence.swift */, - 40A91CAD49F801AEF2040179CF6FB9D0 /* SharedSequence+Operators.swift */, - 5C863F1B3DEDA62678903E6864DB63F2 /* SharedSequence+Operators+arity.swift */, - CBC006F1F0DBD8AC1A0B890646852B4B /* TextInput.swift */, - 453FAF80D4E039A7FE62AFD5A8240609 /* UIActivityIndicatorView+Rx.swift */, - E03F4258E17C30AB8353F67FCAC54713 /* UIAlertAction+Rx.swift */, - C1FE552BECE0FE2FA20EF5366E64F63B /* UIApplication+Rx.swift */, - 7B3E77E11E365F562B26CE30D3CC144B /* UIBarButtonItem+Rx.swift */, - 9B9F9F8D327301B5D0920362F19116D9 /* UIBindingObserver.swift */, - 18CF0CACF92757CC2590C03214C9CC7E /* UIButton+Rx.swift */, - 74FE60E9D19651328FED8B65E315257E /* UICollectionView+Rx.swift */, - 4E9F674E5D41EFBB3474C816A789F644 /* UIControl+Rx.swift */, - 23E3CA0E92CF4E32082E5FB0CD7632ED /* UIDatePicker+Rx.swift */, - 449223001FD790A403F78B3E34186EF5 /* UIGestureRecognizer+Rx.swift */, - 3BFA5EF6BB4E0E297CB404369B9818EB /* UIImageView+Rx.swift */, - 054A91F59859D171BD523D096B163ED3 /* UILabel+Rx.swift */, - F8B1D24C4BC6E7A939373F908196AB54 /* UINavigationItem+Rx.swift */, - 19EA56528221F157A574C7B4B1D7112D /* UIPageControl+Rx.swift */, - 290E91EC5CB09B9DE450FDC4F42BB6BE /* UIPickerView+Rx.swift */, - A9873284E3734D478A44DB5469041A77 /* UIProgressView+Rx.swift */, - B9046C10DF3A711A09325597D815E642 /* UIRefreshControl+Rx.swift */, - 263D4DB701F0F01734069546DA40E9D4 /* UIScrollView+Rx.swift */, - 9272BB7EC05AAB42EAEEB81CB1674CE7 /* UISearchBar+Rx.swift */, - 3FF39F3BD1D678CA9BACAEEFD39DCB8F /* UISearchController+Rx.swift */, - AD07A521480F7B304630DBB4FBE34315 /* UISegmentedControl+Rx.swift */, - C12E18EB9076B86DCB54CB5CEA607A82 /* UISlider+Rx.swift */, - A4D7EAC9D7DDECFF26379A565A656DC8 /* UIStepper+Rx.swift */, - B7ACEB311ECFA84D9FD17B6E87C05CFE /* UISwitch+Rx.swift */, - A7E38F7A5F6F7B7F221ACC5C0AAB201F /* UITabBar+Rx.swift */, - 8FAD1573476230902C96233E3146AE68 /* UITabBarController+Rx.swift */, - D82F882024EF9E73620A4FBB0D4DA834 /* UITabBarItem+Rx.swift */, - 9CDFB51C334E9637BB0AAAC5E7055307 /* UITableView+Rx.swift */, - 9627E7DD73D5851D73ABDA76F10A27F2 /* UITextField+Rx.swift */, - CB56B533DB96A224DFABAED89D4D96CA /* UITextView+Rx.swift */, - 82E590C4034DA657F3FD05E72AD2CF09 /* UIView+Rx.swift */, - D28F082D05322822F974934BEAFC970F /* UIViewController+Rx.swift */, - EA125B544144AE7113CA11C137B5370E /* UIWebView+Rx.swift */, - D0B99A3F832E6114A5FA74DDC29F5B76 /* URLSession+Rx.swift */, - 4004319B47C10CDA4EF68FAEFE680BF7 /* Variable+Driver.swift */, - 35D129172F068D27EA24649C6EC33640 /* Variable+SharedSequence.swift */, - 18BEB4402389AFF257C691C54358AA24 /* Support Files */, - ); - name = RxCocoa; - path = RxCocoa; - sourceTree = ""; - }; - 317E16908A4A8CF32C1AB7516B86E750 /* Support Files */ = { - isa = PBXGroup; - children = ( - E1E60499526BA32B339B2EE534752CB9 /* Info.plist */, - ECC90D48452775CBC3EA19EDC518EFED /* RxRealm.modulemap */, - 9FC9E366D9C32EAEDFB1AE49EB284463 /* RxRealm.xcconfig */, - 8A2FDB31E4EA5A36354AD7345532825B /* RxRealm-dummy.m */, - 0B204EC96A756B07F25AF71D7F3A0DB6 /* RxRealm-prefix.pch */, - 737B50270378DB7DB4F3948B4AF9F59F /* RxRealm-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/RxRealm"; - sourceTree = ""; - }; - 3CFA2DE9112E4EAB6C54A0AF2DCF7738 /* QueryKit */ = { - isa = PBXGroup; - children = ( - CC56074901EBEF20D23A74EAE9253DDD /* Attribute.swift */, - A1157481D2F368CAF1F9B68ACA0572CC /* Expression.swift */, - 4ED17F31DFDE3B6E0C33C6629E6430F0 /* Predicate.swift */, - 6EBB488FCFB93905CF0BFE1F0512968C /* QuerySet.swift */, - 9AF941F3C8CC0E7B773DB318A6D2A2CB /* SortDescriptor.swift */, - 8DA78B4F08DE9F7849E77FAAB764CD45 /* Support Files */, - ); - name = QueryKit; - path = QueryKit; - sourceTree = ""; - }; - 3FF7BB912C508149CD53476EADA57DEF /* Pods-CoreDataPlatform */ = { - isa = PBXGroup; - children = ( - 6E4364B3BE46946A20F3237CDDBD3056 /* Info.plist */, - A1653BBD0DE3ED52FDF86C9C59A70B12 /* Pods-CoreDataPlatform.modulemap */, - 25F6FE9E90ADD5EFBDC9180B8712045C /* Pods-CoreDataPlatform-acknowledgements.markdown */, - 3E7EA59D83453AA5D9B1CA183A6A322E /* Pods-CoreDataPlatform-acknowledgements.plist */, - 766C72882D45E69565506BFCE1205BF5 /* Pods-CoreDataPlatform-dummy.m */, - F54B3455EB7F4E95E92F49FB557459BB /* Pods-CoreDataPlatform-resources.sh */, - B5440177F5179769B6F62D590A26E693 /* Pods-CoreDataPlatform-umbrella.h */, - D339EB8E0C5AD7056277F1B708D49A0E /* Pods-CoreDataPlatform.debug.xcconfig */, - 16328397D269057A1C0D76E728ED85F5 /* Pods-CoreDataPlatform.release.xcconfig */, - ); - name = "Pods-CoreDataPlatform"; - path = "Target Support Files/Pods-CoreDataPlatform"; - sourceTree = ""; - }; - 58018A894C5B74E42B00A6D76F385654 /* Support Files */ = { - isa = PBXGroup; - children = ( - 224C1458C0153EC325A06AE9F8224501 /* Info.plist */, - 43BCABD2C41BE5F24FBFA0F5A79F790B /* RxBlocking.modulemap */, - C29ABA36121FE751CD24C2CB2CA2CCD0 /* RxBlocking.xcconfig */, - 8BBB7E0B4D592B340B7627F9E7E47938 /* RxBlocking-dummy.m */, - 9E50327A23EF351887CC4AD8EE17D139 /* RxBlocking-prefix.pch */, - 7C9B1F72E6A71B6B7A163608E125535B /* RxBlocking-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/RxBlocking"; - sourceTree = ""; - }; - 58FBAA7F8172B01D8091A19469D00E37 /* Frameworks */ = { - isa = PBXGroup; - children = ( - DA0217A5F5ABB713A825C6E4B8A0E649 /* librealm-ios.a */, - ); - name = Frameworks; - sourceTree = ""; - }; - 65420CAAA16A4F5A71F5F90258272FAA /* Frameworks */ = { - isa = PBXGroup; - children = ( - ADFAB4721B073AD66157837FAD1C4BF7 /* Realm.framework */, - 53CB3018CC908AE0B39B5FAD841C02E4 /* RealmSwift.framework */, - EC779AAB6131AEB402A39824AB090711 /* RxSwift.framework */, - DF7A76EBED6C104092ECDB01F15C99AD /* iOS */, - ); - name = Frameworks; - sourceTree = ""; - }; - 704F7FCEF333080BD9D009B76ABE0173 /* RxTest */ = { - isa = PBXGroup; - children = ( - 2B52F189427B8938EFEBECDF3BB41E62 /* Any+Equatable.swift */, - DA91C5789039F5EE1DF36450BC6FCEA7 /* Bag.swift */, - E1E6547B9D6243D4CF71A0C77BE85465 /* ColdObservable.swift */, - 96D0A3DC63B077FB0B3093A31B3F420C /* DispatchQueue+Extensions.swift */, - CC5FAA30414B06944F6763C7A849859A /* Event+Equatable.swift */, - 85F7317AA13674AF45FF061C2B34AD65 /* HotObservable.swift */, - 1D6403B29CFAD6729212DED8DBCB98A3 /* InfiniteSequence.swift */, - 8C79C28717823D848E9B9A46EDC8E820 /* Platform.Darwin.swift */, - AE73BF208E7B38E1BA4BCD70BC7FF518 /* Platform.Linux.swift */, - D2A1FB18B7E477EE3BD21E3FFE700B50 /* PriorityQueue.swift */, - 4ACEDAB72DD6F89B6EF216AA2E234CFD /* Queue.swift */, - C05DDD4799193E1D553A931B33F90393 /* Recorded.swift */, - 87FAB44ABC252FE3A6CA52CAEE54FF41 /* RecursiveLock.swift */, - 82D866DD022BC145686ED68C49589590 /* RxTests.swift */, - 8CC994EB560618D04579BC84C503DF01 /* Subscription.swift */, - 1D72F989F2C18CD5E8AFFABF58C569A6 /* TestableObservable.swift */, - A3E73C12117ABCB9685A1573BB44D10A /* TestableObserver.swift */, - 4B55EA40F4928799825E9C22AD36D1C1 /* TestScheduler.swift */, - 6EA742BECA70255895A57D401A3A6CCD /* TestSchedulerVirtualTimeConverter.swift */, - A9AB4E3B5E6E0EA3B8B9B99DF46CD96A /* XCTest+Rx.swift */, - 1659A85B545CDE916DE35420635F7ED8 /* Support Files */, - ); - name = RxTest; - path = RxTest; - sourceTree = ""; - }; - 740ADC8FB087E48016F19A195012A77B /* Realm */ = { - isa = PBXGroup; - children = ( - 0AEEBAA5CB753B13E23FAADB71045F6B /* collection_change_builder.cpp */, - 2DF8F0E2233CD8F6B901DFE255E381F7 /* collection_notifications.cpp */, - C3993AF868F7A8EDD1EAB67CF1CD28C2 /* collection_notifier.cpp */, - C76A953946D58DDBEE78786C00AE05D6 /* external_commit_helper.cpp */, - 8C155F3210E736DC8F707C661517CA3C /* format.cpp */, - E7973DF3A2C40EE048550AECE194E1D3 /* index_set.cpp */, - EEC86B6A1857601BF1A22F485299EFDB /* keychain_helper.cpp */, - 119DC06AE581F74CB5C3B6B890F896E9 /* list.cpp */, - 6000C7FD72123C0DF8EC0819EF0F0D2F /* list_notifier.cpp */, - D18AE140B42060652DA722A18B4581D6 /* NSError+RLMSync.m */, - 09A9B00781747A780375A164E3453854 /* object.cpp */, - 9E9240D8A27CB9ECF337F608D036AEB8 /* object_notifier.cpp */, - 2C4412760BEC0C7BD9C1C49E318C4339 /* object_schema.cpp */, - 218C350B11A80A2817C1141FF95F54A1 /* object_store.cpp */, - B6261ABB26A06A5A78C1882286643E8C /* placeholder.cpp */, - FBC32FCE9A7D8DB312E6DE40B882E6C5 /* realm_coordinator.cpp */, - EE0CAA07155179BF3F081117D6587F8A /* results.cpp */, - A3D7B0334A9F9928FF52C6050967CD30 /* results_notifier.cpp */, - 9EE14CD66DEAC50B04FB05EC9EE4D7EE /* RLMAccessor.h */, - CE31D89F2C8DB6F7C543B33758BE8144 /* RLMAccessor.mm */, - E1D07FB8A794E8FB2ED5630ECA8E9CC1 /* RLMAnalytics.mm */, - D481473374DD16525B37E0B777FEE151 /* RLMArray.mm */, - 9DAECC01EADF40818647F8793CF4BBF7 /* RLMArray_Private.h */, - 475FD510C5E88D7756730D9BE72F0434 /* RLMArrayLinkView.mm */, - 53AAF25454CBD69509B3B72C6CB097E5 /* RLMAuthResponseModel.m */, - 87A68AFF74DF578CD9C34F9CD082051C /* RLMClassInfo.mm */, - 55058D00734EF79A01FD662D16CA5CEA /* RLMCollection.mm */, - DEC184AC85553054659581B7240F098D /* RLMConstants.m */, - 51E80CDB97E97899BD0038B78302ADB3 /* RLMListBase.h */, - BD0D3D502C52C530869CB471A41E1EB0 /* RLMListBase.mm */, - 029892FACEB725CF1225E2F2BBB181AE /* RLMMigration.mm */, - 79587E31E603FA8B4DF3FABA69304C71 /* RLMMigration_Private.h */, - 17880DD8A71DD766D4C5BF068866C398 /* RLMNetworkClient.m */, - 9949BF61505A3724B810B5CFFEE9CED4 /* RLMObject.mm */, - D60C73374AF1C9A11387557CCDE4485F /* RLMObject_Private.h */, - 32BCBA134D69CD39AE23D5A005F035E2 /* RLMObjectBase.mm */, - 9604E66751F69896AD323181D092CAF3 /* RLMObjectSchema.mm */, - 38039087DC23815CCBF407685CADBECC /* RLMObjectSchema_Private.h */, - FE2CCA9264024E06109045959D1EC7E3 /* RLMObjectStore.h */, - 41759AABE84C08A37113D6E35E9A53EE /* RLMObjectStore.mm */, - 39A3F66ED64B7DBFE07F75C4E93FBCEC /* RLMObservation.mm */, - 256AF63FA29E54ABA829F3EB9D900316 /* RLMOptionalBase.h */, - 996D4E51556FD2FC3D61A7136E60ABCD /* RLMOptionalBase.mm */, - B36C40EE40CB92DDC99B65592FF6BF0F /* RLMPredicateUtil.mm */, - 8147EA764021C40A6F41AAFD1D5BD9CE /* RLMProperty.mm */, - FC207590A5FC79B5F2876F39287DDD34 /* RLMProperty_Private.h */, - B54E0D7C11D62423A37856C07A5503D1 /* RLMQueryUtil.mm */, - BE87C88221EBDF94A4D0CD98E637BE5B /* RLMRealm.mm */, - C5121AA168A2C53B33839BEFD2CD6751 /* RLMRealm_Private.h */, - B302632112607AC79A5DB7385B3BCCBB /* RLMRealmConfiguration.mm */, - 00BC4A17CF3F1323C69BB2FB47C342D6 /* RLMRealmConfiguration+Sync.mm */, - C555FD10571F74DAE34500F844CB34CA /* RLMRealmConfiguration_Private.h */, - 248B75378699A4E685CFDADA3B8CAC41 /* RLMRealmUtil.mm */, - 305D2C9A4B4DB4B1974D364EF4C229C3 /* RLMResults.mm */, - DE1A575C17A110965C2E6FB43F4D1E53 /* RLMResults_Private.h */, - 061B315CD14BB732ABE81D3E9A24E1F6 /* RLMSchema.mm */, - D8A20375F4A84061C6B4E3EF2DAB140F /* RLMSchema_Private.h */, - FEB18B36D3EE307D7CA204E17B0EEEFA /* RLMSwiftSupport.m */, - 0D67BEF4D9D22A8A0DFE2543AE09F23C /* RLMSyncConfiguration.mm */, - 85D3B261B046352E80E38C49E4517546 /* RLMSyncConfiguration_Private.h */, - 67B67D32CD6BA52879F9362A323F74EE /* RLMSyncCredentials.m */, - 65E03150924581C5CDF3FF73CEDD4C44 /* RLMSyncErrorResponseModel.m */, - 827829900FDED975E2E0C53B2EDC8A63 /* RLMSyncManager.mm */, - 60E0AEFD6A0696202E1127E8C6189CD6 /* RLMSyncManager_Private.h */, - 6D2238DF1C631E9687D1D0067F3A0943 /* RLMSyncPermissionChange.m */, - 0BFB4F3168E45943ABFB5A3C6F1095BB /* RLMSyncPermissionChange_Private.h */, - 3007808C7A2C2295B71CB84F98CB8788 /* RLMSyncPermissionOffer.m */, - A99D0A764F4145F96DCA40079603C8DA /* RLMSyncPermissionOffer_Private.h */, - C3F5BFCB6E3E5ECB905ED65B33EC661E /* RLMSyncPermissionOfferResponse.m */, - 41A4EF93D766224EFFDA68623C54A7AF /* RLMSyncPermissionOfferResponse_Private.h */, - CFC2CB297B7568B9481BA1075998CB58 /* RLMSyncSession.mm */, - B5C37C815B704CE983D68F11076255DC /* RLMSyncSessionRefreshHandle.mm */, - B9F784C757F4866A2C027B696446EACF /* RLMSyncUser.mm */, - 8BF7DC2FDBE199EDBEBF2DAF7E1A9DF2 /* RLMSyncUtil.mm */, - 6031907F5FB40AC1819F8F4D5DD23CB8 /* RLMSyncUtil_Private.h */, - 137E976E469CFB6D8C628C752EEF26AB /* RLMThreadSafeReference.mm */, - 54168AB68346D9C62335D17484B6BD5B /* RLMTokenModels.m */, - FD14D4DAA5A63334AB7CF75B4787CF43 /* RLMUpdateChecker.mm */, - DD70AF42B51227529EC85C61C290A6E6 /* RLMUtil.mm */, - 347E05CBC887B0FDE925DD40E560A429 /* schema.cpp */, - 9D40B8EB25FE62AA6D6D3D2D48BDD0D6 /* shared_realm.cpp */, - FD46E1B417F0A908BC72E6198B90EAFB /* sync_file.cpp */, - 0F57C90608F519FFA9A54FE5033F63FC /* sync_manager.cpp */, - C25316696EA3FD3FCBCCD3E7E5E60DF1 /* sync_metadata.cpp */, - 82CF0AC20AA633380BB32EFCD43569A7 /* sync_session.cpp */, - 75150084CD6CFCF2F4A99BA5E7580F35 /* sync_user.cpp */, - D20E2A97038719D7BEFEF436CB51AC6B /* thread_safe_reference.cpp */, - 3577AA9372DD24B3C3606CB2299856DC /* transact_log_handler.cpp */, - 365A23A9D17A8ACEA664210B80849378 /* weak_realm_notifier.cpp */, - 58FBAA7F8172B01D8091A19469D00E37 /* Frameworks */, - 9B05E7F0437F02832EA5746B93A11E04 /* Headers */, - B42B870C54237C97997CAA078E2E4D41 /* Support Files */, - ); - name = Realm; - path = Realm; - sourceTree = ""; - }; - 76C448C43EBC63608B6050E6E87DD983 /* Support Files */ = { - isa = PBXGroup; - children = ( - 386DBF2AF0D86DCC5DE2C9DD0ECC95CB /* Info.plist */, - 64874678E2E994CD7DABE98B323BDB65 /* RealmSwift.modulemap */, - 92C78267D5E8A49298BCA74BC43ED918 /* RealmSwift.xcconfig */, - 119538EEE489B3E27AA49D1FE48283F4 /* RealmSwift-dummy.m */, - 8BAC6E491F8BC026534F1C45737643A5 /* RealmSwift-prefix.pch */, - E96371DF4BBAA27834C93DAEA5F0DD3D /* RealmSwift-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/RealmSwift"; - sourceTree = ""; - }; - 7B9FE2BD0158B82E2CFE91D6F19D6F81 /* Products */ = { - isa = PBXGroup; - children = ( - D69F3BF5A79C4983DA88212C4D69DD15 /* Nimble.framework */, - 53E45728C9B84C40AB189F1F078A6367 /* Pods_CleanArchitectureRxSwift.framework */, - 147B789AB94E510D2BF6BB8A33E9624E /* Pods_CleanArchitectureRxSwiftTests.framework */, - 197A704378E5C9A322E08AC37188B3B8 /* Pods_CoreDataPlatform.framework */, - 3240D2B858783CF606E7BF315F7A6B41 /* Pods_CoreDataPlatformTests.framework */, - F23B137F530D39D6691F56296C847AAC /* Pods_Domain.framework */, - 60FF3B71AC7101C80B214BD79D4CA436 /* Pods_DomainTests.framework */, - D1617E4A776B209644FAA060C19A9AB4 /* Pods_RealmPlatform.framework */, - B650171DA812528FC08ADDDA2C7FECB4 /* Pods_RealmPlatformTests.framework */, - 61030C41963A862333D5C9379AA0CD4E /* QueryKit.framework */, - CFF1CE5B512B5B4B43F9B47CA3639948 /* Realm.framework */, - 995BA9212A352337D7E710CE8C1FAA1E /* RealmSwift.framework */, - 174DE8C4304E4DE07714C32E3A792E71 /* RxBlocking.framework */, - 67115DA69219E676AA2E904D1BFB0425 /* RxCocoa.framework */, - FDE46C6CAA2FBECD5CA170EEA7ACE4AC /* RxRealm.framework */, - 58BCF5F062C8E6C62F884D1209C368A0 /* RxSwift.framework */, - 3E0AFF0058AE0D7DBDE696D463411122 /* RxTest.framework */, - ); - name = Products; - sourceTree = ""; - }; - 7DB346D0F39D3F0E887471402A8071AB = { - isa = PBXGroup; - children = ( - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, - 65420CAAA16A4F5A71F5F90258272FAA /* Frameworks */, - CA026CCD0D6F210F279230DF2A77AAF1 /* Pods */, - 7B9FE2BD0158B82E2CFE91D6F19D6F81 /* Products */, - B62B589513301D1353368A5EB97806EF /* Targets Support Files */, - ); - sourceTree = ""; - }; - 88972662872007E568A44000A9EBB949 /* Pods-CleanArchitectureRxSwift */ = { - isa = PBXGroup; - children = ( - E87990ECD2EFCEE49E762C8BF8548B18 /* Info.plist */, - 487C60B08B1A939CB47EC4D53043DB9A /* Pods-CleanArchitectureRxSwift.modulemap */, - F74C17B54E2A32A16313F180719BCB4D /* Pods-CleanArchitectureRxSwift-acknowledgements.markdown */, - 61D417F6E7B599D4140BF59F1A7C0ED4 /* Pods-CleanArchitectureRxSwift-acknowledgements.plist */, - 8CCE033306547A0E208151520F52A803 /* Pods-CleanArchitectureRxSwift-dummy.m */, - 36028945D70850B4DA139519DA759A8C /* Pods-CleanArchitectureRxSwift-frameworks.sh */, - 30A2AD49ADBEB510AAE92AECA5A3E518 /* Pods-CleanArchitectureRxSwift-resources.sh */, - 76F609DEF8E2FE7A4C17AD233F295E74 /* Pods-CleanArchitectureRxSwift-umbrella.h */, - 5F2BA74199972EA19E73ECDD991CE244 /* Pods-CleanArchitectureRxSwift.debug.xcconfig */, - B6E898DB323FEB82CD23EEF97B674B41 /* Pods-CleanArchitectureRxSwift.release.xcconfig */, - ); - name = "Pods-CleanArchitectureRxSwift"; - path = "Target Support Files/Pods-CleanArchitectureRxSwift"; - sourceTree = ""; - }; - 8DA78B4F08DE9F7849E77FAAB764CD45 /* Support Files */ = { - isa = PBXGroup; - children = ( - 526D107DEADDC8A7A1884D7D2169343B /* Info.plist */, - 70F75573558C74C5D956088A81ABA583 /* QueryKit.modulemap */, - 5CC1DBAEAA8F292B0AC6B46152333850 /* QueryKit.xcconfig */, - ABF1CEC0AADC895600F3803828C8CAC3 /* QueryKit-dummy.m */, - 250E69A7472F260432F4A1F1B1C42AC7 /* QueryKit-prefix.pch */, - B3A4870B24422E3B82672BBC037886AB /* QueryKit-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/QueryKit"; - sourceTree = ""; - }; - 99352AB56C403EDC83F01CC39D6890BA /* Pods-Domain */ = { - isa = PBXGroup; - children = ( - 443F33B06112DC634060BEA1738DF92D /* Info.plist */, - 20EE488911C00166EFE0933D311A49C6 /* Pods-Domain.modulemap */, - 6228AD269FC9D2FD2CBFA0F7BCE4FD82 /* Pods-Domain-acknowledgements.markdown */, - 7317476BA27FBB154B32279BBEA315E5 /* Pods-Domain-acknowledgements.plist */, - 651D0FCCF49CF22AF21FF5640CF0A54D /* Pods-Domain-dummy.m */, - 7DD58885A41DF6D92C8AC75BF36D8845 /* Pods-Domain-resources.sh */, - C93F74F2EDCEBA93D7710BD08CDCB725 /* Pods-Domain-umbrella.h */, - CC1954DF826907EEC9FF1742C99C88F5 /* Pods-Domain.debug.xcconfig */, - 045F751C52CF1B431127377D279309ED /* Pods-Domain.release.xcconfig */, - ); - name = "Pods-Domain"; - path = "Target Support Files/Pods-Domain"; - sourceTree = ""; - }; - 9B05E7F0437F02832EA5746B93A11E04 /* Headers */ = { - isa = PBXGroup; - children = ( - A3B9206E6EAB97E39A1B218C5DC6E21D /* NSError+RLMSync.h */, - D73B8E9DFA10E77D6BBB7C2C0B29A483 /* Realm.h */, - A6587BBA0993061ACD6A225501F6C907 /* RLMArray.h */, - 2952FBF26066799DBB635AE5EE3D6AC0 /* RLMCollection.h */, - 68118C2B1163EF93144146168FBCF4C0 /* RLMConstants.h */, - 19C9139587A0BA340E56221ED8C0BFDF /* RLMMigration.h */, - FA5021148FF213AE082EF2C5A2958FC2 /* RLMObject.h */, - B54E8EE5A67BAF0E3BA65C7AF73361F6 /* RLMObjectBase.h */, - B08D726E62BB67BA300B3BEC98BD0227 /* RLMObjectBase_Dynamic.h */, - AA2358C12FB2240A3DA7703004D3EF17 /* RLMObjectSchema.h */, - 36867BC95C92E2B998AC9B60B3531E00 /* RLMPlatform.h */, - CBE2E0B290CF9163911607C23E090D9C /* RLMProperty.h */, - 05BBFEBBC89AB7495B8AA058F7F2BE9E /* RLMRealm.h */, - E870979F5C62F7A48BBA13C070842F12 /* RLMRealm_Dynamic.h */, - 2738DC94C928353E0D38A5463635400B /* RLMRealmConfiguration.h */, - A1C84A6BF14AB41A9CD563155675C452 /* RLMRealmConfiguration+Sync.h */, - 5F3462BE4A577BA487B2A9108E90F763 /* RLMResults.h */, - ADC6A2DAA3C7B805A6B65430E7FE9A6A /* RLMSchema.h */, - 237D4E8B60CF721ED681A3052F2BECA9 /* RLMSyncConfiguration.h */, - 7AE7B534F16968B523BD7E569F148363 /* RLMSyncCredentials.h */, - DBFD2B4D84BE6F02957AA2D4188E318C /* RLMSyncManager.h */, - 09CA29D163C4A81B573A815A943B909E /* RLMSyncPermissionChange.h */, - F8BAE64E30EA9DF69A3FB3B92FC4D690 /* RLMSyncPermissionOffer.h */, - 8EA94F6951EDBCE65EE3ABA35A6E8F6E /* RLMSyncPermissionOfferResponse.h */, - 4B0E7614E593D71E05DE51065E273B00 /* RLMSyncSession.h */, - D80DAD9DCF476D933384B3CCBA0F4C2B /* RLMSyncUser.h */, - 1D2B9940FB9B64166D596E8557D5A808 /* RLMSyncUtil.h */, - 6ABACBA2C9D315DC47A49C74A8B7C2A4 /* RLMThreadSafeReference.h */, - ); - name = Headers; - sourceTree = ""; - }; - A5EF0CDA05BCCF5E5B180CA6B9AA9A2E /* Support Files */ = { - isa = PBXGroup; - children = ( - EA718E5A284E4A6A87F0DFB46E8440E9 /* Info.plist */, - CB4593CE90B1844E45C9EB2F9A1617D5 /* Nimble.modulemap */, - 807776598A55DA33235962FD69086035 /* Nimble.xcconfig */, - C965109204C6C72427A9D61E931164D1 /* Nimble-dummy.m */, - A5D0298759E5DFA638C73ACB659BA696 /* Nimble-prefix.pch */, - 82FEAFA0FC4D69B31FDE29DB838B3CE7 /* Nimble-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/Nimble"; - sourceTree = ""; - }; - B42B870C54237C97997CAA078E2E4D41 /* Support Files */ = { - isa = PBXGroup; - children = ( - 58D838E0C989E43553DA5E09B9FF5750 /* Info.plist */, - 9DA27DE4949B925372DA7B65665C783B /* Realm.modulemap */, - 3DBCFE9863A0A6B6210470BB4D337978 /* Realm.xcconfig */, - 23AA7BD6E4CBCFC8AFA0A6E8BBEDF33C /* Realm-dummy.m */, - C3F0BD38330F99A377C46B21C0210793 /* Realm-prefix.pch */, - ); - name = "Support Files"; - path = "../Target Support Files/Realm"; - sourceTree = ""; - }; - B62B589513301D1353368A5EB97806EF /* Targets Support Files */ = { - isa = PBXGroup; - children = ( - 88972662872007E568A44000A9EBB949 /* Pods-CleanArchitectureRxSwift */, - E6CE6211AD6DD49E7B5A88E0918D2042 /* Pods-CleanArchitectureRxSwiftTests */, - 3FF7BB912C508149CD53476EADA57DEF /* Pods-CoreDataPlatform */, - CCEE577CEAC8BC7025736B74192A8543 /* Pods-CoreDataPlatformTests */, - 99352AB56C403EDC83F01CC39D6890BA /* Pods-Domain */, - DC7C01A091247A50071E331B6145F5C3 /* Pods-DomainTests */, - CDD50F74DA897A490CAF1803125BD9D2 /* Pods-RealmPlatform */, - B8DE2F1449684CF95A06EF3CE5177AE6 /* Pods-RealmPlatformTests */, - ); - name = "Targets Support Files"; - sourceTree = ""; - }; - B8DE2F1449684CF95A06EF3CE5177AE6 /* Pods-RealmPlatformTests */ = { - isa = PBXGroup; - children = ( - 93903E44E4D224E95DA35509ABB84766 /* Info.plist */, - 63A5B8694F48D714670D67A575D03C8B /* Pods-RealmPlatformTests.modulemap */, - 0DFEB0B7CB2825572602F5F010201A06 /* Pods-RealmPlatformTests-acknowledgements.markdown */, - E1F8667B805F0A3DA04D10BE51C936C2 /* Pods-RealmPlatformTests-acknowledgements.plist */, - 456C4D0CC020D0F5B34472CED5436D76 /* Pods-RealmPlatformTests-dummy.m */, - 882321445A72F8929C05DD7AEC0DC5E1 /* Pods-RealmPlatformTests-frameworks.sh */, - 42B5181B66BB6301D8A587B7054964E6 /* Pods-RealmPlatformTests-resources.sh */, - 00FBD3A4BE3A018F8FDA36EB65F0A353 /* Pods-RealmPlatformTests-umbrella.h */, - 995BDF2455E81580FD2A095156AACBB9 /* Pods-RealmPlatformTests.debug.xcconfig */, - 22EFBBF4C9278AAD5FDC3DE2BDBEDF4C /* Pods-RealmPlatformTests.release.xcconfig */, - ); - name = "Pods-RealmPlatformTests"; - path = "Target Support Files/Pods-RealmPlatformTests"; - sourceTree = ""; - }; - CA026CCD0D6F210F279230DF2A77AAF1 /* Pods */ = { - isa = PBXGroup; - children = ( - 0E520E4CB3D265E8E4878E91F7CAA5B2 /* Nimble */, - 3CFA2DE9112E4EAB6C54A0AF2DCF7738 /* QueryKit */, - 740ADC8FB087E48016F19A195012A77B /* Realm */, - 216BC3FD88C3D53231858C7AE85CDBAB /* RealmSwift */, - F867EBDCA4A22120E09DF1EC998B68BB /* RxBlocking */, - 21FCEFCB078EEA9E7285B33C355A135F /* RxCocoa */, - 1DAF96EEEE6FF5D9FC694D6CF3F5B0AE /* RxRealm */, - CD86F30B05D2085A5851126A1C88479A /* RxSwift */, - 704F7FCEF333080BD9D009B76ABE0173 /* RxTest */, - ); - name = Pods; - sourceTree = ""; - }; - CCEE577CEAC8BC7025736B74192A8543 /* Pods-CoreDataPlatformTests */ = { - isa = PBXGroup; - children = ( - B4FA9E8E2A2AD6E667D3034957393773 /* Info.plist */, - 61F184C1814FC935FE344475AD58E920 /* Pods-CoreDataPlatformTests.modulemap */, - 20E445C57299B1DBB8FA1B6BFEE1E777 /* Pods-CoreDataPlatformTests-acknowledgements.markdown */, - DF89AA745937A2D0427115965F6783B3 /* Pods-CoreDataPlatformTests-acknowledgements.plist */, - 0C70935926151AE13B56A284870F4468 /* Pods-CoreDataPlatformTests-dummy.m */, - A49165FBF66400DC663F3483248F40E0 /* Pods-CoreDataPlatformTests-frameworks.sh */, - E6873A67EC8C5D2358006907B3F7A770 /* Pods-CoreDataPlatformTests-resources.sh */, - 1EC2834B0D7626408A52212C60194957 /* Pods-CoreDataPlatformTests-umbrella.h */, - 77E60632538C3F8962F2E0432C087CAD /* Pods-CoreDataPlatformTests.debug.xcconfig */, - 0AE740C98D7CFDF5038DA7D4F0EE9F90 /* Pods-CoreDataPlatformTests.release.xcconfig */, - ); - name = "Pods-CoreDataPlatformTests"; - path = "Target Support Files/Pods-CoreDataPlatformTests"; - sourceTree = ""; - }; - CD86F30B05D2085A5851126A1C88479A /* RxSwift */ = { - isa = PBXGroup; - children = ( - CAB57A78D701A804B22FEF812B0BB979 /* AddRef.swift */, - A326BD661EDA3D826886B4A226F02BFB /* Amb.swift */, - 0BC2B8130EA21CDE8FF89AB1DC379AE6 /* AnonymousDisposable.swift */, - 5AB78650825C442F4DB5617DF9A60D6D /* AnonymousInvocable.swift */, - 69179C45B2DE5D08778AC6669F98A187 /* AnonymousObservable.swift */, - 3BCE4B0CAE4354903CA6579B703AB088 /* AnonymousObserver.swift */, - 8E6BC43A1E8D721B8AC29C3C8E35EB6E /* AnyObserver.swift */, - 9FE87AF2EF9F402C90C5082447989B6E /* AsyncLock.swift */, - C87BD9D3FAB79191092DE8A9A58F5435 /* Bag.swift */, - 20BC21E8D260DF654A13E8B8A04D0651 /* Bag+Rx.swift */, - CD2011369791BBA73E5236E0DEA7DDE8 /* BehaviorSubject.swift */, - 6C2F88B8545B66CBC3BEC7250E684A54 /* BinaryDisposable.swift */, - 8895468BF142846DD869960F6D3AEFE9 /* BooleanDisposable.swift */, - 4A4EC47B6EE359C279B465EA06249E65 /* Buffer.swift */, - 53CC2CBA3B814AE063CA4BA09355A160 /* Cancelable.swift */, - 73FB40DDCBAAB504D3EA21A28D77E2CE /* Catch.swift */, - 028869F8443663B70CD76DCD7D83454E /* CombineLatest.swift */, - AEA7B15AF655E0429125627CAD29E6DC /* CombineLatest+arity.swift */, - CECD5B91706E6F398912E7F13BD6384A /* CombineLatest+Collection.swift */, - 7538D00F21F7D591ABDA749CF6C3959B /* CompositeDisposable.swift */, - 48E4D2FF3238DCF2F4E7CF0EFDF6A0CC /* Concat.swift */, - 5B16EF6020F24C00DA5420E8B89BE1E8 /* ConcurrentDispatchQueueScheduler.swift */, - 46617FD4B1B797669A2C1114600DD34E /* ConcurrentMainScheduler.swift */, - CBED89F2DC54B20A504A4AAAE40CB4AA /* ConnectableObservable.swift */, - A7B828A7C8B940D81A0784CFDF60FA0F /* ConnectableObservableType.swift */, - 26FA3B549953A29FBCBDFE55C8AF6AF6 /* CurrentThreadScheduler.swift */, - 85CABC513996516722136DD552AAAC99 /* Debounce.swift */, - CA2D0F53DBA0078A870976910A7C078B /* Debug.swift */, - E918723374177EFDBA5DCB0F2C860319 /* DefaultIfEmpty.swift */, - CAF071D8F638574AA04A43378F800E5B /* Deferred.swift */, - E58053D64E5CAF32528EB1D63F9DA215 /* Delay.swift */, - 7395C76AB3CA60B39405806587407D4B /* DelaySubscription.swift */, - 079584E666EB760187090CA5E1AAD808 /* DispatchQueue+Extensions.swift */, - 68B808DD1239D92B2CD72AA1D534FE02 /* DispatchQueueConfiguration.swift */, - ADFBCA755396F244B2CFFDA38918CED5 /* Disposable.swift */, - 540BBF4DB174D011B42C5A7CD928749E /* Disposables.swift */, - BD5F14DC655D910221783AA947DD700A /* DisposeBag.swift */, - 956C6ED2267E772D5C6BA90A5939066B /* DisposeBase.swift */, - 5976406626019A4510709DEC0D775315 /* DistinctUntilChanged.swift */, - 3F10AF5A825229B36E1702D704B44CCC /* Do.swift */, - DAD3127158220FA5FDFC00B86E1E3F8C /* ElementAt.swift */, - AD69336C9FF50F5AC4C94C3087DD45B4 /* Empty.swift */, - A34E5639FD366712F3924C743CB50378 /* Error.swift */, - FD4F0F4F7611B59EB7B852A2897AEB06 /* Errors.swift */, - 8BC37B11E78B44F63082BB22B6D284EF /* Event.swift */, - 65F6A58026C6EED2818FCE1A270C466C /* Filter.swift */, - 178501B9502D26D23613A114C84F2578 /* Generate.swift */, - 9142FC789F4E3E454D4CEA249BE53885 /* GroupBy.swift */, - D6C95112385932116CE17EB9AB8D181A /* GroupedObservable.swift */, - 6E2FA9D13239697489B913581CCD0C56 /* HistoricalScheduler.swift */, - 7698006130BFE2C96308386024F8EE19 /* HistoricalSchedulerTimeConverter.swift */, - 9DBB9B657E9422DE4900989C0DAD462A /* ImmediateScheduler.swift */, - CB1FB9D374AE5AA968003FE72D707271 /* ImmediateSchedulerType.swift */, - 3E92742A4FDFA16695FA81A88278F08D /* InfiniteSequence.swift */, - 9589E038DA4969D52DF2D43FDD685A93 /* InvocableScheduledItem.swift */, - 05FBC618FE607B32B230E614F5E23BD4 /* InvocableType.swift */, - 1C6939167CFD590D922C61EC97874F3A /* Just.swift */, - 8714A665CD919AF83A3D6358E2FF31CF /* Lock.swift */, - 75F6471591B80647ED7E7F982A70F078 /* LockOwnerType.swift */, - 4DFF991D5D6EC73F086137666782689A /* MainScheduler.swift */, - 490B2302297DFB82C7D87440BB0F2024 /* Map.swift */, - 4D94E41581AAC3FC4854F275905059BA /* Merge.swift */, - BD16B879B46399C1A79AE65F9429917B /* Multicast.swift */, - 0BCE66A45226586BD7DF6BEC43E0434D /* Never.swift */, - E2783992A84439EA1893A28DF0A37757 /* NopDisposable.swift */, - CA59CF369E8DFDEC956FEE2FFC8BDDAB /* Observable.swift */, - 4292DCD72C6D25F38487976F95E8A1DE /* Observable+Aggregate.swift */, - 226F053FF2041508860647259F595B96 /* Observable+Binding.swift */, - B58A17614C170BB578C0CF4B63E4A805 /* Observable+Concurrency.swift */, - BC9C07BFD9E5285640958FD1F757A3B1 /* Observable+Creation.swift */, - 256A7CC03DD807F0C92D64B350C9A815 /* Observable+Debug.swift */, - 0AEC88EB83550D0CEE740F01AD3304F3 /* Observable+Multiple.swift */, - A4456366A2BF3546CF5EBB700106AC35 /* Observable+Single.swift */, - DA764D488DA21265DCB666D506B91F36 /* Observable+StandardSequenceOperators.swift */, - E75BC693E7D92E8F3D03FA21EE9AD428 /* Observable+Time.swift */, - 00245512723919720F6610B0FD5B5FA5 /* ObservableConvertibleType.swift */, - DAEAA9EE9B3496B70B3A080292393D87 /* ObservableType.swift */, - 0345ECE2099E714228B5AC19D4D68858 /* ObservableType+Extensions.swift */, - 63117D92D9C1C46672E8C21CDEA8A6CA /* ObserveOn.swift */, - CD6FA85A15D26B61CF56DC7EF9DE08BD /* ObserveOnSerialDispatchQueue.swift */, - F5455DB9934B6E9608CEE0A65CF1F2AB /* ObserverBase.swift */, - 70D181751AE81CDA7BB7711225488CA3 /* ObserverType.swift */, - CF93653A2314101FEE0FCEAEF6A2DA38 /* OperationQueueScheduler.swift */, - DA642526C373285055DF7A048E6653DA /* Optional.swift */, - 6065AA383756BA1BF1C085CEB4F0E82E /* Platform.Darwin.swift */, - 4BCE4F1C204A76349723E6450F8FB06D /* Platform.Linux.swift */, - 9B9D9E1ED1DE4010A0AFA0DC9A6AAFFE /* PriorityQueue.swift */, - 092FA86B8002A03741E806731B57D444 /* Producer.swift */, - 3995157AED191D50B373A29AD950FF44 /* PublishSubject.swift */, - 21073C8D5D87488522A173376647FA7D /* Queue.swift */, - BBA06600C4A44787728BACAC9DBEAFEC /* Range.swift */, - 647B2D7490F994843E8AF357DA2D339D /* Reactive.swift */, - 4BA27878FE6C0B9657EAF8BCA96C71C8 /* RecursiveLock.swift */, - 58875D4B2FB45B2616D2F03A74D90AB5 /* RecursiveScheduler.swift */, - 01FA738286EDB78D4DEA81877FB6F38A /* Reduce.swift */, - B6BFE4CFD55F24BD664C94EA62163719 /* RefCount.swift */, - 66F960C5CB35AA50C12D2CF398D2E7C6 /* RefCountDisposable.swift */, - 04091A58B1790A6548EF098AE66CF3A9 /* Repeat.swift */, - 8ECCEFFF303418E9B3C78513C791ED99 /* ReplaySubject.swift */, - A6A21F53393A351653982660E8D3B7E9 /* RetryWhen.swift */, - EC936A807878C4A12B3F79CB60B8E42C /* Rx.swift */, - 620CFD2A642307BF12177D65F4747CB0 /* RxMutableBox.swift */, - FF58653ECA07C59AB6640587F777ED92 /* Sample.swift */, - 5599270D0CDAB890664985587BCBA77B /* Scan.swift */, - 617F97FAC54C3C016E9BD5962051E6AA /* ScheduledDisposable.swift */, - FBD37B96914326B6D403C752454FB28F /* ScheduledItem.swift */, - 2CBDC78B19B72BF7FD1FABD2769EEFE9 /* ScheduledItemType.swift */, - 659BF5AFED33E42956343E8559221A17 /* SchedulerServices+Emulation.swift */, - 68436A929FC24C5B08B4410FF0F3FE4E /* SchedulerType.swift */, - A5707648E42DDFCC4B19502E48E2780E /* Sequence.swift */, - 03A66613668A36AB188D806792455DCF /* SerialDispatchQueueScheduler.swift */, - 18251AFE1D92A264FF23E4B4BB099AD5 /* SerialDisposable.swift */, - 58C066AD56238C1D6F01C12799C6BA49 /* ShareReplay1.swift */, - 292DBC9AD470A408306D9D1B89CDFE7B /* ShareReplay1WhileConnected.swift */, - B3A4EAB6B11F014FE29FF10E4616E668 /* SingleAssignmentDisposable.swift */, - 474822C52CBE972860E8DC255086CAC6 /* SingleAsync.swift */, - 87A84264C64C45ED2BD758C26F02FD6B /* Sink.swift */, - 209F4C1D14383101977209F0972A8D40 /* Skip.swift */, - 9A87A2EA0FB26333CDE81BFD3B6AD4C7 /* SkipUntil.swift */, - DB6F36CC9B7AA1EBA88BC20EF65605A6 /* SkipWhile.swift */, - 618E7A71AADE30E6782BF2984DB54E15 /* StartWith.swift */, - 2D800547C3EBF2872C4F31A793241E5F /* String+Rx.swift */, - 6C126DC815AA11F53B7102B2291C9C0B /* SubjectType.swift */, - A787E97336FD45CDDF79B761294A02D2 /* SubscribeOn.swift */, - 750E9F15C16D92388077575CEA7712A8 /* SubscriptionDisposable.swift */, - 76A62E278B749564C6A15432577C6BB2 /* Switch.swift */, - 369A442F8D4A7AC7D1EF096638AF9426 /* SwitchIfEmpty.swift */, - 1543FA1B38905618379CEAC6A4136358 /* SynchronizedDisposeType.swift */, - 82F60631C865A4D18BB6AC807121D734 /* SynchronizedOnType.swift */, - 187CB18ECDE52D77BEB23E286DF86FA7 /* SynchronizedSubscribeType.swift */, - E31FCD0AEA3AFD5AB8F1A9CB36071E14 /* SynchronizedUnsubscribeType.swift */, - 3F1011E3BF49A2B2F987B00DB32F3965 /* TailRecursiveSink.swift */, - 5BACD7D12DBE83767BEB0ECD5EAC5610 /* Take.swift */, - 6F526232925C1A53B777B03207F790D9 /* TakeLast.swift */, - 8E2686CB51C73A7C37264F9AF994744A /* TakeUntil.swift */, - E726364160961DC7CA6554453D9B3C38 /* TakeWhile.swift */, - D6762421CBA4B7F9E6760BEF91362ED2 /* Throttle.swift */, - 322D2CBEC7964F87AC4A568C1C159173 /* Timeout.swift */, - 2E68EB69B86F922932702A025124117C /* Timer.swift */, - 31A003A034E61D0BC6AEB473579781CC /* ToArray.swift */, - FD520CE7E7239BF77CCE073A8BF2EB8E /* Using.swift */, - AF5A33C252816D101B9C6623DF7945AB /* Variable.swift */, - D3F4B3E20EC2AC39A861AAACC78EA132 /* VirtualTimeConverterType.swift */, - 8FBCF4CCAA6BF84CCE63795808F9F12A /* VirtualTimeScheduler.swift */, - 010615A01409020BA1C725CE32E0E35D /* Window.swift */, - 47D75A8BFFF4212F4969780ECF3AEE1B /* WithLatestFrom.swift */, - 01312618C8A9DE3BF0AB661508430F78 /* Zip.swift */, - CE8220D6464C1EB4A670642D437E73CA /* Zip+arity.swift */, - EA98B93E0B97D8B7E1C7D158CAC17D4D /* Zip+Collection.swift */, - D8570E649C96220A2A417411507FAB44 /* Support Files */, - ); - name = RxSwift; - path = RxSwift; - sourceTree = ""; - }; - CDD50F74DA897A490CAF1803125BD9D2 /* Pods-RealmPlatform */ = { - isa = PBXGroup; - children = ( - 2D028F3ACD2C5A54F2FB6F606C91431A /* Info.plist */, - F7F276851D1124CC7AA77B7CA5729547 /* Pods-RealmPlatform.modulemap */, - 47C68F048DCEF29C6EE5EED2C5538BC8 /* Pods-RealmPlatform-acknowledgements.markdown */, - E2F68543479C90FA720A187305542FA0 /* Pods-RealmPlatform-acknowledgements.plist */, - 56C8638CE774B8A8C12676C28219318C /* Pods-RealmPlatform-dummy.m */, - 10FB1984BCE73F6D4CB9601C885A083C /* Pods-RealmPlatform-resources.sh */, - 6C24D5484E459E8A613CE9978E6A45D5 /* Pods-RealmPlatform-umbrella.h */, - 8A66C29263F83D1690626D06AB176B1B /* Pods-RealmPlatform.debug.xcconfig */, - 4D4DF4A1A9FA96B8ACCA6E3A702F0D1C /* Pods-RealmPlatform.release.xcconfig */, - ); - name = "Pods-RealmPlatform"; - path = "Target Support Files/Pods-RealmPlatform"; - sourceTree = ""; - }; - D8570E649C96220A2A417411507FAB44 /* Support Files */ = { - isa = PBXGroup; - children = ( - AE01D1AC9BFFAA2CE3F505BFB99E2D71 /* Info.plist */, - 60F4DA3E272522E6F726267F07AC2F68 /* RxSwift.modulemap */, - 48FB25AD5881C46160F03C3B8FC705DC /* RxSwift.xcconfig */, - E6633EA0D93D4B6AE1E7D77701B5BC79 /* RxSwift-dummy.m */, - F223660F9BBE73DE7F388D3595377AD1 /* RxSwift-prefix.pch */, - 1E38A3BBA7C1B086C3EB1D2E492298C8 /* RxSwift-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/RxSwift"; - sourceTree = ""; - }; - DC7C01A091247A50071E331B6145F5C3 /* Pods-DomainTests */ = { - isa = PBXGroup; - children = ( - 2B06C1ABD281629E49000C81F0B87E8D /* Info.plist */, - 1ED7481D13A8E415D0CFDA2342C7BA12 /* Pods-DomainTests.modulemap */, - 401D1E82C19C3B6C274E1C789AE35EAB /* Pods-DomainTests-acknowledgements.markdown */, - 45E01FCCB15FE2B030460E029DE6FE60 /* Pods-DomainTests-acknowledgements.plist */, - 70805CBC75B69AC5D24785462BACE900 /* Pods-DomainTests-dummy.m */, - 0CBA7974D236DDD9E271202CE949519C /* Pods-DomainTests-frameworks.sh */, - E46FA50B8211DF43D1E755CC6DDEF607 /* Pods-DomainTests-resources.sh */, - 9ED1B6EBA5C332C3BAEBC7AB6BA83D48 /* Pods-DomainTests-umbrella.h */, - 724B6A7A40410FF36907A9E6A18EC799 /* Pods-DomainTests.debug.xcconfig */, - 97BF34CE2B91BE3374D79FBD1AE7EFE8 /* Pods-DomainTests.release.xcconfig */, - ); - name = "Pods-DomainTests"; - path = "Target Support Files/Pods-DomainTests"; - sourceTree = ""; - }; - DF7A76EBED6C104092ECDB01F15C99AD /* iOS */ = { - isa = PBXGroup; - children = ( - 41A44C3D509431019F12AE5A7B8A6A83 /* CoreData.framework */, - 01D06D1ECC38445180F9BAED3870F2A9 /* Foundation.framework */, - 3163740E168659576828D1F52CF80F2D /* XCTest.framework */, - ); - name = iOS; - sourceTree = ""; - }; - E6CE6211AD6DD49E7B5A88E0918D2042 /* Pods-CleanArchitectureRxSwiftTests */ = { - isa = PBXGroup; - children = ( - B3633623DA2155149867CB54C3AA4540 /* Info.plist */, - 726420484910C96B97F929C082CA0243 /* Pods-CleanArchitectureRxSwiftTests.modulemap */, - 0FCF9752602870D62F4F883BFD687FDE /* Pods-CleanArchitectureRxSwiftTests-acknowledgements.markdown */, - AF3A5C25271B4BD6628FB518199F4A76 /* Pods-CleanArchitectureRxSwiftTests-acknowledgements.plist */, - 6A70BC8106A92C9B6BCD22E56083E124 /* Pods-CleanArchitectureRxSwiftTests-dummy.m */, - 669B841F9EC4C2581BE126E5A666B8D4 /* Pods-CleanArchitectureRxSwiftTests-frameworks.sh */, - 136A584F0B6A3A1978B654F11781FD46 /* Pods-CleanArchitectureRxSwiftTests-resources.sh */, - 22F13FC131FEBD6B1E0EA44C27EAA523 /* Pods-CleanArchitectureRxSwiftTests-umbrella.h */, - 42FE02AEBE305BC7FAE845A81D26873E /* Pods-CleanArchitectureRxSwiftTests.debug.xcconfig */, - 644DE3C0D63D9FE3B9AE49F99A77086C /* Pods-CleanArchitectureRxSwiftTests.release.xcconfig */, - ); - name = "Pods-CleanArchitectureRxSwiftTests"; - path = "Target Support Files/Pods-CleanArchitectureRxSwiftTests"; - sourceTree = ""; - }; - F867EBDCA4A22120E09DF1EC998B68BB /* RxBlocking */ = { - isa = PBXGroup; - children = ( - 2BEDB59B2607DBB61E2BF6AE6133FECB /* Bag.swift */, - C57476FAC6A0C52BA090C6D4B5BB9649 /* BlockingObservable.swift */, - 6BD8D45A8BFC53034614C8ED73F27508 /* BlockingObservable+Operators.swift */, - 0A85BA326BCA9C57C225C39D9F0DB3C1 /* DispatchQueue+Extensions.swift */, - EB51FF01BE46CC25221378CD845BC4A0 /* InfiniteSequence.swift */, - A9A3F969C497BD91AD3F5DD9396FF96B /* ObservableConvertibleType+Blocking.swift */, - 26D2E85604D64564339FC5A3BFBA4341 /* Platform.Darwin.swift */, - E8B4885F3C548BBF6FFC834931C3FC55 /* Platform.Linux.swift */, - 7C457E30ED78639FDBAD11D32F2E5D35 /* PriorityQueue.swift */, - 3CF09B4FB5D88A264AA6DBE5F17F87FB /* Queue.swift */, - CEF657B58156636513E301EBE60961EE /* RecursiveLock.swift */, - 7A2EEEA2D447627757BE4857F136CC5B /* Resources.swift */, - 73D5044680BB9382E25FDC882F516522 /* RunLoopLock.swift */, - 58018A894C5B74E42B00A6D76F385654 /* Support Files */, - ); - name = RxBlocking; - path = RxBlocking; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 08CBF08370332FE55A799393292960F7 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 6740A6AAFC84336CE6FB6B4B2DB92E79 /* QueryKit-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 17686A3D4733AE23679D495BC8B021F1 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - BC8E2CD80717BD7362FCE876A59AD525 /* Pods-DomainTests-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 1A7F16C0949BDA50BFB09DB90D8EA348 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 763D7954EED201AD92043B01DAF03D29 /* Pods-CleanArchitectureRxSwift-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3B5CE898B1735E0323D242FF41F14F47 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 17F48B037F9592836678BCFB7C1E28D2 /* Pods-CoreDataPlatform-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 43FB8DE9499868876808913A4B597245 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 8725D22AA29AD69B2F44A1F3B29EE085 /* RxRealm-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 46CFD48BB14DB5D439AEC347F1B57959 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D23254C10D4B3B659DA5551F67DC1BCB /* RxBlocking-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6715D50B9530063A587A479ADF8A97C0 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - B16340143CE7FF40A32CD8082ED4152D /* CurrentTestCaseTracker.h in Headers */, - 88B771FB81DD05BF7E48A0D9271D9EB4 /* CwlCatchBadInstruction.h in Headers */, - DEF289C7BF4E97D42B06B1EB7CAE0951 /* CwlCatchException.h in Headers */, - 4A17E1DB4EA2CCBF04B76F5F8EB417A1 /* DSL.h in Headers */, - 874EF0A06B9FC80B877261425BAB4ED2 /* mach_excServer.h in Headers */, - 7BD907A708031D5361E1A97CACF9F24E /* Nimble-umbrella.h in Headers */, - 409A3ECDDC680D0BD343E3F203862E25 /* Nimble.h in Headers */, - E9CD7EF9DD6E75404E4264F6F0AC8D26 /* NMBExceptionCapture.h in Headers */, - 926F67C94121C19A959745138E5B42B6 /* NMBStringify.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 74BD93ED39B7C1FAB44E4CD980A6CE06 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 8898FE738D52A304B8E44A1624FFA43C /* RxSwift-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7FF1EE908322C1D43A1F5AFEB5DA51E0 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 3A8F394C5D970BD27ECA1F7BF9F776D5 /* RealmSwift-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9DFF50E7FC4AA4A764300556672F0B9F /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - C91DF7AD24C596568E839F0F6C2D4392 /* Pods-RealmPlatformTests-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - C37A970AFAD2CF9AFEA0D64E561F4096 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D4E417AAC2AC3E5E7B7B0B698E1E5333 /* Pods-CoreDataPlatformTests-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - C7304CE4E7584A62BC8C404277B328CF /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 392B3F1DDF3A8F2DF5AD9F814D10D0B8 /* RxTest-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - CAE36364EBFB33D390BD15922DD8FC65 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - CA10DD1E4009218EE97ACB06A6EDEB1E /* NSError+RLMSync.h in Headers */, - 6073CBD1D1453D44B6D03D692B72949F /* Realm.h in Headers */, - 4DF409E8CBE6462BE4A4A8EE9613F445 /* RLMAccessor.h in Headers */, - 300D21FD30F1080EC0226E4BB7F269D6 /* RLMArray.h in Headers */, - 6FB97B1717A444B0AB123965A41EF990 /* RLMArray_Private.h in Headers */, - 9C4638996F1308A925A3B30098D90795 /* RLMCollection.h in Headers */, - AE95445163BFD49B0EE8A39E0E672143 /* RLMConstants.h in Headers */, - 52D954B843F8F7E11964793FEB6C192C /* RLMListBase.h in Headers */, - C11983FF9FAA8B0D97955378989B9A82 /* RLMMigration.h in Headers */, - 04F1333C07921C5CF8C85689863DCE40 /* RLMMigration_Private.h in Headers */, - F03B94926A8B4A7F3EFC5FC84D7066EC /* RLMObject.h in Headers */, - 1520C8FECD6EB99CAC68AFF4C1074B63 /* RLMObject_Private.h in Headers */, - D99D9FE88B8E0EF3B32D925CC85E976B /* RLMObjectBase.h in Headers */, - 713028CCC706043FE2171388284BEAEE /* RLMObjectBase_Dynamic.h in Headers */, - 004A7C94DB016DC6C5CB064A383CEC59 /* RLMObjectSchema.h in Headers */, - E8EE353986CDA9D4463265A77A30C865 /* RLMObjectSchema_Private.h in Headers */, - D087C89FAF90A347A284AEF4FDB8566D /* RLMObjectStore.h in Headers */, - 7F2190516E80087BE2A656782CB70962 /* RLMOptionalBase.h in Headers */, - C26885CC817C342D6A534EDECBECC404 /* RLMPlatform.h in Headers */, - 7AB0B07A51FD678229FE646C10501AE9 /* RLMProperty.h in Headers */, - 4C522F4B5535AA948BD64BEEEE708BF6 /* RLMProperty_Private.h in Headers */, - E6916A70F961AB6F07E6139B31ABBEDE /* RLMRealm.h in Headers */, - 8CEB8A6E359CFD6C1AEBFFF2A3EC8DAF /* RLMRealm_Dynamic.h in Headers */, - 59656B1F5214178C44993CF5938F09F4 /* RLMRealm_Private.h in Headers */, - 17222310C3CD050F89CFD6F70931FDDD /* RLMRealmConfiguration+Sync.h in Headers */, - B300C5824BC3009D30783D33EFC9D7DB /* RLMRealmConfiguration.h in Headers */, - 0BF5D28410FF5E483CD636909F58B761 /* RLMRealmConfiguration_Private.h in Headers */, - 23D48ECB6FCEFE3B5F19343E02C51296 /* RLMResults.h in Headers */, - BD1BABF63CC84F15E4047992E6E39BC6 /* RLMResults_Private.h in Headers */, - 80B864601EC0B9DCCF305376768B641F /* RLMSchema.h in Headers */, - 0551871E9AB5CCB96D45F4CD7D1808E3 /* RLMSchema_Private.h in Headers */, - B83FBE44345739B8BFEB9C530B0404FA /* RLMSyncConfiguration.h in Headers */, - E459541DAC105180207C8EFE0372584C /* RLMSyncConfiguration_Private.h in Headers */, - 47635387B42AFA4043860933076B3D54 /* RLMSyncCredentials.h in Headers */, - D9BD6FFFCBBF8FA5D8DBE892BF32363F /* RLMSyncManager.h in Headers */, - B69C7C16D588B2F921D8EFF023B5EB42 /* RLMSyncManager_Private.h in Headers */, - 72092E73A616B51735CF0DA03038F031 /* RLMSyncPermissionChange.h in Headers */, - 0A50244B3CDA684A1040A07757642BE4 /* RLMSyncPermissionChange_Private.h in Headers */, - DC73880B3D3FD342364BB052E2E332ED /* RLMSyncPermissionOffer.h in Headers */, - 952145835DD7DDF619D742CC7C2C2164 /* RLMSyncPermissionOffer_Private.h in Headers */, - 66476ECA34EEFEA8CAAB0C24DFAC4F1D /* RLMSyncPermissionOfferResponse.h in Headers */, - 9A552C9FDDE94B7CF1A3F1C60FFCB5A0 /* RLMSyncPermissionOfferResponse_Private.h in Headers */, - CDBFFD55E4D666A5C717DFFDB317894F /* RLMSyncSession.h in Headers */, - 0702CFD183DDB744D7EF0BF1152036A9 /* RLMSyncUser.h in Headers */, - 2DAB9F3B0542B57D15A5FE4FED89F7FB /* RLMSyncUtil.h in Headers */, - 3B761FC7120A3636564CDFD489484247 /* RLMSyncUtil_Private.h in Headers */, - E31F8CF8D532ADF68F837678189E0EDE /* RLMThreadSafeReference.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB30CB97593E4C8AC59CB1A4B6CD81FF /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 641970F062A4DC5E995DF874F6D0267A /* _RX.h in Headers */, - FE6AE19923E0AF70ABC8629AB826B041 /* _RXDelegateProxy.h in Headers */, - BA764A9C1AE63320D6F06DD80450CD7F /* _RXKVOObserver.h in Headers */, - 8418DF8A5BE018F65758F68D75DAAAF7 /* _RXObjCRuntime.h in Headers */, - 62B6A33E0448492B1FE79ED9D7FF9A76 /* RxCocoa-umbrella.h in Headers */, - 6FC819B991B1D35929BCCDFBD771BB8F /* RxCocoa.h in Headers */, - 5EDAFB547B262B83F2BB1CBA4BCEBEDA /* RxCocoaRuntime.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E267B120E9B2E314FACE497D4383225A /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - B119A874F48DD3F44DC99E372DC66A88 /* Pods-RealmPlatform-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F0B0E72E907E2BDB864E65E905A96863 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 1B6F84F1CFD72BC6F0BC2CBE8BD237B3 /* Pods-CleanArchitectureRxSwiftTests-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F6C73A03EE6E75ACD64D1D04AD298B7F /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 8564FC84CC3C20E3FC4BA4A67A2A4DD1 /* Pods-Domain-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 03A506DBFFF8FEBA1FB66506FF90E480 /* Pods-RealmPlatform */ = { - isa = PBXNativeTarget; - buildConfigurationList = 48DC0F4BA97ABB79249C49D2ED18B2CB /* Build configuration list for PBXNativeTarget "Pods-RealmPlatform" */; - buildPhases = ( - 5660E245BC77EF08D2C522AD67F7E9DD /* Sources */, - 53282E99D747AFFF70DF685DF8496BC4 /* Frameworks */, - E267B120E9B2E314FACE497D4383225A /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - E29B6B5B1B93F2069C22B49EA1D5495A /* PBXTargetDependency */, - 548E66BEBE2C7E5803CA9BA478DBF39B /* PBXTargetDependency */, - 62444E89BF383A5BEBA135FA33A812AA /* PBXTargetDependency */, - D62BA6BD0D65B2AF88A258BB8EB25A66 /* PBXTargetDependency */, - 2671B4BDFD003DBAF4518815C4D0D239 /* PBXTargetDependency */, - ); - name = "Pods-RealmPlatform"; - productName = "Pods-RealmPlatform"; - productReference = D1617E4A776B209644FAA060C19A9AB4 /* Pods_RealmPlatform.framework */; - productType = "com.apple.product-type.framework"; - }; - 05B62F15ABC4FFEA2437D02394DD20EC /* Pods-CoreDataPlatform */ = { - isa = PBXNativeTarget; - buildConfigurationList = DAEB725935707646801E7352E0037C64 /* Build configuration list for PBXNativeTarget "Pods-CoreDataPlatform" */; - buildPhases = ( - F25518F53D74D6CB71F20BD1BCAB08D9 /* Sources */, - 029FEAF727C4B59BDAFC04625EA93DFD /* Frameworks */, - 3B5CE898B1735E0323D242FF41F14F47 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 45513E1890FE7F0ECF5402A811736E6F /* PBXTargetDependency */, - A4FD2FDA8545397461BE86CE2B192467 /* PBXTargetDependency */, - ); - name = "Pods-CoreDataPlatform"; - productName = "Pods-CoreDataPlatform"; - productReference = 197A704378E5C9A322E08AC37188B3B8 /* Pods_CoreDataPlatform.framework */; - productType = "com.apple.product-type.framework"; - }; - 0921CC2F4398BE9A4F1CEACB30684B56 /* Nimble */ = { - isa = PBXNativeTarget; - buildConfigurationList = 761C67FF258DB3BE6B2D4612FA9938E8 /* Build configuration list for PBXNativeTarget "Nimble" */; - buildPhases = ( - 41E146CA370726574B1C3087CF111D13 /* Sources */, - A0673853CCFEF089C0BF4D09E710CC4F /* Frameworks */, - 6715D50B9530063A587A479ADF8A97C0 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Nimble; - productName = Nimble; - productReference = D69F3BF5A79C4983DA88212C4D69DD15 /* Nimble.framework */; - productType = "com.apple.product-type.framework"; - }; - 09BA8CC5B372752A9BDD2D2F9D3FF3C3 /* QueryKit */ = { - isa = PBXNativeTarget; - buildConfigurationList = 8AA721F787325C3A98CD30FFE1A8CEC4 /* Build configuration list for PBXNativeTarget "QueryKit" */; - buildPhases = ( - 3B6CB18B5D2F5945E0ABB343C93BBB01 /* Sources */, - 1F57DF9CCE3D2FA8AF46DD7836B5E1D9 /* Frameworks */, - 08CBF08370332FE55A799393292960F7 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = QueryKit; - productName = QueryKit; - productReference = 61030C41963A862333D5C9379AA0CD4E /* QueryKit.framework */; - productType = "com.apple.product-type.framework"; - }; - 0E1E0B9BDFF1FFD9C90A6AD30C84DF5F /* Pods-CleanArchitectureRxSwiftTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = A34C7283AFDE698624D18E2862C5957F /* Build configuration list for PBXNativeTarget "Pods-CleanArchitectureRxSwiftTests" */; - buildPhases = ( - FC684F481ACBE191C07F9D723CD007CF /* Sources */, - B4FE59DBC1B4614D33D872C69A7594FA /* Frameworks */, - F0B0E72E907E2BDB864E65E905A96863 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - FED9C871547BDD2741B9DF056CB81CDE /* PBXTargetDependency */, - 2C0E8E3D16B50BEDCEC333D8FF547260 /* PBXTargetDependency */, - 9751E7888B85EF3DFF605B45F84BDCCF /* PBXTargetDependency */, - E9853623C054A7DCE01894DB8614CA93 /* PBXTargetDependency */, - ); - name = "Pods-CleanArchitectureRxSwiftTests"; - productName = "Pods-CleanArchitectureRxSwiftTests"; - productReference = 147B789AB94E510D2BF6BB8A33E9624E /* Pods_CleanArchitectureRxSwiftTests.framework */; - productType = "com.apple.product-type.framework"; - }; - 0FA880147422C0573B85D5EE25135ECB /* RxBlocking */ = { - isa = PBXNativeTarget; - buildConfigurationList = 43C6ABABB44056A4540B258D533FFF11 /* Build configuration list for PBXNativeTarget "RxBlocking" */; - buildPhases = ( - 6D8D2FA2980DAC58A9FEBD4B5646655B /* Sources */, - DA52AAB54ACA536EBF1309A5154861FF /* Frameworks */, - 46CFD48BB14DB5D439AEC347F1B57959 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - D8198CA1AD1CBF82D0AEBFC7AD2B3DDE /* PBXTargetDependency */, - ); - name = RxBlocking; - productName = RxBlocking; - productReference = 174DE8C4304E4DE07714C32E3A792E71 /* RxBlocking.framework */; - productType = "com.apple.product-type.framework"; - }; - 13460B005FBEEAA90A2F0B1958DE26EF /* Pods-RealmPlatformTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = A0BECF7F2EDF75402A680AB87AF78914 /* Build configuration list for PBXNativeTarget "Pods-RealmPlatformTests" */; - buildPhases = ( - B76DB672E4AEA48BE378C404C4ABA5FD /* Sources */, - F8DD8951DB71E9BE63BC09F2C8E78ECE /* Frameworks */, - 9DFF50E7FC4AA4A764300556672F0B9F /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - F2FAF04D49A03DA9FAECC1B605C8174E /* PBXTargetDependency */, - 4786AC566D4A5F2AD961975625C2CA4C /* PBXTargetDependency */, - 6A592B79852C1FFE0911CED73D30DCDD /* PBXTargetDependency */, - 63DAE66DC772D06CA448964A5CABC19D /* PBXTargetDependency */, - 9724EB76E11FB8C53294B206B48C83ED /* PBXTargetDependency */, - 8878277964BF6133EFCDECA31508088B /* PBXTargetDependency */, - F28AEE37B48A9AB3CA845AD56DF7FFE8 /* PBXTargetDependency */, - C40294657E51FE621CD44F198B8B2211 /* PBXTargetDependency */, - ); - name = "Pods-RealmPlatformTests"; - productName = "Pods-RealmPlatformTests"; - productReference = B650171DA812528FC08ADDDA2C7FECB4 /* Pods_RealmPlatformTests.framework */; - productType = "com.apple.product-type.framework"; - }; - 5307BD323DF75EDE6039AE386A3585C1 /* RxRealm */ = { - isa = PBXNativeTarget; - buildConfigurationList = D5DF25A27AB5E7A85298104AF43E2EC9 /* Build configuration list for PBXNativeTarget "RxRealm" */; - buildPhases = ( - 0E9F341E63A045E9C01589361C4EBD75 /* Sources */, - F9D0D912DC8CD62610F9B31A8CB4FCCA /* Frameworks */, - 43FB8DE9499868876808913A4B597245 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 349380A5A6AAA680813B7829D78E7DE2 /* PBXTargetDependency */, - 9EC0CDD1444F2951AFB24DC825C5398B /* PBXTargetDependency */, - A096FC5706E12BEBB80956B82B1DAC26 /* PBXTargetDependency */, - ); - name = RxRealm; - productName = RxRealm; - productReference = FDE46C6CAA2FBECD5CA170EEA7ACE4AC /* RxRealm.framework */; - productType = "com.apple.product-type.framework"; - }; - 665B8B2D03A471348E4FCCFC529FD7C5 /* Pods-CleanArchitectureRxSwift */ = { - isa = PBXNativeTarget; - buildConfigurationList = E439C340EF4CBAC506D772EC9B82D910 /* Build configuration list for PBXNativeTarget "Pods-CleanArchitectureRxSwift" */; - buildPhases = ( - D81CB95EB1EBC241F1796728B3A2D9FF /* Sources */, - A4477D6C5F2B67446475D4B381B60ACB /* Frameworks */, - 1A7F16C0949BDA50BFB09DB90D8EA348 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 61D739EEE12E6D40255A9F88839F02B9 /* PBXTargetDependency */, - 8CF563EEEEF88432862F0D89AF80CA85 /* PBXTargetDependency */, - 233A6813CE979346EDE254A1EECC8330 /* PBXTargetDependency */, - 16129CE0443E66DCC9C7FA394C7CA8E1 /* PBXTargetDependency */, - 952C9170B50D5A5185AA08C47A0822C0 /* PBXTargetDependency */, - F4B5AFD11DF2CA6F708D3CF03F9DAE93 /* PBXTargetDependency */, - ); - name = "Pods-CleanArchitectureRxSwift"; - productName = "Pods-CleanArchitectureRxSwift"; - productReference = 53E45728C9B84C40AB189F1F078A6367 /* Pods_CleanArchitectureRxSwift.framework */; - productType = "com.apple.product-type.framework"; - }; - 7B6E19033BAC1478C4B44CF33C991B5D /* Pods-CoreDataPlatformTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 5D90285FCF9D046BBF19950063284E7A /* Build configuration list for PBXNativeTarget "Pods-CoreDataPlatformTests" */; - buildPhases = ( - 660ED1ACB6DF1A52DF53A0B475621AD5 /* Sources */, - A1316E518FF9537C47C159D8EBBBBC07 /* Frameworks */, - C37A970AFAD2CF9AFEA0D64E561F4096 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - EFEECD7BEB836D3DB7615124E738E1FD /* PBXTargetDependency */, - 92B4F1233FD6FAB715A363B9284AFA7A /* PBXTargetDependency */, - CF2896D4EC6CB2110AA228DDCB483371 /* PBXTargetDependency */, - 5C369807B993678DE55FF1DA8BF18A86 /* PBXTargetDependency */, - E9018AE4AAACC1EC669BB22E153066D9 /* PBXTargetDependency */, - ); - name = "Pods-CoreDataPlatformTests"; - productName = "Pods-CoreDataPlatformTests"; - productReference = 3240D2B858783CF606E7BF315F7A6B41 /* Pods_CoreDataPlatformTests.framework */; - productType = "com.apple.product-type.framework"; - }; - 87CB6B6F4E9B6DE92184C1B58B832F6D /* RealmSwift */ = { - isa = PBXNativeTarget; - buildConfigurationList = 12047B76CD60B9AE299B036B44BBCF98 /* Build configuration list for PBXNativeTarget "RealmSwift" */; - buildPhases = ( - 2447C4724979D93E1568979D0F7D9268 /* Sources */, - 355ACB9F08AC0F5EC6F97C15145ECD4A /* Frameworks */, - 7FF1EE908322C1D43A1F5AFEB5DA51E0 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - C8CF3C9AB2E2A27392591D1F56753D27 /* PBXTargetDependency */, - ); - name = RealmSwift; - productName = RealmSwift; - productReference = 995BA9212A352337D7E710CE8C1FAA1E /* RealmSwift.framework */; - productType = "com.apple.product-type.framework"; - }; - 8D286E893273AF660982B64F36983780 /* Pods-DomainTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = CFE3967339D9E1F8C7672E9A33C1D4EE /* Build configuration list for PBXNativeTarget "Pods-DomainTests" */; - buildPhases = ( - E82D4A9D667F4D6F930F6377C57FCD2E /* Sources */, - 3FDA250F9EBEF7F54C0AA598F8DA5F53 /* Frameworks */, - 17686A3D4733AE23679D495BC8B021F1 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - D3E7CACC74369951EF168FF26E74BE33 /* PBXTargetDependency */, - C5C0140185270275C541FE7C5CC53B0D /* PBXTargetDependency */, - 8EEB8BC3734DCC7826AA17DB794A5CD0 /* PBXTargetDependency */, - B2C0CF1AE09B455385E63E1E9A543303 /* PBXTargetDependency */, - ); - name = "Pods-DomainTests"; - productName = "Pods-DomainTests"; - productReference = 60FF3B71AC7101C80B214BD79D4CA436 /* Pods_DomainTests.framework */; - productType = "com.apple.product-type.framework"; - }; - 940A8F3B71CC96F0FEF292E8DF3597E2 /* RxCocoa */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0D9AC49B722823C2C9BB4CAE44E4184A /* Build configuration list for PBXNativeTarget "RxCocoa" */; - buildPhases = ( - 9679B68A3C962A82BF1ADAEAE00052B8 /* Sources */, - 9E68B1045CA1DCDD4C136C0A1D39A335 /* Frameworks */, - DB30CB97593E4C8AC59CB1A4B6CD81FF /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 5983CEB5F5B76FD919CF29AEA2723C29 /* PBXTargetDependency */, - ); - name = RxCocoa; - productName = RxCocoa; - productReference = 67115DA69219E676AA2E904D1BFB0425 /* RxCocoa.framework */; - productType = "com.apple.product-type.framework"; - }; - AB6BDC65B2F3DAAE46A9AE24E9C00BB1 /* Pods-Domain */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0D1198A6080B8E571358113FD54EC7FE /* Build configuration list for PBXNativeTarget "Pods-Domain" */; - buildPhases = ( - EA2948FA1DF949D625ECF4942908428D /* Sources */, - B6D03A2C0B65B4F586D2154FE64196BE /* Frameworks */, - F6C73A03EE6E75ACD64D1D04AD298B7F /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - E6865B6C84466349C9F7FFA62D88E1B8 /* PBXTargetDependency */, - ); - name = "Pods-Domain"; - productName = "Pods-Domain"; - productReference = F23B137F530D39D6691F56296C847AAC /* Pods_Domain.framework */; - productType = "com.apple.product-type.framework"; - }; - B4E37325D2457E5277018CBA42075AB3 /* Realm */ = { - isa = PBXNativeTarget; - buildConfigurationList = 9A78A3DFDCAA2C8221DCF123AA098481 /* Build configuration list for PBXNativeTarget "Realm" */; - buildPhases = ( - 8FB9F826F8C3A5ABA08BA426EF866CC4 /* Sources */, - 085C70296632E14BDF5E1434416A1E09 /* Frameworks */, - CAE36364EBFB33D390BD15922DD8FC65 /* Headers */, - D3497221C92AA39222A7B990F71829CF /* Copy . Private Headers */, - 81F8112F88C33296011F7509C3059110 /* Copy . Public Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Realm; - productName = Realm; - productReference = CFF1CE5B512B5B4B43F9B47CA3639948 /* Realm.framework */; - productType = "com.apple.product-type.framework"; - }; - C4DAB4A5F18928931142281FA545B3F1 /* RxTest */ = { - isa = PBXNativeTarget; - buildConfigurationList = 446F52133A05F82618370E12DB02B412 /* Build configuration list for PBXNativeTarget "RxTest" */; - buildPhases = ( - D8E830FDD79D840090388D8B29DDAD3C /* Sources */, - 49AE3902ACE145960CA3C66C5B1D32DE /* Frameworks */, - C7304CE4E7584A62BC8C404277B328CF /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 5B2AFDB3B91B8D0F1B219C333F611E80 /* PBXTargetDependency */, - ); - name = RxTest; - productName = RxTest; - productReference = 3E0AFF0058AE0D7DBDE696D463411122 /* RxTest.framework */; - productType = "com.apple.product-type.framework"; - }; - E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */ = { - isa = PBXNativeTarget; - buildConfigurationList = 791D6AD5558C1034D862FF4A6BBF2BD2 /* Build configuration list for PBXNativeTarget "RxSwift" */; - buildPhases = ( - F44BBF37C2F9B00C649084ADC1DCA50F /* Sources */, - EE7054F970BBE381414FAB833824BEE4 /* Frameworks */, - 74BD93ED39B7C1FAB44E4CD980A6CE06 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = RxSwift; - productName = RxSwift; - productReference = 58BCF5F062C8E6C62F884D1209C368A0 /* RxSwift.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0700; - }; - buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 7DB346D0F39D3F0E887471402A8071AB; - productRefGroup = 7B9FE2BD0158B82E2CFE91D6F19D6F81 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 0921CC2F4398BE9A4F1CEACB30684B56 /* Nimble */, - 665B8B2D03A471348E4FCCFC529FD7C5 /* Pods-CleanArchitectureRxSwift */, - 0E1E0B9BDFF1FFD9C90A6AD30C84DF5F /* Pods-CleanArchitectureRxSwiftTests */, - 05B62F15ABC4FFEA2437D02394DD20EC /* Pods-CoreDataPlatform */, - 7B6E19033BAC1478C4B44CF33C991B5D /* Pods-CoreDataPlatformTests */, - AB6BDC65B2F3DAAE46A9AE24E9C00BB1 /* Pods-Domain */, - 8D286E893273AF660982B64F36983780 /* Pods-DomainTests */, - 03A506DBFFF8FEBA1FB66506FF90E480 /* Pods-RealmPlatform */, - 13460B005FBEEAA90A2F0B1958DE26EF /* Pods-RealmPlatformTests */, - 09BA8CC5B372752A9BDD2D2F9D3FF3C3 /* QueryKit */, - B4E37325D2457E5277018CBA42075AB3 /* Realm */, - 87CB6B6F4E9B6DE92184C1B58B832F6D /* RealmSwift */, - 0FA880147422C0573B85D5EE25135ECB /* RxBlocking */, - 940A8F3B71CC96F0FEF292E8DF3597E2 /* RxCocoa */, - 5307BD323DF75EDE6039AE386A3585C1 /* RxRealm */, - E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */, - C4DAB4A5F18928931142281FA545B3F1 /* RxTest */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 0E9F341E63A045E9C01589361C4EBD75 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ADB13D888C18545F70BBE7A8D7D639CD /* RealmObserver.swift in Sources */, - DD5257131F752B936FA1EFDA8951F732 /* RxRealm-dummy.m in Sources */, - 1DD25B641CB9A691C5416933C5E5D494 /* RxRealm.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2447C4724979D93E1568979D0F7D9268 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 25618586568456111144702323B0EE8D /* Aliases.swift in Sources */, - 30B87EF91D4948153D503A258B58D49C /* Error.swift in Sources */, - 2E3A9838B424530CD39AB60F18B42EC8 /* LinkingObjects.swift in Sources */, - FE0F7C529DE6C0897F61FAC951613D30 /* List.swift in Sources */, - E79E3B3B1D42B335BF8D3550AFA06624 /* Migration.swift in Sources */, - 1E0C2A0F63071B93DC4F3FC06E318D8C /* Object.swift in Sources */, - F03376C8A612EF07277B6F0DFF94F022 /* ObjectiveCSupport.swift in Sources */, - DC83AE82875D9DC0371F85939FD34C30 /* ObjectSchema.swift in Sources */, - 5517BF419724743A1F506FADF0D95B08 /* Optional.swift in Sources */, - 56685948CFA256789DA450BFDEF4A15A /* Property.swift in Sources */, - FFE202110C31629681C5B76848B1A203 /* Realm.swift in Sources */, - 5E3D61624CFB629D16E773CAA9D76EE4 /* RealmCollection.swift in Sources */, - 9EA8AF49B2B9FEE46FC2432B872DB107 /* RealmConfiguration.swift in Sources */, - 68B947F9DF5DAB6FC009FC77D6C1267D /* RealmSwift-dummy.m in Sources */, - 7217153F8E31A49E4DE2BB7DD0BC98DC /* Results.swift in Sources */, - 7FAE3AE25E62379C3AEE0733CC26748D /* Schema.swift in Sources */, - C889A695E421C80D29BF3EAB4683F17C /* SortDescriptor.swift in Sources */, - 98C4FF5F6FE0332BDB27D1B0F6AE3AA7 /* SwiftVersion.swift in Sources */, - EA2EED60BF65C08C93126F4AC5D74434 /* Sync.swift in Sources */, - DD0F5D9EEF6422ED677A2FC9036DA84C /* ThreadSafeReference.swift in Sources */, - 238B66DE909D6EFC97D6322C033F682C /* Util.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3B6CB18B5D2F5945E0ABB343C93BBB01 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 3EE385B1BE79C7DFDD83A7CE518BEF4D /* Attribute.swift in Sources */, - DE52460D2BBF8D04582FC6C369D7635A /* Expression.swift in Sources */, - BA1C087296A7720B586D63B56877F46E /* Predicate.swift in Sources */, - CDD3BE4F9E6094879FB244CF3A9FB4FD /* QueryKit-dummy.m in Sources */, - 5501848A986A91A35E796A927290FCBE /* QuerySet.swift in Sources */, - 56C97081D5B4125752F0E9D981FE8D37 /* SortDescriptor.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 41E146CA370726574B1C3087CF111D13 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - D5D4E8223C271A19448FCEAC36A9B441 /* AdapterProtocols.swift in Sources */, - FAACCCDBE0D2785212E37468636AAB0A /* AllPass.swift in Sources */, - 7272DB71A8C5325A0778F63E6F6C9957 /* AssertionDispatcher.swift in Sources */, - B612F1F906E3AF8B1FC6B893229E83B6 /* AssertionRecorder.swift in Sources */, - 0DF2D4E6B55D67E28D8BE9EC5A25F24E /* Async.swift in Sources */, - AA6EAFA71E1A6862AA312D89A601C34F /* AsyncMatcherWrapper.swift in Sources */, - 80D1788131B3D3326041E62364F8C7AA /* BeAKindOf.swift in Sources */, - A87CA098369D61EFC7A05BD61512A3F5 /* BeAnInstanceOf.swift in Sources */, - D7408861438442F67469ACE39D1604C1 /* BeCloseTo.swift in Sources */, - AD2B0E5BFF8EAD0EDF0449F8D198277C /* BeEmpty.swift in Sources */, - 288DBE855F794BA1AE8BC47AA413693E /* BeginWith.swift in Sources */, - 30F80459D8D536D8B99880EDD353987A /* BeGreaterThan.swift in Sources */, - ABEE3775B4FD25B3C86EE712BC2502B2 /* BeGreaterThanOrEqualTo.swift in Sources */, - 5685322E421AB4DA6A91B26C09833B29 /* BeIdenticalTo.swift in Sources */, - 318F9AE6D9561CFB487071A821B4217D /* BeLessThan.swift in Sources */, - 1F707004C05C63F90F0030E8E4902D66 /* BeLessThanOrEqual.swift in Sources */, - AF7F875677FF3EB4B6ADDB1373B34249 /* BeLogical.swift in Sources */, - F100D41C0564EE46CA47DA9E3540DA70 /* BeNil.swift in Sources */, - D6A1634CFD5243D18DB762116C8CEF8F /* BeVoid.swift in Sources */, - C97B9F51427BCD4C63EC7D75AB161833 /* Contain.swift in Sources */, - 2DF80575B9759A9E8004F4F642D0D123 /* ContainElementSatisfying.swift in Sources */, - 0B846370B6EA04F7D7909A403DD16317 /* CwlBadInstructionException.swift in Sources */, - C39921387DA273A0952A999B0CDC03F9 /* CwlCatchBadInstruction.m in Sources */, - 1C37D984F1BBBC7278E1FB6BDB153892 /* CwlCatchBadInstruction.swift in Sources */, - DB5066EBB8C95A3F8818628C9CA6794D /* CwlCatchException.m in Sources */, - 34E0569B2666F68A70EB676EFDCC4434 /* CwlCatchException.swift in Sources */, - B1D876C441B5F61984E35ABB5210AFE6 /* CwlDarwinDefinitions.swift in Sources */, - B138DBC0F7D2656EE7E413BEA735C71D /* DSL+Wait.swift in Sources */, - C9132B1E287B7ECA69A90F4766ADE9C2 /* DSL.m in Sources */, - A279D4DAE8E16C5D8F9019CDBED14D73 /* DSL.swift in Sources */, - 383B3EF018CDFD095EFEB7D74769144A /* EndWith.swift in Sources */, - D9921CDBA36587248C63AFDD5B3C1981 /* Equal.swift in Sources */, - 4B6579FFF0062EEBBABB8336C0871171 /* Errors.swift in Sources */, - D93C5A1929F8FD53F7EF2C3CA16CCC95 /* Expectation.swift in Sources */, - 65335E2F74AE71C270659EC7E8725030 /* Expression.swift in Sources */, - 704DA81E48A5263B35189F36C5247A53 /* FailureMessage.swift in Sources */, - 32AB6828BB98A679D3EBCC16C7BE9566 /* Functional.swift in Sources */, - DC9C69D7524AFEECCDC73D5CF1F4C028 /* HaveCount.swift in Sources */, - F2ED0A18E020A07A092F957B2C7EF0E2 /* mach_excServer.c in Sources */, - A665BE606F6B28E89B531EDE41657ECE /* Match.swift in Sources */, - 0D4B1951108CF54E1968467D30C351B5 /* MatcherFunc.swift in Sources */, - E1554E6ED22E94CAD97E211C7FBA530B /* MatcherProtocols.swift in Sources */, - AF814F353BF9C15BAED3E4067DCC3BF7 /* MatchError.swift in Sources */, - 748BB746CA429F9C5D510EEF3245ECFD /* Nimble-dummy.m in Sources */, - 69F9C31FC991A69337CE9B599993D68D /* NimbleEnvironment.swift in Sources */, - 7276DB3552398200B421D06F207EC0E3 /* NimbleXCTestHandler.swift in Sources */, - 6F36A431DE56B28FD400D20036A23DE4 /* NMBExceptionCapture.m in Sources */, - 9D9155396F48333B854DBE586138EDBF /* NMBExpectation.swift in Sources */, - 2173F4681D2DDDF63A01A7439EDE1FD4 /* NMBObjCMatcher.swift in Sources */, - 123D36BB9CA549C55BBE6FC7D21BAB97 /* NMBStringify.m in Sources */, - 10B953E63951E8DB495AA5B5EBDBBABA /* PostNotification.swift in Sources */, - FD9373DD3C1910FB513089F4CD39613B /* RaisesException.swift in Sources */, - C08FCDC247B35C971F5AE7E58987E8AC /* SatisfyAnyOf.swift in Sources */, - DB039F39038342DE5258F386F694A9A0 /* SourceLocation.swift in Sources */, - 04AE1DC56A0C088489EA27CED5190838 /* Stringers.swift in Sources */, - 11EEDB6DB6F03E2AF3FC368AA32274AC /* ThrowAssertion.swift in Sources */, - B1D59A1BD0FBDF3BA9A5B65ACFC25D56 /* ThrowError.swift in Sources */, - EEACC5B78AFB71C8594380C005C17A4B /* XCTestObservationCenter+Register.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 5660E245BC77EF08D2C522AD67F7E9DD /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 67D32AE97B91531C76AA76AD26FDC9A5 /* Pods-RealmPlatform-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 660ED1ACB6DF1A52DF53A0B475621AD5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - FB27F3A7CED8C9E253E2893C65752844 /* Pods-CoreDataPlatformTests-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6D8D2FA2980DAC58A9FEBD4B5646655B /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 7F0403F383753B68CCBB9C3CFEF48B3E /* Bag.swift in Sources */, - B0219195EA87E45F0A80A6B651D750FA /* BlockingObservable+Operators.swift in Sources */, - 22E6C7671AC663A40758CC59C8CD9B7D /* BlockingObservable.swift in Sources */, - 93ACC0691455B2EF3D3082207CF476A1 /* DispatchQueue+Extensions.swift in Sources */, - D64CEDF289C3B143E4B225DB1548E170 /* InfiniteSequence.swift in Sources */, - 83938A09CC48C4A863179A39CD6C64F4 /* ObservableConvertibleType+Blocking.swift in Sources */, - CA99C30B281B801DC440AC32562529A0 /* Platform.Darwin.swift in Sources */, - D1C4EF0CA043138F3C54AF31F9F7DC6D /* Platform.Linux.swift in Sources */, - 8A0D6EE74899BCEF3E892DB7FC516994 /* PriorityQueue.swift in Sources */, - B4771A1FCA5C1B7994BE90DAEEDE0EBD /* Queue.swift in Sources */, - B70460900853B886AB701599AB9E50E6 /* RecursiveLock.swift in Sources */, - 405F2EFCFCB4A37597D101CA594A825A /* Resources.swift in Sources */, - 4A3E2391B796DCD62D06550B23ED354A /* RunLoopLock.swift in Sources */, - 0E10A25085E10F70B24A400824EC0091 /* RxBlocking-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 8FB9F826F8C3A5ABA08BA426EF866CC4 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - AD62E15F84593890788801969BEE6C9E /* collection_change_builder.cpp in Sources */, - 0522A860E6FFB5AD0D40BCD4CDA2D39A /* collection_notifications.cpp in Sources */, - F3C083D68BD79206362C1A1A85CBF01E /* collection_notifier.cpp in Sources */, - BFDAE54FFD6F25C92DA85BEDCF02EB57 /* external_commit_helper.cpp in Sources */, - 1558F932D2EAE64D9FC0C1CBC29CF635 /* format.cpp in Sources */, - AF757F72857DD78441F84A73293480AF /* index_set.cpp in Sources */, - FC4B876377725955F5231DB219A74544 /* keychain_helper.cpp in Sources */, - 76D85D0D8B2F3973C0E182414FB5DE84 /* list.cpp in Sources */, - 808EA3343A85CA8A4CCE2D172CA49B58 /* list_notifier.cpp in Sources */, - 9F7DD8D2D7DB256317958B166BE805E5 /* NSError+RLMSync.m in Sources */, - 7604EA066917CBDE4B4C289ED19C775D /* object.cpp in Sources */, - C147583840485265416A96860EBF159D /* object_notifier.cpp in Sources */, - C77C6D1FE43D251868B33D937C6F56B9 /* object_schema.cpp in Sources */, - 967F04046C55E4DCC73452395B9F1783 /* object_store.cpp in Sources */, - 0860EDC510A80C60D061332D077C17FC /* placeholder.cpp in Sources */, - 8BDF66A042BF01798954D4362E880FF5 /* Realm-dummy.m in Sources */, - 10165E35AB7CAA2704185FA58DD93CB4 /* realm_coordinator.cpp in Sources */, - 3FF8DB5245B79D96C7010A74AA6DC611 /* results.cpp in Sources */, - 64C8D2426CC157630964D974B0941881 /* results_notifier.cpp in Sources */, - AD2C82CE8128C64F82C03B23A8681EE9 /* RLMAccessor.mm in Sources */, - FA97456A6C4793CE7C48F92F79E588A2 /* RLMAnalytics.mm in Sources */, - 5B2DA5AA90709F04ED19173B914B9DCE /* RLMArray.mm in Sources */, - 358FC0B058CC806759A2D2AD66616FF0 /* RLMArrayLinkView.mm in Sources */, - DA68D1F076FF08F67FD9D9B0F706FD85 /* RLMAuthResponseModel.m in Sources */, - 8852BBB56C2C72E6557CF48AA66F696E /* RLMClassInfo.mm in Sources */, - AC6FC297A452143D84D8EF2A770FEA5C /* RLMCollection.mm in Sources */, - 10FB0F937A957B2845C0C748AE3C9DFE /* RLMConstants.m in Sources */, - 38ADA3219A190567A959C954807BF55E /* RLMListBase.mm in Sources */, - B2E11C60F69DF9C8D74E1720E4AE5476 /* RLMMigration.mm in Sources */, - 8DD1FBEE164E836182610D1D4392BDF4 /* RLMNetworkClient.m in Sources */, - 9ED0DE2CC279330D9B1FED6E7B635B36 /* RLMObject.mm in Sources */, - 16127B907D81BB985CF063B8C3330CBA /* RLMObjectBase.mm in Sources */, - 6D17DC575F711BD62AD981F02C367552 /* RLMObjectSchema.mm in Sources */, - 3B70255ECDF50CB576C279421E697729 /* RLMObjectStore.mm in Sources */, - 8B9D0E619D2474679035F5FCC7F2A76D /* RLMObservation.mm in Sources */, - EEA616CF45528064C8899C9FF0EB9CD3 /* RLMOptionalBase.mm in Sources */, - 7E848D0A5596F4B34266C4FB1F2627F2 /* RLMPredicateUtil.mm in Sources */, - AA131849E8E914513D9558C0A8E36A79 /* RLMProperty.mm in Sources */, - 577FDB83C2D312581D33039DD574A0F9 /* RLMQueryUtil.mm in Sources */, - 955E6C9B1F44B32B235EB56B5AFDA9DD /* RLMRealm.mm in Sources */, - A065388A5F04E762D771FCC9A7173AAD /* RLMRealmConfiguration+Sync.mm in Sources */, - C403DC22CBAF5686E0A8EC72D45F246B /* RLMRealmConfiguration.mm in Sources */, - 0E7A765087D618AB742E4C047653BC55 /* RLMRealmUtil.mm in Sources */, - CDA9C892E03EF1BD60F623358203073C /* RLMResults.mm in Sources */, - 53E2E72544E67C0C9B4B011EF5E59A6D /* RLMSchema.mm in Sources */, - 9E74655781E19FBADB6C3827E03784F7 /* RLMSwiftSupport.m in Sources */, - 9A41A1019843F98F3E2082BD46CCC153 /* RLMSyncConfiguration.mm in Sources */, - 65F7C74D7759DA4B14F8C262C6F400E3 /* RLMSyncCredentials.m in Sources */, - 7DB9BFCCFAC9C44949D22A39E768A2EE /* RLMSyncErrorResponseModel.m in Sources */, - 70D48AAB5EB7E79F599F87EB71AA28D9 /* RLMSyncManager.mm in Sources */, - AE9F0FFDF14E54045CCEDC363FA110A8 /* RLMSyncPermissionChange.m in Sources */, - 2D8C1636B4ADFC51E5833F941519B9BE /* RLMSyncPermissionOffer.m in Sources */, - F2ED7EE7DA5041DC679FD991DCFB6D97 /* RLMSyncPermissionOfferResponse.m in Sources */, - 4A802E45AF58A980E74B0221253135D2 /* RLMSyncSession.mm in Sources */, - EEF0BA275250A24A214590305A4E8438 /* RLMSyncSessionRefreshHandle.mm in Sources */, - FF6ACAF70D0C436399F65364405ECECD /* RLMSyncUser.mm in Sources */, - FD2DD163B4D854176A969BEA2B559E2C /* RLMSyncUtil.mm in Sources */, - 9A26614B85D6C8E7548CE7771E1AABC6 /* RLMThreadSafeReference.mm in Sources */, - 2B46BE7A94A0F6CBD536AA24CCAAF04B /* RLMTokenModels.m in Sources */, - CE181EE6E4342F19D3BFE5ACABF110FF /* RLMUpdateChecker.mm in Sources */, - 5A8CDF35A2F830E16DE87403D7D50FE9 /* RLMUtil.mm in Sources */, - 8DB17FD32F0F3BEE7A8595C5E469FAAA /* schema.cpp in Sources */, - 8493E4563A24BB560ABFC7A977EEEB1D /* shared_realm.cpp in Sources */, - 6344AA77F50893A93CC7F972D9AEA054 /* sync_file.cpp in Sources */, - F8D7868BBAF5368D93F4D05E6F2E2E73 /* sync_manager.cpp in Sources */, - 49F4FED74BFDF7BF9E87665F1B701362 /* sync_metadata.cpp in Sources */, - 374F524B385804E0F6DA1ADE2089E03D /* sync_session.cpp in Sources */, - 889F4AB16D68F6D465EC010DD78E03D2 /* sync_user.cpp in Sources */, - E90F24F57A9927E2F27C137A5FFA9169 /* thread_safe_reference.cpp in Sources */, - B1730DBC5C66E4B50D9DF756BC830DD2 /* transact_log_handler.cpp in Sources */, - 9CCE5B9E572B73500ED842EF98B0868B /* weak_realm_notifier.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 9679B68A3C962A82BF1ADAEAE00052B8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ACAF6D2F93EAA0A7BCC6345A842752FC /* _RX.m in Sources */, - 0B66CBCFAC9EEF560B1997493EC72D59 /* _RXDelegateProxy.m in Sources */, - 29EAA8AB5DAD907283C5C24EDB9CA2CF /* _RXKVOObserver.m in Sources */, - 90CBD0EE6666150EC36EC72C24B0C176 /* _RXObjCRuntime.m in Sources */, - 38DBCA990F02F3F16CF802311F85842D /* Bag.swift in Sources */, - 8C44ED8E5CA93FB5A2FDF00CD6D89FED /* ControlEvent+Driver.swift in Sources */, - 5B7FF1DC30E1F8DAE07C3B886563BB63 /* ControlEvent.swift in Sources */, - 7777FAD1790F92E199CD0E6F08D85ED8 /* ControlProperty+Driver.swift in Sources */, - 50C04849FB5A983FAE9F302B994AA8D5 /* ControlProperty.swift in Sources */, - 31F7CF7ED198AB52DB0C17C54E5C8980 /* ControlTarget.swift in Sources */, - BC83D7FD7CC72C78C1233D07ECC6DC67 /* DelegateProxy.swift in Sources */, - 0238D5468CFEF4B5E424CCA54DA105F1 /* DelegateProxyType.swift in Sources */, - CDD7DD7BCA332476947396AF11E7628C /* DispatchQueue+Extensions.swift in Sources */, - E9C4603CBC2D6A6A8022EF787325DC2D /* Driver+Subscription.swift in Sources */, - 05095A78C447F2825F0143AE86199D99 /* Driver.swift in Sources */, - F14B3BF2A0ACB37EF431FFD3F2724BA0 /* InfiniteSequence.swift in Sources */, - 3951A75F43A20D2347494F90C7577378 /* ItemEvents.swift in Sources */, - E8EA26ED8CEA1EB1A80A2DC9A599E016 /* KVORepresentable+CoreGraphics.swift in Sources */, - E6DAC9C86173CA14D280D5D8A03DD85D /* KVORepresentable+Swift.swift in Sources */, - 7F9AE18821B437A591459E7B15BB6DCB /* KVORepresentable.swift in Sources */, - 296265B2129505B5A0FED45465FB265D /* Logging.swift in Sources */, - 30F7C0185D1A4F4119757895A82C02AC /* NotificationCenter+Rx.swift in Sources */, - 92875822BC612F957F39B5964EC27696 /* NSLayoutConstraint+Rx.swift in Sources */, - 7661DDEC3DA64D3D5037E3B50A76304A /* NSObject+Rx+KVORepresentable.swift in Sources */, - 82B13AF65D86F96FF17B3D8B5BFEE50F /* NSObject+Rx+RawRepresentable.swift in Sources */, - 1271188962C817ED2AF614F2A3B28799 /* NSObject+Rx.swift in Sources */, - 3245792BC5FA40FA5C058364FA28F266 /* NSTextStorage+Rx.swift in Sources */, - 96C645C2A524262DC0C5CE3961947A58 /* Observable+Bind.swift in Sources */, - 6C21FA2965F6C838EA40897875969F3F /* ObservableConvertibleType+Driver.swift in Sources */, - 892AC3D8F11ACC6D81A94922B3C597A7 /* ObservableConvertibleType+SharedSequence.swift in Sources */, - 9FAD6265121A9E451AB127625312DF5B /* Platform.Darwin.swift in Sources */, - 91D35C208817CE2790D05ACF38CBE0B0 /* Platform.Linux.swift in Sources */, - 8CBAA78F6BFB505EBD79766E4EBBA388 /* PriorityQueue.swift in Sources */, - CBFBD4C0B4E631A2F32B7CC888DEA4B8 /* Queue.swift in Sources */, - 6F324D91D1CF310C72E59E94EDEDA705 /* RecursiveLock.swift in Sources */, - 9665CA0604B29C43C49EDE0FC0BD06FC /* RxCocoa-dummy.m in Sources */, - B23C55EFC23AEAE0EF3D9A4B661DD3C9 /* RxCocoa.swift in Sources */, - 891830DAAE9F2C1C8FACBFF52F812C68 /* RxCocoaObjCRuntimeError+Extensions.swift in Sources */, - C7C1B01AF9F4D0831BE181D5830C8CE9 /* RxCollectionViewDataSourceProxy.swift in Sources */, - 2A39A00D7AEC4370BD0BBC73302489C8 /* RxCollectionViewDataSourceType.swift in Sources */, - C98402A0DBDB91B72EA743311AFB2F19 /* RxCollectionViewDelegateProxy.swift in Sources */, - 78012D8560C1F47AA9E0A7CBBBCB6DCB /* RxCollectionViewReactiveArrayDataSource.swift in Sources */, - 62F22A3D22FDE21E09E0EBCDC7A5EB2E /* RxPickerViewDelegateProxy.swift in Sources */, - 6BCB9DA57AAE1EEA5A687912E6BA3497 /* RxScrollViewDelegateProxy.swift in Sources */, - E529046ADA847803686D1DBDE2283DE8 /* RxSearchBarDelegateProxy.swift in Sources */, - D478CE0AE724AD9A40C22629D457ED62 /* RxSearchControllerDelegateProxy.swift in Sources */, - 4EC97CCB28B555BEAC3BB85C8A08D2ED /* RxTabBarControllerDelegateProxy.swift in Sources */, - 802C2D7A98BB0ADB88A89EA20A67047E /* RxTabBarDelegateProxy.swift in Sources */, - 05CC3AED612A73460690CB7D8C5D8B1D /* RxTableViewDataSourceProxy.swift in Sources */, - BCF8885A133EE3791ADB9E2B9F0C2CB2 /* RxTableViewDataSourceType.swift in Sources */, - 7C56AF4A65676283CE7BB567D506C4E8 /* RxTableViewDelegateProxy.swift in Sources */, - 74010EF77F8408B3D07DAB41286A7664 /* RxTableViewReactiveArrayDataSource.swift in Sources */, - FE5C02BACA2A1B098EDE04002720200E /* RxTarget.swift in Sources */, - F02CD5AE519358EE1AF5D3191FD56268 /* RxTextStorageDelegateProxy.swift in Sources */, - 83CFBF299CB0BB75C8FBB9BB910E26E4 /* RxTextViewDelegateProxy.swift in Sources */, - 5CDE195731A9F071C0B9F7C7AB70D46F /* RxWebViewDelegateProxy.swift in Sources */, - D9600B2742C23AE11E97B3743DC98212 /* SectionedViewDataSourceType.swift in Sources */, - 5C241BAAD7564DEB20A9E6FFC9E9B950 /* SharedSequence+Operators+arity.swift in Sources */, - 1841DE2CF9A35CE60778F31A35FD7289 /* SharedSequence+Operators.swift in Sources */, - 61A0034C86CEFD1CDC770474798A444D /* SharedSequence.swift in Sources */, - 956DCCDBB5221D178DD5C6916C7C2265 /* TextInput.swift in Sources */, - 0CBC24F25CEAF534664A5EB7F72748DD /* UIActivityIndicatorView+Rx.swift in Sources */, - 9EDD1CD67F29A8B6AF03539D1823A5C9 /* UIAlertAction+Rx.swift in Sources */, - A98EDA02852C1FECBD518D8046499022 /* UIApplication+Rx.swift in Sources */, - 96AF17653573AE8DADC0A7781F85D8CA /* UIBarButtonItem+Rx.swift in Sources */, - A5FCF5803D0D7352152C14D5EEA4A0B4 /* UIBindingObserver.swift in Sources */, - 37FB1246AFEEF33D0815180B66DFAF63 /* UIButton+Rx.swift in Sources */, - 58F311273F21BFB3138D1567EA153989 /* UICollectionView+Rx.swift in Sources */, - 551219DCDDC09C85FAB6A9A15B558E98 /* UIControl+Rx.swift in Sources */, - 1427108D787A8EA22063013C3A85AC56 /* UIDatePicker+Rx.swift in Sources */, - 94D4002526ACDC30711BB5DE8985412A /* UIGestureRecognizer+Rx.swift in Sources */, - 71BF96E0F4FB425B4339F99C5805BB38 /* UIImageView+Rx.swift in Sources */, - EC286ED821C9A94BA7198DCC721CFDAD /* UILabel+Rx.swift in Sources */, - 9792F864FDAE8F796629F0F5D60B07C1 /* UINavigationItem+Rx.swift in Sources */, - 95DC7AFE23F1E1563437999FAB45EA5B /* UIPageControl+Rx.swift in Sources */, - 3BB5E1969E527FEBB22C1FD04747AD5D /* UIPickerView+Rx.swift in Sources */, - 13BC74A727AF9AE419BC258692FCFFCC /* UIProgressView+Rx.swift in Sources */, - E5BDCB8296952CD04C3997B8028FF0A7 /* UIRefreshControl+Rx.swift in Sources */, - C970FC435DFECE8CF73AAA0B1DFCC851 /* UIScrollView+Rx.swift in Sources */, - 5765BDD7BF7C0721BF1F47ACD6FC99DD /* UISearchBar+Rx.swift in Sources */, - 980B35F504BF8AB0C52F3D9F095B6475 /* UISearchController+Rx.swift in Sources */, - DD5C32B9E0C197E78FCFA55F194015DE /* UISegmentedControl+Rx.swift in Sources */, - 471BD3BEC316BA65B26D3EDBC9A7FA52 /* UISlider+Rx.swift in Sources */, - 09798F290110ED61A5C78894817C4F79 /* UIStepper+Rx.swift in Sources */, - 4565B63BFECF9195A1BE74835D7C234F /* UISwitch+Rx.swift in Sources */, - 7FF1E4C06F7C7AE8C82E517EC0E7F039 /* UITabBar+Rx.swift in Sources */, - 8A13A2ADF070624728E6D54FA0E81810 /* UITabBarController+Rx.swift in Sources */, - 8486299F1747EDFD0460C9664CE1934E /* UITabBarItem+Rx.swift in Sources */, - 7170346340E9FD36E9E70F00D595F5BC /* UITableView+Rx.swift in Sources */, - 98100194787ED4C357A4A493CBC2CACB /* UITextField+Rx.swift in Sources */, - 2C0F749387EF5BC809535FEDF403A37D /* UITextView+Rx.swift in Sources */, - E9C5144BD91B6228AEE10B4D6A0595AF /* UIView+Rx.swift in Sources */, - D3A00425ADB00C0E35B64E3A8E69124F /* UIViewController+Rx.swift in Sources */, - 0E28DE1B6297A83BCCC9E50745116C4A /* UIWebView+Rx.swift in Sources */, - B9902AF36885DA753BA8803DD7C10EFC /* URLSession+Rx.swift in Sources */, - DEBA7257A0F6CE98CF3698BA752C38DC /* Variable+Driver.swift in Sources */, - D661C4243A2A9A8CB80E5C31A381F488 /* Variable+SharedSequence.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - B76DB672E4AEA48BE378C404C4ABA5FD /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8A993FCF14A197B15277C7B954A971C1 /* Pods-RealmPlatformTests-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D81CB95EB1EBC241F1796728B3A2D9FF /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 72B3C008F279BD3EAECFDD055D5975B3 /* Pods-CleanArchitectureRxSwift-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D8E830FDD79D840090388D8B29DDAD3C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - F328AEADEA0C35124301DD165618B038 /* Any+Equatable.swift in Sources */, - 2B74A62461CDDBA26B280AED72D0225B /* Bag.swift in Sources */, - 23F653F66B7953162F2FD99330E5A4EA /* ColdObservable.swift in Sources */, - BD082AEFE5645F715BB0DC8381B29C14 /* DispatchQueue+Extensions.swift in Sources */, - 14411AFBAFE09692492DF031BB5B550F /* Event+Equatable.swift in Sources */, - 78456ABEEEB323CFEB99981C7042B621 /* HotObservable.swift in Sources */, - B0679B38230AF213641E490B06278B8B /* InfiniteSequence.swift in Sources */, - BE3A0861289888C1C1E8542CE83F3F61 /* Platform.Darwin.swift in Sources */, - D806904060EBCA0DFABDA666D8B45B11 /* Platform.Linux.swift in Sources */, - 4AD3B03D430BFC47A0092202AE2F6A33 /* PriorityQueue.swift in Sources */, - A83474E5AFADE19547E98E3E1B50A320 /* Queue.swift in Sources */, - 80EA45C15F1E1491ACA86B9321751002 /* Recorded.swift in Sources */, - 404C7DFDD8D106B937A4857770E8B00F /* RecursiveLock.swift in Sources */, - BFAB7CFE6C6FC48ED00C5405C1194D65 /* RxTest-dummy.m in Sources */, - 1A5384100C4F32F0E2DE06E18EF099D4 /* RxTests.swift in Sources */, - 68E2113D6353CF20675407282574214E /* Subscription.swift in Sources */, - FE3C83B43146A0278BAE1FCD7DFE5602 /* TestableObservable.swift in Sources */, - 9A59412B5ADE7CF9748D5A359C8A1D7B /* TestableObserver.swift in Sources */, - 9B0FE76F7ECA7CEBAD1D79F9607831E5 /* TestScheduler.swift in Sources */, - E7991982F8254B272690ACED75B81FBB /* TestSchedulerVirtualTimeConverter.swift in Sources */, - 0038FAE5A0CCED46FC7046DF587B2243 /* XCTest+Rx.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - E82D4A9D667F4D6F930F6377C57FCD2E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ECCD0D1B793D9CB7367A5AE4086BE2C9 /* Pods-DomainTests-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EA2948FA1DF949D625ECF4942908428D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BB3776348EAC79C7B86FA71F7050F074 /* Pods-Domain-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F25518F53D74D6CB71F20BD1BCAB08D9 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - CE723FA3EB5B94FE61FB3DBD9890E4E0 /* Pods-CoreDataPlatform-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F44BBF37C2F9B00C649084ADC1DCA50F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 39DB9955D3010101CC9CD689EEC4C39D /* AddRef.swift in Sources */, - EB6ACAB77B45315C8BD88A590F88F0E3 /* Amb.swift in Sources */, - B5B4538AAA5622A7529F73C6CA0FB424 /* AnonymousDisposable.swift in Sources */, - 54B6FCD3AE128214AEAA0BC2D99F72C7 /* AnonymousInvocable.swift in Sources */, - 5A5D210AEBA7220EF8DFA81BD1D2743F /* AnonymousObservable.swift in Sources */, - B8E016D627837401CA830F7B988C7A52 /* AnonymousObserver.swift in Sources */, - A20B7D79A61A342C293991077BD33005 /* AnyObserver.swift in Sources */, - FD035FD8A0AC8DDB0C3544012DF869FD /* AsyncLock.swift in Sources */, - 76CAC00A6F60E18BD152D27C04F502E8 /* Bag+Rx.swift in Sources */, - D221EED28AF707626011FEA6E5329C76 /* Bag.swift in Sources */, - AABD3667CBC3C1572C89411F9D9C4994 /* BehaviorSubject.swift in Sources */, - 0FD10EC4CD742E8A2EAEC6D3245DCD86 /* BinaryDisposable.swift in Sources */, - 4349A31B53679F746D9EDF061D51C665 /* BooleanDisposable.swift in Sources */, - E029AAF9F297C89C3B3BA733724C7A23 /* Buffer.swift in Sources */, - B3212C499FDA598BEA27F16E68EA7395 /* Cancelable.swift in Sources */, - 33800B8BE4B478F3E0E85BDFEA1871E4 /* Catch.swift in Sources */, - B79A3B11799801E30713F09EC406FB8C /* CombineLatest+arity.swift in Sources */, - 233775CCE20C4C44BD89804941677FC3 /* CombineLatest+Collection.swift in Sources */, - CDD4BDF82DA024CE2197BC9A79D3437E /* CombineLatest.swift in Sources */, - 031EADD1F66083AFDBB3926BE73689DE /* CompositeDisposable.swift in Sources */, - 3D89C4ED6C5F24152D8B5B490E5DD578 /* Concat.swift in Sources */, - 07C26352152E78A50E11C951888594D9 /* ConcurrentDispatchQueueScheduler.swift in Sources */, - DA4D57C3EDFFD65BFE57D87BB17984AC /* ConcurrentMainScheduler.swift in Sources */, - A1E06D3D84108E4C640F216C7C78DC03 /* ConnectableObservable.swift in Sources */, - BA6BE7687FDA697254A2E3C114F4DFA2 /* ConnectableObservableType.swift in Sources */, - 594BFAE3EB59AF0501F9BD3CC59E430F /* CurrentThreadScheduler.swift in Sources */, - 34E1A3BCB1963E37E43D9E7C53CEE33C /* Debounce.swift in Sources */, - 3A5CEB64EE64A78FFA05521784AE5971 /* Debug.swift in Sources */, - F88BC6DC73110231847F971C3895DB24 /* DefaultIfEmpty.swift in Sources */, - 92557966C3965C2DBF7E72ECECEBAF8B /* Deferred.swift in Sources */, - 6C90EC2CC6DCB3CE78EBFCDA9ED2961A /* Delay.swift in Sources */, - F331BA21FB473AD19E5ACC01FA2D66EF /* DelaySubscription.swift in Sources */, - CC2472A3E0CDD47ED2F8516387727243 /* DispatchQueue+Extensions.swift in Sources */, - 2CD40505E27031B84521B0CA9F433BB1 /* DispatchQueueConfiguration.swift in Sources */, - 8DF52E3A7F288CC06C85C069A68A91B3 /* Disposable.swift in Sources */, - 699FB2F108E60EA2D41ECB418F9B3527 /* Disposables.swift in Sources */, - 1F59FA29FCD1E3ECEC0DAB1870697FA3 /* DisposeBag.swift in Sources */, - A67439EE31E1C1F77A36DE2F4583F287 /* DisposeBase.swift in Sources */, - 1748611683DFCC5121CB15AD467702CD /* DistinctUntilChanged.swift in Sources */, - D39A106632D5EFBC56B248F8100AC32E /* Do.swift in Sources */, - 7B80A3135C242B72B1B1DD84242E16E2 /* ElementAt.swift in Sources */, - F29AB8B5DC275C2A3BA8E0E3C5FEA0A3 /* Empty.swift in Sources */, - 9BD4D8E7A0AB04BFFCD9132E711AFB91 /* Error.swift in Sources */, - 3B7C23A5E701F72531E186D42D6B0EEB /* Errors.swift in Sources */, - EF000ABEEFDFA83EFB51DA41344138CC /* Event.swift in Sources */, - 163488075238790421628D50E5519BFC /* Filter.swift in Sources */, - CA9C4A73559039BB23C49FFC213C5B79 /* Generate.swift in Sources */, - A32899272ED7C405813D9791525C817D /* GroupBy.swift in Sources */, - 19E1F6E45CF33A5D70E736B65143CAC8 /* GroupedObservable.swift in Sources */, - B8E099CA7F923A89B01174B45E2EF53C /* HistoricalScheduler.swift in Sources */, - EAC932D97CB968BC9F96B5FAAAD7689B /* HistoricalSchedulerTimeConverter.swift in Sources */, - A04A2C16F51CF32D9E808D7BA6BD9315 /* ImmediateScheduler.swift in Sources */, - A4364E436ACF12AC75BB65D97871AA9A /* ImmediateSchedulerType.swift in Sources */, - 20477B8EB84E411CCD250DC48F5A225A /* InfiniteSequence.swift in Sources */, - 7B8DFBB0EF7191D92D4F13E2FF3FEFC4 /* InvocableScheduledItem.swift in Sources */, - 344A1302DA4AE22A9A7CA1E3D9F1D62E /* InvocableType.swift in Sources */, - 21C581601DE68512FE7F4CC5930A4DB6 /* Just.swift in Sources */, - A350920CA682B83DF982492034F8AF97 /* Lock.swift in Sources */, - 6D4479F428E656D74280F8EB6B6C2EC2 /* LockOwnerType.swift in Sources */, - 7EAF404933AC39FC664224F5E42C2CAB /* MainScheduler.swift in Sources */, - 6F634DA2B91E0389E03FB0573CDA3296 /* Map.swift in Sources */, - FD69397CB8DA848C41A1735F7212D6D9 /* Merge.swift in Sources */, - 4986900E17B22F8648EFCF5C235F0BCA /* Multicast.swift in Sources */, - 7DF58E273B3FAEB185899FD6BFA0FB83 /* Never.swift in Sources */, - 2CD126201F6E26AD39BC437D8E9750C9 /* NopDisposable.swift in Sources */, - 23D4105F4D7E9C3F35E8F43CD56548FE /* Observable+Aggregate.swift in Sources */, - A7B24340807413BA57135CE2AAB31DCE /* Observable+Binding.swift in Sources */, - 028C4E168F297D84172E8108D30AD62E /* Observable+Concurrency.swift in Sources */, - 33F39E3DBE5219C69D290B0791EBEE04 /* Observable+Creation.swift in Sources */, - 92D71A5902991DB53A4BBF86C51AC0E0 /* Observable+Debug.swift in Sources */, - 99CB8A8B85123E2CCE3FF6DEAA517C33 /* Observable+Multiple.swift in Sources */, - 804E9A79B9D1EA3CD95C0EEC86780447 /* Observable+Single.swift in Sources */, - 1CF0AEF1D95657ACEBEB05CE8D6D86BE /* Observable+StandardSequenceOperators.swift in Sources */, - 0D30D044EC92CE4C8FE00FBCD51850FF /* Observable+Time.swift in Sources */, - BB4C2EB17EEDC34897D1D40F80FC242D /* Observable.swift in Sources */, - 8A772549298F64FE6305696A5FE1F832 /* ObservableConvertibleType.swift in Sources */, - 08FD4F5F7826753B3C660394BFE64263 /* ObservableType+Extensions.swift in Sources */, - 27B911F164F453EE43F617648F43EA50 /* ObservableType.swift in Sources */, - A87D198FEDE3A9ADB07BC1E75C56D7EE /* ObserveOn.swift in Sources */, - DEEC09C8DAE3ACA8B9C0E3825B1FDAA2 /* ObserveOnSerialDispatchQueue.swift in Sources */, - A604E89C2E13AEEB4FFBE8E4970FCB37 /* ObserverBase.swift in Sources */, - 01EFC4C97CE1FC51BBD9E4788B7B47C8 /* ObserverType.swift in Sources */, - C51C21645FB7664E061E51D7FC5E174A /* OperationQueueScheduler.swift in Sources */, - A69D38644F45C29F8ACDD8B60F98C1F6 /* Optional.swift in Sources */, - AFB74BAA7028EB767AF7344CE6CA5D0D /* Platform.Darwin.swift in Sources */, - 538E4457CAFA7E5389267D5806D9DF13 /* Platform.Linux.swift in Sources */, - BC00B353AFDFBFD5ED960D702005BB88 /* PriorityQueue.swift in Sources */, - 05129E5528EC6FC21EBC90FEB9A23703 /* Producer.swift in Sources */, - 8D76F08376541663A679DC800B7761BF /* PublishSubject.swift in Sources */, - F01E50E7198011054FD44A8C397B939A /* Queue.swift in Sources */, - B2B0F9DE6FF5C1B6CCC4CE6CBEF8520C /* Range.swift in Sources */, - 3C10F87A78719796C1A119BCE11C0441 /* Reactive.swift in Sources */, - 0B5FD5498E20D2C88030B4F0CDB5F011 /* RecursiveLock.swift in Sources */, - C7772101DFEAE08E3D9C0D8067B197CD /* RecursiveScheduler.swift in Sources */, - 0780C21E8FAD599F71A5A8D2238D730A /* Reduce.swift in Sources */, - 613C135918AF7BE03B0FA3E7DFE4B328 /* RefCount.swift in Sources */, - 094E407D7B60EC732A73BDB966667696 /* RefCountDisposable.swift in Sources */, - 17426A2C50A2490A4789C20BB9E03ED5 /* Repeat.swift in Sources */, - F88C1B26CDECF34A818AD045E5DFA336 /* ReplaySubject.swift in Sources */, - 68F13C960F4E3AEC928C0D327750F2DC /* RetryWhen.swift in Sources */, - 1E1E331C95FF318B92EA1B028669EFAE /* Rx.swift in Sources */, - 7E8B6FC2D0E46A4C48E762CF8C0CBA5D /* RxMutableBox.swift in Sources */, - D86966A83FD813AAF2063B4614698A3A /* RxSwift-dummy.m in Sources */, - E642CE945228A43D636F29DD216AD2DB /* Sample.swift in Sources */, - 6B0483D7524C25D09BCFB0FA019D56C5 /* Scan.swift in Sources */, - 9D4C48245A664939B754A58FE24BBC56 /* ScheduledDisposable.swift in Sources */, - 1C4D32A8B4BE4F0550573A582A4D9B44 /* ScheduledItem.swift in Sources */, - 754213380BBF5353F7963BEA0C49E776 /* ScheduledItemType.swift in Sources */, - 4AB2B56D0B7EF259DE58070FEA36D229 /* SchedulerServices+Emulation.swift in Sources */, - FA52642BD078CA309FB364699AFA7022 /* SchedulerType.swift in Sources */, - A4A310099FFD3978529A7CFAA2CED525 /* Sequence.swift in Sources */, - 6BBB2C64E3BA4097CA5195D5A9E0D297 /* SerialDispatchQueueScheduler.swift in Sources */, - 6ACE4193309F562459D6B8D9EC0CA526 /* SerialDisposable.swift in Sources */, - 47EA53518FF80112971054A53F1615D0 /* ShareReplay1.swift in Sources */, - 9C3EF93809C13A5C4C8DF46F72302593 /* ShareReplay1WhileConnected.swift in Sources */, - 3F610CB9745DAC571E2601BF84B80097 /* SingleAssignmentDisposable.swift in Sources */, - 666CA0A6A8ADA4259E081BDD4E2A22F6 /* SingleAsync.swift in Sources */, - 08C2195D2E2DA6BAAF02EDD0682BAE6F /* Sink.swift in Sources */, - 1621585E40485409856BB2CFD5FA8ECE /* Skip.swift in Sources */, - 677791EE56669F5E8477E1D86AE1C3B2 /* SkipUntil.swift in Sources */, - 1200E3E2E38164F7FE431BDFC4A83C4A /* SkipWhile.swift in Sources */, - 6BB74E657C038911DAF7CFAF1812A364 /* StartWith.swift in Sources */, - BB5CC2BA77352613EE77E758F148718B /* String+Rx.swift in Sources */, - 779F362A05B65DC46B0530E3EE1C5575 /* SubjectType.swift in Sources */, - 31402AE5C2DBCC764AAB2781BE05CB61 /* SubscribeOn.swift in Sources */, - DA3036F47586D0CEBA519579788A2797 /* SubscriptionDisposable.swift in Sources */, - BE75A00DC491210F3C159B76CE10D7DF /* Switch.swift in Sources */, - 5B863348B30BDAFED3CCC2AF961B930F /* SwitchIfEmpty.swift in Sources */, - 45AEF7916B711832D47DEDC9D21BCBFB /* SynchronizedDisposeType.swift in Sources */, - 074E23FEFC1D302C556E4DA73AE7818A /* SynchronizedOnType.swift in Sources */, - 86EB34D19E761CAE40A6B42C97997478 /* SynchronizedSubscribeType.swift in Sources */, - 02958E3E95A39E369A17379EFB4B6818 /* SynchronizedUnsubscribeType.swift in Sources */, - D599F63437B83D2816E354FC725B8FF2 /* TailRecursiveSink.swift in Sources */, - 24D888587E676C6F70C5BB1F0F682589 /* Take.swift in Sources */, - 31AA18E8435C3629E08654254662881B /* TakeLast.swift in Sources */, - 7816D3BE0452F02591EB4EAE0F9F34A6 /* TakeUntil.swift in Sources */, - 2FC76CE3A378AD261A9F43C4C056A6FA /* TakeWhile.swift in Sources */, - DD91B2D1A2BBBD055C9282E3AA91BC5D /* Throttle.swift in Sources */, - 86DE001B0730C061B4507D32C5F34803 /* Timeout.swift in Sources */, - C1666EFC35501F3D385580232823C773 /* Timer.swift in Sources */, - D2104E63AFA8F0B970701AE8523CA3E4 /* ToArray.swift in Sources */, - 00C2511D3EB1D249D908F8A8D7D1C810 /* Using.swift in Sources */, - E90F66D0F09A00C785FFD5FE2DD90AEE /* Variable.swift in Sources */, - 3413BE623857A95EB359BD570D5696E3 /* VirtualTimeConverterType.swift in Sources */, - C1CE1BE924CA442804B8D80455B9CB54 /* VirtualTimeScheduler.swift in Sources */, - 4A260A283B42CD2B1CB3ED25BDC1321F /* Window.swift in Sources */, - 32BA52A477DB0589093812F0AE6225E1 /* WithLatestFrom.swift in Sources */, - 7F16E9D6C65A3A6304BB98F57CC4456D /* Zip+arity.swift in Sources */, - A7555A45AD27F927A22263A35C740E0F /* Zip+Collection.swift in Sources */, - 4471DBCF8CBD0CD74F4BE88BB5BA83AC /* Zip.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - FC684F481ACBE191C07F9D723CD007CF /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2DDAD51A54FD6A69CD245C3067222E2B /* Pods-CleanArchitectureRxSwiftTests-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 16129CE0443E66DCC9C7FA394C7CA8E1 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxCocoa; - target = 940A8F3B71CC96F0FEF292E8DF3597E2 /* RxCocoa */; - targetProxy = EE89A60B8F4358DB7A2A61C9E2384DAB /* PBXContainerItemProxy */; - }; - 233A6813CE979346EDE254A1EECC8330 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RealmSwift; - target = 87CB6B6F4E9B6DE92184C1B58B832F6D /* RealmSwift */; - targetProxy = 76FC13032E8B47F4CFD9A585D0890213 /* PBXContainerItemProxy */; - }; - 2671B4BDFD003DBAF4518815C4D0D239 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = A656DA944586812EB843BBC73756A754 /* PBXContainerItemProxy */; - }; - 2C0E8E3D16B50BEDCEC333D8FF547260 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxBlocking; - target = 0FA880147422C0573B85D5EE25135ECB /* RxBlocking */; - targetProxy = CA129C377A42741683F3A51A8605138F /* PBXContainerItemProxy */; - }; - 349380A5A6AAA680813B7829D78E7DE2 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Realm; - target = B4E37325D2457E5277018CBA42075AB3 /* Realm */; - targetProxy = CF803DAD36E7622EDAD21880D0E517CD /* PBXContainerItemProxy */; - }; - 45513E1890FE7F0ECF5402A811736E6F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = QueryKit; - target = 09BA8CC5B372752A9BDD2D2F9D3FF3C3 /* QueryKit */; - targetProxy = 7607DA3A6D7126F4D90D825F8CBB80EB /* PBXContainerItemProxy */; - }; - 4786AC566D4A5F2AD961975625C2CA4C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = QueryKit; - target = 09BA8CC5B372752A9BDD2D2F9D3FF3C3 /* QueryKit */; - targetProxy = 237EAF805843A6338EC9DA29F27BF313 /* PBXContainerItemProxy */; - }; - 548E66BEBE2C7E5803CA9BA478DBF39B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Realm; - target = B4E37325D2457E5277018CBA42075AB3 /* Realm */; - targetProxy = 301F8493B36FDEAE631D50E40629934B /* PBXContainerItemProxy */; - }; - 5983CEB5F5B76FD919CF29AEA2723C29 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = 772B4923A70FE20654856B56AA71376D /* PBXContainerItemProxy */; - }; - 5B2AFDB3B91B8D0F1B219C333F611E80 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = 87D461EF4F5918FF88C7AF08703BD48A /* PBXContainerItemProxy */; - }; - 5C369807B993678DE55FF1DA8BF18A86 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = C96ADF84CF672D3DBE0695A5DB2A5444 /* PBXContainerItemProxy */; - }; - 61D739EEE12E6D40255A9F88839F02B9 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = QueryKit; - target = 09BA8CC5B372752A9BDD2D2F9D3FF3C3 /* QueryKit */; - targetProxy = 4C57DD4F0EFE9080D128322B0ADDAB91 /* PBXContainerItemProxy */; - }; - 62444E89BF383A5BEBA135FA33A812AA /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RealmSwift; - target = 87CB6B6F4E9B6DE92184C1B58B832F6D /* RealmSwift */; - targetProxy = ACC1B9317D3DB295E4043B244B618B3F /* PBXContainerItemProxy */; - }; - 63DAE66DC772D06CA448964A5CABC19D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RealmSwift; - target = 87CB6B6F4E9B6DE92184C1B58B832F6D /* RealmSwift */; - targetProxy = 978AB414A4F8081DF72BB19F2E68E795 /* PBXContainerItemProxy */; - }; - 6A592B79852C1FFE0911CED73D30DCDD /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Realm; - target = B4E37325D2457E5277018CBA42075AB3 /* Realm */; - targetProxy = E161C7CA1BD867A0571A21F2394B1E59 /* PBXContainerItemProxy */; - }; - 8878277964BF6133EFCDECA31508088B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxRealm; - target = 5307BD323DF75EDE6039AE386A3585C1 /* RxRealm */; - targetProxy = 54DBE46667BC89CD0AEB796307FC4A9B /* PBXContainerItemProxy */; - }; - 8CF563EEEEF88432862F0D89AF80CA85 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Realm; - target = B4E37325D2457E5277018CBA42075AB3 /* Realm */; - targetProxy = 52AD133906F86059CA918FF4C106D4FE /* PBXContainerItemProxy */; - }; - 8EEB8BC3734DCC7826AA17DB794A5CD0 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = E5C9DD4F5238DFFD6619F31087F0FCC1 /* PBXContainerItemProxy */; - }; - 92B4F1233FD6FAB715A363B9284AFA7A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = QueryKit; - target = 09BA8CC5B372752A9BDD2D2F9D3FF3C3 /* QueryKit */; - targetProxy = 04A2C975B30996E029F71FF187824E8F /* PBXContainerItemProxy */; - }; - 952C9170B50D5A5185AA08C47A0822C0 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxRealm; - target = 5307BD323DF75EDE6039AE386A3585C1 /* RxRealm */; - targetProxy = F46E290A832893AF854068F9F8096317 /* PBXContainerItemProxy */; - }; - 9724EB76E11FB8C53294B206B48C83ED /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxBlocking; - target = 0FA880147422C0573B85D5EE25135ECB /* RxBlocking */; - targetProxy = 5B9B69499908D4E19F3146753C223221 /* PBXContainerItemProxy */; - }; - 9751E7888B85EF3DFF605B45F84BDCCF /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = DE1C8689FFD9240EC56DFA0C18ECC17D /* PBXContainerItemProxy */; - }; - 9EC0CDD1444F2951AFB24DC825C5398B /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RealmSwift; - target = 87CB6B6F4E9B6DE92184C1B58B832F6D /* RealmSwift */; - targetProxy = 6B0FACADD550DD3DBDD9356AC2CF5D62 /* PBXContainerItemProxy */; - }; - A096FC5706E12BEBB80956B82B1DAC26 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = D2B94A7C93AB85695F378F04F6813516 /* PBXContainerItemProxy */; - }; - A4FD2FDA8545397461BE86CE2B192467 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = 1E070DB394CC7AA4E57B8A4F6DF36990 /* PBXContainerItemProxy */; - }; - B2C0CF1AE09B455385E63E1E9A543303 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxTest; - target = C4DAB4A5F18928931142281FA545B3F1 /* RxTest */; - targetProxy = C2D76656AD27837CDFDF1510FD20E544 /* PBXContainerItemProxy */; - }; - C40294657E51FE621CD44F198B8B2211 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxTest; - target = C4DAB4A5F18928931142281FA545B3F1 /* RxTest */; - targetProxy = 923A86F80ACBFAEABBFC7966C5883062 /* PBXContainerItemProxy */; - }; - C5C0140185270275C541FE7C5CC53B0D /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxBlocking; - target = 0FA880147422C0573B85D5EE25135ECB /* RxBlocking */; - targetProxy = 478FFFAC6DF454A0BB665C59C2BF104F /* PBXContainerItemProxy */; - }; - C8CF3C9AB2E2A27392591D1F56753D27 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Realm; - target = B4E37325D2457E5277018CBA42075AB3 /* Realm */; - targetProxy = 271202732A0322638DC8AB835CC91F7F /* PBXContainerItemProxy */; - }; - CF2896D4EC6CB2110AA228DDCB483371 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxBlocking; - target = 0FA880147422C0573B85D5EE25135ECB /* RxBlocking */; - targetProxy = 71B53F65178CA2BBEE8BD444BB670AAE /* PBXContainerItemProxy */; - }; - D3E7CACC74369951EF168FF26E74BE33 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Nimble; - target = 0921CC2F4398BE9A4F1CEACB30684B56 /* Nimble */; - targetProxy = 5940D15C227FDCBE1130B3DE24D9E4F5 /* PBXContainerItemProxy */; - }; - D62BA6BD0D65B2AF88A258BB8EB25A66 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxRealm; - target = 5307BD323DF75EDE6039AE386A3585C1 /* RxRealm */; - targetProxy = A9EA80443FA13C764B5C8F5D881D889C /* PBXContainerItemProxy */; - }; - D8198CA1AD1CBF82D0AEBFC7AD2B3DDE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = 1F4BDB9C64F35A79D52EDE382D7E09B0 /* PBXContainerItemProxy */; - }; - E29B6B5B1B93F2069C22B49EA1D5495A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = QueryKit; - target = 09BA8CC5B372752A9BDD2D2F9D3FF3C3 /* QueryKit */; - targetProxy = 81BB638C5823F6F7337C6567D69FD6C8 /* PBXContainerItemProxy */; - }; - E6865B6C84466349C9F7FFA62D88E1B8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = 27DEE0F5CB962466A90ABAC16AA9BF9B /* PBXContainerItemProxy */; - }; - E9018AE4AAACC1EC669BB22E153066D9 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxTest; - target = C4DAB4A5F18928931142281FA545B3F1 /* RxTest */; - targetProxy = 60C18BA63ED338345864AE96CEF443C5 /* PBXContainerItemProxy */; - }; - E9853623C054A7DCE01894DB8614CA93 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxTest; - target = C4DAB4A5F18928931142281FA545B3F1 /* RxTest */; - targetProxy = 7FB9662A4E090AF7EC6A7764E7E37CBC /* PBXContainerItemProxy */; - }; - EFEECD7BEB836D3DB7615124E738E1FD /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Nimble; - target = 0921CC2F4398BE9A4F1CEACB30684B56 /* Nimble */; - targetProxy = A0BA5AFB384C0EE46612CC286775F2A7 /* PBXContainerItemProxy */; - }; - F28AEE37B48A9AB3CA845AD56DF7FFE8 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = 414D70E8A097790A23663C1C301642A7 /* PBXContainerItemProxy */; - }; - F2FAF04D49A03DA9FAECC1B605C8174E /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Nimble; - target = 0921CC2F4398BE9A4F1CEACB30684B56 /* Nimble */; - targetProxy = 9B6E1C2C1BFDEAC8866CFAA05BC5E0C6 /* PBXContainerItemProxy */; - }; - F4B5AFD11DF2CA6F708D3CF03F9DAE93 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = RxSwift; - target = E7E430A4361D8E1469CCFBD6B006F55F /* RxSwift */; - targetProxy = B4A2649C4D1018F105612C2F8F242C45 /* PBXContainerItemProxy */; - }; - FED9C871547BDD2741B9DF056CB81CDE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Nimble; - target = 0921CC2F4398BE9A4F1CEACB30684B56 /* Nimble */; - targetProxy = 808331F68CFB51E97314FC21E261C0D3 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 008FAF645A59E5D02A58B415102D7A22 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 4D4DF4A1A9FA96B8ACCA6E3A702F0D1C /* Pods-RealmPlatform.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-RealmPlatform/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-RealmPlatform/Pods-RealmPlatform.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_RealmPlatform; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 0B2A45E01C4068F0BEAEB7553B9A9A5E /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 42FE02AEBE305BC7FAE845A81D26873E /* Pods-CleanArchitectureRxSwiftTests.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-CleanArchitectureRxSwiftTests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-CleanArchitectureRxSwiftTests/Pods-CleanArchitectureRxSwiftTests.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_CleanArchitectureRxSwiftTests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 10B58F7CB2C2BF32E04AEABE8A1135A5 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9FC9E366D9C32EAEDFB1AE49EB284463 /* RxRealm.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RxRealm/RxRealm-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RxRealm/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RxRealm/RxRealm.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = RxRealm; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 128B8CC035A35F90AC0F5CAB8DA2F2D2 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = CC1954DF826907EEC9FF1742C99C88F5 /* Pods-Domain.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-Domain/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-Domain/Pods-Domain.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_Domain; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 19FD0EE1C500C1A6AADFDF5F561AF26B /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 6D61230AB12E85F7216633A581A8247F /* RxTest.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RxTest/RxTest-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RxTest/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RxTest/RxTest.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = RxTest; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 26909AFDD7353A20D19052C2EC8226F9 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 045F751C52CF1B431127377D279309ED /* Pods-Domain.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-Domain/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-Domain/Pods-Domain.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_Domain; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 26A7A77994A17BBFE69706E6B36F4460 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = B6E898DB323FEB82CD23EEF97B674B41 /* Pods-CleanArchitectureRxSwift.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-CleanArchitectureRxSwift/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-CleanArchitectureRxSwift/Pods-CleanArchitectureRxSwift.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_CleanArchitectureRxSwift; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 2905E3043A3BF92C4925F9EE118F7EE9 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 995BDF2455E81580FD2A095156AACBB9 /* Pods-RealmPlatformTests.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-RealmPlatformTests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-RealmPlatformTests/Pods-RealmPlatformTests.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_RealmPlatformTests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 3D952D7380545CBB8BBE080207791904 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C29ABA36121FE751CD24C2CB2CA2CCD0 /* RxBlocking.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RxBlocking/RxBlocking-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RxBlocking/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RxBlocking/RxBlocking.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = RxBlocking; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 4065D5C299D4EC3CBBB2A0837DB25001 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 5CC1DBAEAA8F292B0AC6B46152333850 /* QueryKit.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/QueryKit/QueryKit-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/QueryKit/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/QueryKit/QueryKit.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = QueryKit; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 43B93DD3F9FBB269F576AF0819DD2AE0 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = D339EB8E0C5AD7056277F1B708D49A0E /* Pods-CoreDataPlatform.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-CoreDataPlatform/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-CoreDataPlatform/Pods-CoreDataPlatform.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_CoreDataPlatform; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 469D37480D3BCF974BB02DD5F60A6C18 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 92C78267D5E8A49298BCA74BC43ED918 /* RealmSwift.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RealmSwift/RealmSwift-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RealmSwift/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RealmSwift/RealmSwift.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = RealmSwift; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 4881914581FA7095B176232E1F1F6725 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9FC9E366D9C32EAEDFB1AE49EB284463 /* RxRealm.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RxRealm/RxRealm-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RxRealm/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RxRealm/RxRealm.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = RxRealm; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 4BF8DD7EF93D0254F76B676C37F7F6A0 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 724B6A7A40410FF36907A9E6A18EC799 /* Pods-DomainTests.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-DomainTests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-DomainTests/Pods-DomainTests.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_DomainTests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 53070898D2FBE394C498BCC19FB489B7 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 22EFBBF4C9278AAD5FDC3DE2BDBEDF4C /* Pods-RealmPlatformTests.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-RealmPlatformTests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-RealmPlatformTests/Pods-RealmPlatformTests.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_RealmPlatformTests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 549FA3FF86F8CE9C761B9D70A0E04ACC /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 77E60632538C3F8962F2E0432C087CAD /* Pods-CoreDataPlatformTests.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-CoreDataPlatformTests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-CoreDataPlatformTests/Pods-CoreDataPlatformTests.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_CoreDataPlatformTests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 5CFF2563B2F26D0915102507D7A29243 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 6D61230AB12E85F7216633A581A8247F /* RxTest.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RxTest/RxTest-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RxTest/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RxTest/RxTest.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = RxTest; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 673254EEAF0B5BF4596080C749645884 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGNING_REQUIRED = NO; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_RELEASE=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; - STRIP_INSTALLED_PRODUCT = NO; - SYMROOT = "${SRCROOT}/../build"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 6C7760B0A0CFD4F8AB4C4459FA6019BF /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 97BF34CE2B91BE3374D79FBD1AE7EFE8 /* Pods-DomainTests.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-DomainTests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-DomainTests/Pods-DomainTests.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_DomainTests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 7682801179F7FD0AE5A039C12034C14F /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3DBCFE9863A0A6B6210470BB4D337978 /* Realm.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Realm/Realm-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Realm/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Realm/Realm.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = Realm; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 90A0E345393760425762CF0C469CEC83 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 48FB25AD5881C46160F03C3B8FC705DC /* RxSwift.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RxSwift/RxSwift-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RxSwift/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RxSwift/RxSwift.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = RxSwift; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 9BE117501B83DA19687D6FADCC4279F2 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 807776598A55DA33235962FD69086035 /* Nimble.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Nimble/Nimble-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Nimble/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Nimble/Nimble.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = Nimble; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - A0D5435D56F67E15DD77C0089C3338EB /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 0AE740C98D7CFDF5038DA7D4F0EE9F90 /* Pods-CoreDataPlatformTests.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-CoreDataPlatformTests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-CoreDataPlatformTests/Pods-CoreDataPlatformTests.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_CoreDataPlatformTests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - A61A3357D231A02641E12F05BD30EB73 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 2AF62868E365F049ADBB266DD2924B64 /* RxCocoa.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RxCocoa/RxCocoa-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RxCocoa/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RxCocoa/RxCocoa.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = RxCocoa; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - B0916A8E26F3BB098AC7C1236A4B227D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 5CC1DBAEAA8F292B0AC6B46152333850 /* QueryKit.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/QueryKit/QueryKit-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/QueryKit/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/QueryKit/QueryKit.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = QueryKit; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - BA4F22B8988CC4E1C9D54F2C255ADD92 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 92C78267D5E8A49298BCA74BC43ED918 /* RealmSwift.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RealmSwift/RealmSwift-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RealmSwift/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RealmSwift/RealmSwift.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = RealmSwift; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - C17D62616097C5021AC6CF238BD917D4 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 2AF62868E365F049ADBB266DD2924B64 /* RxCocoa.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RxCocoa/RxCocoa-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RxCocoa/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RxCocoa/RxCocoa.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = RxCocoa; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - C707917002BB7D3D6B21EB38CD5FD36A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3DBCFE9863A0A6B6210470BB4D337978 /* Realm.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Realm/Realm-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Realm/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Realm/Realm.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = Realm; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - CC3F193536CC0797E1454C368639F6CA /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 48FB25AD5881C46160F03C3B8FC705DC /* RxSwift.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RxSwift/RxSwift-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RxSwift/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RxSwift/RxSwift.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = RxSwift; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - CE52AD19A9935617343AD037A82579D9 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 8A66C29263F83D1690626D06AB176B1B /* Pods-RealmPlatform.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-RealmPlatform/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-RealmPlatform/Pods-RealmPlatform.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_RealmPlatform; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - DEB542E286C7366E9459B11F64A0A92C /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C29ABA36121FE751CD24C2CB2CA2CCD0 /* RxBlocking.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/RxBlocking/RxBlocking-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/RxBlocking/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/RxBlocking/RxBlocking.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = RxBlocking; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - E0D2064DFB3E910EB75A630BC0045735 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 5F2BA74199972EA19E73ECDD991CE244 /* Pods-CleanArchitectureRxSwift.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-CleanArchitectureRxSwift/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-CleanArchitectureRxSwift/Pods-CleanArchitectureRxSwift.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_CleanArchitectureRxSwift; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - E4F26E6EB105713A6A7E7E2E283AC2DF /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGNING_REQUIRED = NO; - COPY_PHASE_STRIP = NO; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_DEBUG=1", - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - ONLY_ACTIVE_ARCH = YES; - PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; - STRIP_INSTALLED_PRODUCT = NO; - SYMROOT = "${SRCROOT}/../build"; - }; - name = Debug; - }; - E58897381A61CCBFC7866A9976F4823B /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 644DE3C0D63D9FE3B9AE49F99A77086C /* Pods-CleanArchitectureRxSwiftTests.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-CleanArchitectureRxSwiftTests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-CleanArchitectureRxSwiftTests/Pods-CleanArchitectureRxSwiftTests.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_CleanArchitectureRxSwiftTests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - EB120F7EA80A2977C7E85B036876C00B /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 16328397D269057A1C0D76E728ED85F5 /* Pods-CoreDataPlatform.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-CoreDataPlatform/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.2; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-CoreDataPlatform/Pods-CoreDataPlatform.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_CoreDataPlatform; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - EF02B74193B9D2E215CD4A2203BDABE7 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 807776598A55DA33235962FD69086035 /* Nimble.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Nimble/Nimble-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Nimble/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Nimble/Nimble.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = Nimble; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0D1198A6080B8E571358113FD54EC7FE /* Build configuration list for PBXNativeTarget "Pods-Domain" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 128B8CC035A35F90AC0F5CAB8DA2F2D2 /* Debug */, - 26909AFDD7353A20D19052C2EC8226F9 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 0D9AC49B722823C2C9BB4CAE44E4184A /* Build configuration list for PBXNativeTarget "RxCocoa" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - A61A3357D231A02641E12F05BD30EB73 /* Debug */, - C17D62616097C5021AC6CF238BD917D4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 12047B76CD60B9AE299B036B44BBCF98 /* Build configuration list for PBXNativeTarget "RealmSwift" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 469D37480D3BCF974BB02DD5F60A6C18 /* Debug */, - BA4F22B8988CC4E1C9D54F2C255ADD92 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E4F26E6EB105713A6A7E7E2E283AC2DF /* Debug */, - 673254EEAF0B5BF4596080C749645884 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 43C6ABABB44056A4540B258D533FFF11 /* Build configuration list for PBXNativeTarget "RxBlocking" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3D952D7380545CBB8BBE080207791904 /* Debug */, - DEB542E286C7366E9459B11F64A0A92C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 446F52133A05F82618370E12DB02B412 /* Build configuration list for PBXNativeTarget "RxTest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 5CFF2563B2F26D0915102507D7A29243 /* Debug */, - 19FD0EE1C500C1A6AADFDF5F561AF26B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 48DC0F4BA97ABB79249C49D2ED18B2CB /* Build configuration list for PBXNativeTarget "Pods-RealmPlatform" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - CE52AD19A9935617343AD037A82579D9 /* Debug */, - 008FAF645A59E5D02A58B415102D7A22 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 5D90285FCF9D046BBF19950063284E7A /* Build configuration list for PBXNativeTarget "Pods-CoreDataPlatformTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 549FA3FF86F8CE9C761B9D70A0E04ACC /* Debug */, - A0D5435D56F67E15DD77C0089C3338EB /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 761C67FF258DB3BE6B2D4612FA9938E8 /* Build configuration list for PBXNativeTarget "Nimble" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 9BE117501B83DA19687D6FADCC4279F2 /* Debug */, - EF02B74193B9D2E215CD4A2203BDABE7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 791D6AD5558C1034D862FF4A6BBF2BD2 /* Build configuration list for PBXNativeTarget "RxSwift" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 90A0E345393760425762CF0C469CEC83 /* Debug */, - CC3F193536CC0797E1454C368639F6CA /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 8AA721F787325C3A98CD30FFE1A8CEC4 /* Build configuration list for PBXNativeTarget "QueryKit" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4065D5C299D4EC3CBBB2A0837DB25001 /* Debug */, - B0916A8E26F3BB098AC7C1236A4B227D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 9A78A3DFDCAA2C8221DCF123AA098481 /* Build configuration list for PBXNativeTarget "Realm" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C707917002BB7D3D6B21EB38CD5FD36A /* Debug */, - 7682801179F7FD0AE5A039C12034C14F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - A0BECF7F2EDF75402A680AB87AF78914 /* Build configuration list for PBXNativeTarget "Pods-RealmPlatformTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 2905E3043A3BF92C4925F9EE118F7EE9 /* Debug */, - 53070898D2FBE394C498BCC19FB489B7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - A34C7283AFDE698624D18E2862C5957F /* Build configuration list for PBXNativeTarget "Pods-CleanArchitectureRxSwiftTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0B2A45E01C4068F0BEAEB7553B9A9A5E /* Debug */, - E58897381A61CCBFC7866A9976F4823B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - CFE3967339D9E1F8C7672E9A33C1D4EE /* Build configuration list for PBXNativeTarget "Pods-DomainTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4BF8DD7EF93D0254F76B676C37F7F6A0 /* Debug */, - 6C7760B0A0CFD4F8AB4C4459FA6019BF /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - D5DF25A27AB5E7A85298104AF43E2EC9 /* Build configuration list for PBXNativeTarget "RxRealm" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4881914581FA7095B176232E1F1F6725 /* Debug */, - 10B58F7CB2C2BF32E04AEABE8A1135A5 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DAEB725935707646801E7352E0037C64 /* Build configuration list for PBXNativeTarget "Pods-CoreDataPlatform" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 43B93DD3F9FBB269F576AF0819DD2AE0 /* Debug */, - EB120F7EA80A2977C7E85B036876C00B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - E439C340EF4CBAC506D772EC9B82D910 /* Build configuration list for PBXNativeTarget "Pods-CleanArchitectureRxSwift" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E0D2064DFB3E910EB75A630BC0045735 /* Debug */, - 26A7A77994A17BBFE69706E6B36F4460 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; -} diff --git a/Pods/QueryKit/LICENSE b/Pods/QueryKit/LICENSE deleted file mode 100644 index 7acc68cc..00000000 --- a/Pods/QueryKit/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2012-2014, Kyle Fuller -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/Pods/QueryKit/QueryKit/Attribute.swift b/Pods/QueryKit/QueryKit/Attribute.swift deleted file mode 100644 index e39f0f00..00000000 --- a/Pods/QueryKit/QueryKit/Attribute.swift +++ /dev/null @@ -1,131 +0,0 @@ -import Foundation - -/// An attribute, representing an attribute on a model -public struct Attribute : Equatable { - public let key:String - - public init(_ key:String) { - self.key = key - } - - /// Builds a compound attribute with other key paths - public init(attributes:[String]) { - self.init(attributes.joined(separator: ".")) - } - - /// Returns an expression for the attribute - public var expression:NSExpression { - return NSExpression(forKeyPath: key) - } - - // MARK: Sorting - - /// Returns an ascending sort descriptor for the attribute - public func ascending() -> NSSortDescriptor { - return NSSortDescriptor(key: key, ascending: true) - } - - /// Returns a descending sort descriptor for the attribute - public func descending() -> NSSortDescriptor { - return NSSortDescriptor(key: key, ascending: false) - } - - func expressionForValue(_ value:AttributeType?) -> NSExpression { - if let value = value { - if let value = value as? NSObject { - return NSExpression(forConstantValue: value as NSObject) - } - - if MemoryLayout.size == MemoryLayout.size { - let value = unsafeBitCast(value, to: Optional.self) - if let value = value { - return NSExpression(forConstantValue: value) - } - } - - let value = unsafeBitCast(value, to: Optional.self) - if let value = value { - return NSExpression(forConstantValue: value) - } - } - - return NSExpression(forConstantValue: NSNull()) - } - - /// Builds a compound attribute by the current attribute with the given attribute - public func attribute(_ attribute:Attribute) -> Attribute { - return Attribute(attributes: [key, attribute.key]) - } -} - - -/// Returns true if two attributes have the same name -public func == (lhs: Attribute, rhs: Attribute) -> Bool { - return lhs.key == rhs.key -} - -public func == (left: Attribute, right: AttributeType?) -> NSPredicate { - return left.expression == left.expressionForValue(right) -} - -public func != (left: Attribute, right: AttributeType?) -> NSPredicate { - return left.expression != left.expressionForValue(right) -} - -public func > (left: Attribute, right: AttributeType?) -> NSPredicate { - return left.expression > left.expressionForValue(right) -} - -public func >= (left: Attribute, right: AttributeType?) -> NSPredicate { - return left.expression >= left.expressionForValue(right) -} - -public func < (left: Attribute, right: AttributeType?) -> NSPredicate { - return left.expression < left.expressionForValue(right) -} - -public func <= (left: Attribute, right: AttributeType?) -> NSPredicate { - return left.expression <= left.expressionForValue(right) -} - -public func ~= (left: Attribute, right: AttributeType?) -> NSPredicate { - return left.expression ~= left.expressionForValue(right) -} - -public func << (left: Attribute, right: [AttributeType]) -> NSPredicate { - let value = right.map { value in return value as! NSObject } - return left.expression << NSExpression(forConstantValue: value) -} - -public func << (left: Attribute, right: Range) -> NSPredicate { - let value = [right.lowerBound as! NSObject, right.upperBound as! NSObject] as NSArray - let rightExpression = NSExpression(forConstantValue: value) - - return NSComparisonPredicate(leftExpression: left.expression, rightExpression: rightExpression, modifier: NSComparisonPredicate.Modifier.direct, type: NSComparisonPredicate.Operator.between, options: NSComparisonPredicate.Options(rawValue: 0)) -} - -/// MARK: Bool Attributes - -prefix public func ! (left: Attribute) -> NSPredicate { - return left == false -} - -public extension QuerySet { - public func filter(_ attribute:Attribute) -> QuerySet { - return filter(attribute == true) - } - - public func exclude(_ attribute:Attribute) -> QuerySet { - return filter(attribute == false) - } -} - -// MARK: Collections - -public func count(_ attribute:Attribute) -> Attribute { - return Attribute(attributes: [attribute.key, "@count"]) -} - -public func count(_ attribute:Attribute) -> Attribute { - return Attribute(attributes: [attribute.key, "@count"]) -} diff --git a/Pods/QueryKit/QueryKit/Expression.swift b/Pods/QueryKit/QueryKit/Expression.swift deleted file mode 100644 index 546756a2..00000000 --- a/Pods/QueryKit/QueryKit/Expression.swift +++ /dev/null @@ -1,35 +0,0 @@ -import Foundation - -/// Returns an equality predicate for the two given expressions -public func == (left: NSExpression, right: NSExpression) -> NSPredicate { - return NSComparisonPredicate(leftExpression: left, rightExpression: right, modifier: NSComparisonPredicate.Modifier.direct, type: NSComparisonPredicate.Operator.equalTo, options: NSComparisonPredicate.Options(rawValue: 0)) -} - -/// Returns an inequality predicate for the two given expressions -public func != (left: NSExpression, right: NSExpression) -> NSPredicate { - return NSComparisonPredicate(leftExpression: left, rightExpression: right, modifier: NSComparisonPredicate.Modifier.direct, type: NSComparisonPredicate.Operator.notEqualTo, options: NSComparisonPredicate.Options(rawValue: 0)) -} - -public func > (left: NSExpression, right: NSExpression) -> NSPredicate { - return NSComparisonPredicate(leftExpression: left, rightExpression: right, modifier: NSComparisonPredicate.Modifier.direct, type: NSComparisonPredicate.Operator.greaterThan, options: NSComparisonPredicate.Options(rawValue: 0)) -} - -public func >= (left: NSExpression, right: NSExpression) -> NSPredicate { - return NSComparisonPredicate(leftExpression: left, rightExpression: right, modifier: NSComparisonPredicate.Modifier.direct, type: NSComparisonPredicate.Operator.greaterThanOrEqualTo, options: NSComparisonPredicate.Options(rawValue: 0)) -} - -public func < (left: NSExpression, right: NSExpression) -> NSPredicate { - return NSComparisonPredicate(leftExpression: left, rightExpression: right, modifier: NSComparisonPredicate.Modifier.direct, type: NSComparisonPredicate.Operator.lessThan, options: NSComparisonPredicate.Options(rawValue: 0)) -} - -public func <= (left: NSExpression, right: NSExpression) -> NSPredicate { - return NSComparisonPredicate(leftExpression: left, rightExpression: right, modifier: NSComparisonPredicate.Modifier.direct, type: NSComparisonPredicate.Operator.lessThanOrEqualTo, options: NSComparisonPredicate.Options(rawValue: 0)) -} - -public func ~= (left: NSExpression, right: NSExpression) -> NSPredicate { - return NSComparisonPredicate(leftExpression: left, rightExpression: right, modifier: NSComparisonPredicate.Modifier.direct, type: NSComparisonPredicate.Operator.like, options: NSComparisonPredicate.Options(rawValue: 0)) -} - -public func << (left: NSExpression, right: NSExpression) -> NSPredicate { - return NSComparisonPredicate(leftExpression: left, rightExpression: right, modifier: NSComparisonPredicate.Modifier.direct, type: NSComparisonPredicate.Operator.in, options: NSComparisonPredicate.Options(rawValue: 0)) -} diff --git a/Pods/QueryKit/QueryKit/Predicate.swift b/Pods/QueryKit/QueryKit/Predicate.swift deleted file mode 100644 index a13b9cf4..00000000 --- a/Pods/QueryKit/QueryKit/Predicate.swift +++ /dev/null @@ -1,79 +0,0 @@ -import Foundation -import CoreData - -/// Returns an and predicate from the given predicates -public func && (left: NSPredicate, right: NSPredicate) -> NSPredicate { - return NSCompoundPredicate(type: NSCompoundPredicate.LogicalType.and, subpredicates: [left, right]) -} - -/// Returns an or predicate from the given predicates -public func || (left: NSPredicate, right: NSPredicate) -> NSPredicate { - return NSCompoundPredicate(type: NSCompoundPredicate.LogicalType.or, subpredicates: [left, right]) -} - -/// Returns a predicate reversing the given predicate -prefix public func ! (left: NSPredicate) -> NSPredicate { - return NSCompoundPredicate(type: NSCompoundPredicate.LogicalType.not, subpredicates: [left]) -} - -// MARK: Predicate Type - -/// Represents a predicate for a specific model -public struct Predicate { - let predicate:NSPredicate - - init(predicate:NSPredicate) { - self.predicate = predicate - } -} - -public func == (left: Attribute, right: AttributeType?) -> Predicate { - return Predicate(predicate: left == right) -} - -public func != (left: Attribute, right: AttributeType?) -> Predicate { - return Predicate(predicate: left != right) -} - -public func > (left: Attribute, right: AttributeType?) -> Predicate { - return Predicate(predicate: left > right) -} - -public func >= (left: Attribute, right: AttributeType?) -> Predicate { - return Predicate(predicate: left >= right) -} - -public func < (left: Attribute, right: AttributeType?) -> Predicate { - return Predicate(predicate: left < right) -} - -public func <= (left: Attribute, right: AttributeType?) -> Predicate { - return Predicate(predicate: left <= right) -} - -public func ~= (left: Attribute, right: AttributeType?) -> Predicate { - return Predicate(predicate: left ~= right) -} - -public func << (left: Attribute, right: [AttributeType]) -> Predicate { - return Predicate(predicate: left << right) -} - -public func << (left: Attribute, right: Range) -> Predicate { - return Predicate(predicate: left << right) -} - -/// Returns an and predicate from the given predicates -public func && (left: Predicate, right: Predicate) -> Predicate { - return Predicate(predicate: left.predicate && right.predicate) -} - -/// Returns an or predicate from the given predicates -public func || (left: Predicate, right: Predicate) -> Predicate { - return Predicate(predicate: left.predicate || right.predicate) -} - -/// Returns a predicate reversing the given predicate -prefix public func ! (predicate: Predicate) -> Predicate { - return Predicate(predicate: !predicate.predicate) -} diff --git a/Pods/QueryKit/QueryKit/QuerySet.swift b/Pods/QueryKit/QueryKit/QuerySet.swift deleted file mode 100644 index 7ee77455..00000000 --- a/Pods/QueryKit/QueryKit/QuerySet.swift +++ /dev/null @@ -1,229 +0,0 @@ -import Foundation -import CoreData - -/// Represents a lazy database lookup for a set of objects. -open class QuerySet : Equatable { - /// Returns the managed object context that will be used to execute any requests. - open let context:NSManagedObjectContext - - /// Returns the name of the entity the request is configured to fetch. - open let entityName:String - - /// Returns the sort descriptors of the receiver. - open let sortDescriptors:[NSSortDescriptor] - - /// Returns the predicate of the receiver. - open let predicate:NSPredicate? - - /// The range of the query, allows you to offset and limit a query - open let range: Range? - - // MARK: Initialization - - public init(_ context:NSManagedObjectContext, _ entityName:String) { - self.context = context - self.entityName = entityName - self.sortDescriptors = [] - self.predicate = nil - self.range = nil - } - - /// Create a queryset from another queryset with a different sortdescriptor predicate and range - public init(queryset:QuerySet, sortDescriptors:[NSSortDescriptor]?, predicate:NSPredicate?, range: Range?) { - self.context = queryset.context - self.entityName = queryset.entityName - self.sortDescriptors = sortDescriptors ?? [] - self.predicate = predicate - self.range = range - } -} - -/// Methods which return a new queryset -extension QuerySet { - // MARK: Sorting - - /// Returns a new QuerySet containing objects ordered by the given sort descriptor. - public func orderBy(_ sortDescriptor:NSSortDescriptor) -> QuerySet { - return orderBy([sortDescriptor]) - } - - /// Returns a new QuerySet containing objects ordered by the given sort descriptors. - public func orderBy(_ sortDescriptors:[NSSortDescriptor]) -> QuerySet { - return QuerySet(queryset:self, sortDescriptors:sortDescriptors, predicate:predicate, range:range) - } - - /// Reverses the ordering of the QuerySet - public func reverse() -> QuerySet { - func reverseSortDescriptor(_ sortDescriptor:NSSortDescriptor) -> NSSortDescriptor { - return NSSortDescriptor(key: sortDescriptor.key!, ascending: !sortDescriptor.ascending) - } - - return QuerySet(queryset:self, sortDescriptors:sortDescriptors.map(reverseSortDescriptor), predicate:predicate, range:range) - } - - // MARK: Type-safe Sorting - - /// Returns a new QuerySet containing objects ordered by the given sort descriptor. - public func orderBy(_ closure:((ModelType.Type) -> (SortDescriptor))) -> QuerySet { - return orderBy(closure(ModelType.self).sortDescriptor) - } - - /// Returns a new QuerySet containing objects ordered by the given sort descriptors. - public func orderBy(_ closure:((ModelType.Type) -> ([SortDescriptor]))) -> QuerySet { - return orderBy(closure(ModelType.self).map { $0.sortDescriptor }) - } - - // MARK: Filtering - - /// Returns a new QuerySet containing objects that match the given predicate. - public func filter(_ predicate:NSPredicate) -> QuerySet { - var futurePredicate = predicate - - if let existingPredicate = self.predicate { - futurePredicate = NSCompoundPredicate(type: NSCompoundPredicate.LogicalType.and, subpredicates: [existingPredicate, predicate]) - } - - return QuerySet(queryset:self, sortDescriptors:sortDescriptors, predicate:futurePredicate, range:range) - } - - /// Returns a new QuerySet containing objects that match the given predicates. - public func filter(_ predicates:[NSPredicate]) -> QuerySet { - let newPredicate = NSCompoundPredicate(type: NSCompoundPredicate.LogicalType.and, subpredicates: predicates) - return filter(newPredicate) - } - - /// Returns a new QuerySet containing objects that exclude the given predicate. - public func exclude(_ predicate:NSPredicate) -> QuerySet { - let excludePredicate = NSCompoundPredicate(type: NSCompoundPredicate.LogicalType.not, subpredicates: [predicate]) - return filter(excludePredicate) - } - - /// Returns a new QuerySet containing objects that exclude the given predicates. - public func exclude(_ predicates:[NSPredicate]) -> QuerySet { - let excludePredicate = NSCompoundPredicate(type: NSCompoundPredicate.LogicalType.and, subpredicates: predicates) - return exclude(excludePredicate) - } - - // MARK: Type-safe filtering - - /// Returns a new QuerySet containing objects that match the given predicate. - public func filter(_ closure:((ModelType.Type) -> (Predicate))) -> QuerySet { - return filter(closure(ModelType.self).predicate) - } - - /// Returns a new QuerySet containing objects that exclude the given predicate. - public func exclude(_ closure:((ModelType.Type) -> (Predicate))) -> QuerySet { - return exclude(closure(ModelType.self).predicate) - } - - /// Returns a new QuerySet containing objects that match the given predicatess. - public func filter(_ closures:[((ModelType.Type) -> (Predicate))]) -> QuerySet { - return filter(closures.map { $0(ModelType.self).predicate }) - } - - /// Returns a new QuerySet containing objects that exclude the given predicates. - public func exclude(_ closures:[((ModelType.Type) -> (Predicate))]) -> QuerySet { - return exclude(closures.map { $0(ModelType.self).predicate }) - } -} - -/// Functions for evauluating a QuerySet -extension QuerySet { - // MARK: Subscripting - - /// Returns the object at the specified index. - public func object(_ index: Int) throws -> ModelType? { - let request = fetchRequest - request.fetchOffset = index - request.fetchLimit = 1 - let items = try context.fetch(request) - return items.first - } - - public subscript(range:Range) -> QuerySet { - get { - var fullRange = range - - if let currentRange = self.range { - fullRange = ((currentRange.lowerBound + range.lowerBound) ..< range.upperBound) - } - - return QuerySet(queryset:self, sortDescriptors:sortDescriptors, predicate:predicate, range:fullRange) - } - } - - // Mark: Getters - - /// Returns the first object in the QuerySet - public func first() throws -> ModelType? { - return try self.object(0) - } - - /// Returns the last object in the QuerySet - public func last() throws -> ModelType? { - return try reverse().first() - } - - // MARK: Conversion - - /// Returns a fetch request equivilent to the QuerySet - public var fetchRequest: NSFetchRequest { - let request = NSFetchRequest(entityName: entityName) - request.predicate = predicate - request.sortDescriptors = sortDescriptors - - if let range = range { - request.fetchOffset = range.lowerBound - request.fetchLimit = range.upperBound - range.lowerBound - } - - return request - } - - /// Returns an array of all objects matching the QuerySet - public func array() throws -> [ModelType] { - return try context.fetch(fetchRequest) - } - - // MARK: Count - - /// Returns the count of objects matching the QuerySet. - public func count() throws -> Int { - return try context.count(for: fetchRequest) - } - - // MARK: Exists - - /** Returns true if the QuerySet contains any results, and false if not. - :note: Returns nil if the operation could not be completed. - */ - public func exists() throws -> Bool { - let result:Int = try count() - return result > 0 - } - - // MARK: Deletion - - /// Deletes all the objects matching the QuerySet. - public func delete() throws -> Int { - let objects = try array() - let deletedCount = objects.count - - for object in objects { - context.delete(object) - } - - return deletedCount - } -} - -/// Returns true if the two given querysets are equivilent -public func == (lhs: QuerySet, rhs: QuerySet) -> Bool { - let context = lhs.context == rhs.context - let entityName = lhs.entityName == rhs.entityName - let sortDescriptors = lhs.sortDescriptors == rhs.sortDescriptors - let predicate = lhs.predicate == rhs.predicate - let startIndex = lhs.range?.lowerBound == rhs.range?.lowerBound - let endIndex = lhs.range?.upperBound == rhs.range?.upperBound - return context && entityName && sortDescriptors && predicate && startIndex && endIndex -} diff --git a/Pods/QueryKit/QueryKit/SortDescriptor.swift b/Pods/QueryKit/QueryKit/SortDescriptor.swift deleted file mode 100644 index 96bfc255..00000000 --- a/Pods/QueryKit/QueryKit/SortDescriptor.swift +++ /dev/null @@ -1,23 +0,0 @@ -import Foundation -import CoreData - -/// Represents a sort descriptor for a specific model -public struct SortDescriptor { - let sortDescriptor:NSSortDescriptor - - init(sortDescriptor:NSSortDescriptor) { - self.sortDescriptor = sortDescriptor - } -} - -extension Attribute { - /// Returns an ascending sort descriptor for the attribute - public func ascending() -> SortDescriptor { - return SortDescriptor(sortDescriptor: ascending()) - } - - /// Returns a descending sort descriptor for the attribute - public func descending() -> SortDescriptor { - return SortDescriptor(sortDescriptor: descending()) - } -} diff --git a/Pods/QueryKit/README.md b/Pods/QueryKit/README.md deleted file mode 100644 index c7ca46cd..00000000 --- a/Pods/QueryKit/README.md +++ /dev/null @@ -1,236 +0,0 @@ -QueryKit Logo - -# QueryKit - -[![Build Status](http://img.shields.io/travis/QueryKit/QueryKit/master.svg?style=flat)](https://travis-ci.org/QueryKit/QueryKit) - -QueryKit, a simple type-safe Core Data query language. - -## Usage - -To get the most out of QueryKit, and to get full type-safe queries, you may -add extensions for your Core Data models providing properties which describe -your models. You may use [querykit-cli](https://github.com/QueryKit/querykit-cli) -to generate these automatically. - -An extension for our a `Person` model might look as follows: - -```swift -extension User { - static var name:Attribute { return Attribute("name") } - static var age:Attribute { return Attribute("age") } -} -``` - -This provides static properties on our User model which represent each property -on our Core Data model, these may be used to construct predicates and sort -descriptors with compile time safety, without stringly typing them -into your application. - -```swift -let namePredicate = Person.name == "Kyle" -let agePredicate = Person.age > 25 -let ageSortDescriptor = Person.age.descending() -``` - -### QuerySet - -A QuerySet represents a collection of objects from your Core Data Store. -It may have zero, one or many filters. Filters narrow down the query -results based on the given parameters. - -#### Retrieving all objects - -```swift -let queryset = Person.queryset(context) -``` - -#### Retrieving specific objects with filters - -You may filter a QuerySet using the `filter` and `exclude` methods, which -accept a closure passing the model type allowing you to access the -type-safe attributes. - -The `filter` and `exclude` methods return brand new QuerySet's including your filter. - -```swift -queryset.filter { $0.name == "Kyle" } -queryset.exclude { $0.age > 25 } -``` - -You may also use standard `NSPredicate` if you want to construct complicated -queries or do not wish to use the type-safe properties. - -```swift -queryset.filter(NSPredicate(format: "name == '%@'", "Kyle")) -queryset.exclude(NSPredicate(format: "age > 25")) -``` - -##### Chaining filters - -The result of refining a QuerySet is itself a QuerySet, so it’s possible -to chain refinements together. For example: - -```swift -queryset.filter { $0.name == "Kyle" } - .exclude { $0.age < 25 } - .filter { $0.isEmployed } -``` - -Each time you refine a QuerySet, you get a brand-new QuerySet that is in -no way bound to the previous QuerySet. Each refinement creates a separate -and distinct QuerySet that may be stored, used and reused. - -#### QuerySets are lazy - -A QuerySet is lazy, creating a QuerySet doesn’t involve querying -Core Data. QueryKit won’t actually execute the query until the -QuerySet is *evaluated*. - -#### Ordering - -You may order a QuerySet's results by using the `orderBy` function which -accepts a closure passing the model type, and expects a sort descriptor in -return. - -```swift -queryset.orderBy { $0.name.ascending() } -``` - -You may also pass in an `NSSortDescriptor` if you would rather. - -```swift -queryset.orderBy(Person.name.ascending()) -queryset.orderBy(NSSortDescriptor(key: "name", ascending: true)) -``` - -#### Slicing - -Using slicing, a QuerySet's results may be limited to a specified range. For -example, to get the first 5 items in our QuerySet: - -```swift -queryset[0..5] -``` - -**NOTE**: *Remember, QuerySets are lazily evaluated. Slicing doesn’t evaluate the query.* - -#### Fetching - -##### Multiple objects - -You may convert a QuerySet to an array using the `array()` function. For example: - -```swift -for person in try! queryset.array() { - println("Hello \(person.name).") -} -``` - -##### First object - -```swift -let kyle = try? queryset.first() -``` - -##### Last object - -```swift -let kyle = try? queryset.last() -``` - -##### Object at index - -```swift -let katie = try? queryset.object(3) -``` - -##### Count - -```swift -let numberOfPeople = try? queryset.count() -``` - -##### Deleting - -This method immediately deletes the objects in your queryset and returns a -count or an error if the operation failed. - -```swift -let deleted = try? queryset.delete() -``` - -#### Attribute - -The `Attribute` is a generic structure for creating predicates in a -type-safe manner as shown at the start of the README. - -```swift -let name = Attribute("name") -let age = Attribute("age") -``` - -##### Operators - -QueryKit provides custom operator functions allowing you to create predicates. - -```swift -// Name is equal to Kyle -name == "Kyle" - -// Name is either equal to Kyle or Katie -name << ["Kyle", "Katie"] - -// Age is equal to 27 -age == 27 - -// Age is more than or equal to 25 -age >= 25 - -// Age is within the range 22 to 30. -age << (22...30) -``` - -The following types of comparisons are supported using Attribute: - -| Comparison | Meaning | -| ------- |:--------:| -| == | x equals y | -| != | x is not equal to y | -| < | x is less than y | -| <= | x is less than or equal to y | -| > | x is more than y | -| >= | x is more than or equal to y | -| ~= | x is like y | -| ~= | x is like y | -| << | x IN y, where y is an array | -| << | x BETWEEN y, where y is a range | - -##### Predicate extensions - -QueryKit provides the `!`, `&&` and `||` operators for joining multiple predicates together. - -```swift -// Persons name is Kyle or Katie -Person.name == "Kyle" || Person.name == "Katie" - -// Persons age is more than 25 and their name is Kyle -Person.age >= 25 && Person.name == "Kyle" - -// Persons name is not Kyle -!(Person.name == "Kyle") -``` - -## Installation - -[CocoaPods](http://cocoapods.org) is the recommended way to add QueryKit to -your project, you may also use Carthage. - -```ruby -pod 'QueryKit' -``` - -## License - -QueryKit is released under the BSD license. See [LICENSE](LICENSE). - diff --git a/Pods/Realm/LICENSE b/Pods/Realm/LICENSE deleted file mode 100644 index 8a84f2b9..00000000 --- a/Pods/Realm/LICENSE +++ /dev/null @@ -1,244 +0,0 @@ -TABLE OF CONTENTS - -1. Apache License version 2.0 -2. Realm Components -3. Export Compliance - -------------------------------------------------------------------------------- - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -REALM COMPONENTS - -This software contains components with separate copyright and license terms. -Your use of these components is subject to the terms and conditions of the -following licenses. - -For the Realm Core component - - Realm Core Binary License - - Copyright (c) 2011-2016 Realm Inc All rights reserved - - Redistribution and use in binary form, with or without modification, is - permitted provided that the following conditions are met: - - 1. You agree not to attempt to decompile, disassemble, reverse engineer or - otherwise discover the source code from which the binary code was derived. - You may, however, access and obtain a separate license for most of the - source code from which this Software was created, at - http://realm.io/pricing/. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - -EXPORT COMPLIANCE - -You understand that the Software may contain cryptographic functions that may be -subject to export restrictions, and you represent and warrant that you are not -(i) located in a jurisdiction that is subject to United States economic -sanctions (“Prohibited Jurisdiction”), including Cuba, Iran, North Korea, -Sudan, Syria or the Crimea region, (ii) a person listed on any U.S. government -blacklist (to include the List of Specially Designated Nationals and Blocked -Persons or the Consolidated Sanctions List administered by the U.S. Department -of the Treasury’s Office of Foreign Assets Control, or the Denied Persons List -or Entity List administered by the U.S. Department of Commerce) -(“Sanctioned Person”), or (iii) controlled or 50% or more owned by a Sanctioned -Person. - -You agree to comply with all export, re-export and import restrictions and -regulations of the U.S. Department of Commerce or other agency or authority of -the United States or other applicable countries. You also agree not to transfer, -or authorize the transfer of, directly or indirectly, of the Software to any -Prohibited Jurisdiction, or otherwise in violation of any such restrictions or -regulations. diff --git a/Pods/Realm/README.md b/Pods/Realm/README.md deleted file mode 100644 index 0a95cb92..00000000 --- a/Pods/Realm/README.md +++ /dev/null @@ -1,74 +0,0 @@ -![Realm](https://github.com/realm/realm-cocoa/raw/master/logo.png) - -Realm is a mobile database that runs directly inside phones, tablets or wearables. -This repository holds the source code for the iOS, macOS, tvOS & watchOS versions of Realm Swift & Realm Objective-C. - -## Features - -* **Mobile-first:** Realm is the first database built from the ground up to run directly inside phones, tablets and wearables. -* **Simple:** Data is directly [exposed as objects](https://realm.io/docs/objc/latest/#models) and [queryable by code](https://realm.io/docs/objc/latest/#queries), removing the need for ORM's riddled with performance & maintenance issues. Most of our users pick it up intuitively, getting simple apps up & running in minutes. -* **Modern:** Realm supports relationships, generics, vectorization and even Swift. -* **Fast:** Realm is faster than even raw SQLite on common operations, while maintaining an extremely rich feature set. - -## Getting Started - -Please see the detailed instructions in our docs to add [Realm Objective-C](https://realm.io/docs/objc/latest/#installation) _or_ [Realm Swift](https://realm.io/docs/swift/latest/#installation) to your Xcode project. - -## Documentation - -### Realm Objective-C - -The documentation can be found at [realm.io/docs/objc/latest](https://realm.io/docs/objc/latest). -The API reference is located at [realm.io/docs/objc/latest/api](https://realm.io/docs/objc/latest/api). - -### Realm Swift - -The documentation can be found at [realm.io/docs/swift/latest](https://realm.io/docs/swift/latest). -The API reference is located at [realm.io/docs/swift/latest/api](https://realm.io/docs/swift/latest/api). - -## Getting Help - -- **Need help with your code?**: Look for previous questions on the [#realm tag](https://stackoverflow.com/questions/tagged/realm?sort=newest) — or [ask a new question](https://stackoverflow.com/questions/ask?tags=realm). We actively monitor & answer questions on SO! -- **Have a bug to report?** [Open an issue](https://github.com/realm/realm-cocoa/issues/new). If possible, include the version of Realm, a full log, the Realm file, and a project that shows the issue. -- **Have a feature request?** [Open an issue](https://github.com/realm/realm-cocoa/issues/new). Tell us what the feature should do, and why you want the feature. -- Sign up for our [**Community Newsletter**](https://www2.realm.io/l/210132/2016-12-05/fy9m) to get regular tips, learn about other use-cases and get alerted of blogposts and tutorials about Realm. - -## Building Realm - -In case you don't want to use the precompiled version, you can build Realm yourself from source. - -Prerequisites: - -* Building Realm requires Xcode 8.x. -* If cloning from git, submodules are required: `git submodule update --init --recursive`. -* Building Realm documentation requires [jazzy](https://github.com/realm/jazzy) - -Once you have all the necessary prerequisites, building Realm.framework just takes a single command: `sh build.sh build`. You'll need an internet connection the first time you build Realm to download the core binary. - -Run `sh build.sh help` to see all the actions you can perform (build ios/osx, generate docs, test, etc.). - -## Contributing - -See [CONTRIBUTING.md](CONTRIBUTING.md) for more details! - -This project adheres to the [Contributor Covenant Code of Conduct](https://realm.io/conduct). -By participating, you are expected to uphold this code. Please report -unacceptable behavior to [info@realm.io](mailto:info@realm.io). - -## License - -Realm Objective-C & Realm Swift are published under the Apache 2.0 license. -Realm Core is also published under the Apache 2.0 license and is available -[here](https://github.com/realm/realm-core). - -**This product is not being made available to any person located in Cuba, Iran, -North Korea, Sudan, Syria or the Crimea region, or to any other person that is -not eligible to receive the product under U.S. law.** - -## Feedback - -**_If you use Realm and are happy with it, all we ask is that you please consider sending out a tweet mentioning [@realm](https://twitter.com/realm) or email [help@realm.io](mailto:help@realm.io) to share your thoughts!_** - -**_And if you don't like it, please let us know what you would like improved, so we can fix it!_** - -![analytics](https://ga-beacon.appspot.com/UA-50247013-2/realm-cocoa/README?pixel) diff --git a/Pods/Realm/Realm/NSError+RLMSync.m b/Pods/Realm/Realm/NSError+RLMSync.m deleted file mode 100644 index 20938a76..00000000 --- a/Pods/Realm/Realm/NSError+RLMSync.m +++ /dev/null @@ -1,39 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2017 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "NSError+RLMSync.h" - -#import "RLMSyncUtil.h" - -@implementation NSError (RLMSync) - -- (void(^)(void))rlmSync_clientResetBlock { - if (self.domain == RLMSyncErrorDomain && self.code == RLMSyncErrorClientResetError) { - return self.userInfo[kRLMSyncInitiateClientResetBlockKey]; - } - return nil; -} - -- (NSString *)rlmSync_clientResetBackedUpRealmPath { - if (self.domain == RLMSyncErrorDomain && self.code == RLMSyncErrorClientResetError) { - return self.userInfo[kRLMSyncPathOfRealmBackupCopyKey]; - } - return nil; -} - -@end diff --git a/Pods/Realm/Realm/ObjectStore/src/collection_notifications.cpp b/Pods/Realm/Realm/ObjectStore/src/collection_notifications.cpp deleted file mode 100644 index 165021d8..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/collection_notifications.cpp +++ /dev/null @@ -1,61 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "collection_notifications.hpp" - -#include "impl/collection_notifier.hpp" - -using namespace realm; -using namespace realm::_impl; - -NotificationToken::NotificationToken(std::shared_ptr<_impl::CollectionNotifier> notifier, size_t token) -: m_notifier(std::move(notifier)), m_token(token) -{ -} - -NotificationToken::~NotificationToken() -{ - // m_notifier itself (and not just the pointed-to thing) needs to be accessed - // atomically to ensure that there are no data races when the token is - // destroyed after being modified on a different thread. - // This is needed despite the token not being thread-safe in general as - // users find it very surprising for obj-c objects to care about what - // thread they are deallocated on. - if (auto notifier = m_notifier.exchange({})) { - notifier->remove_callback(m_token); - } -} - -NotificationToken::NotificationToken(NotificationToken&&) = default; - -NotificationToken& NotificationToken::operator=(realm::NotificationToken&& rgt) -{ - if (this != &rgt) { - if (auto notifier = m_notifier.exchange({})) { - notifier->remove_callback(m_token); - } - m_notifier = std::move(rgt.m_notifier); - m_token = rgt.m_token; - } - return *this; -} - -void NotificationToken::suppress_next() -{ - m_notifier.load()->suppress_next_notification(m_token); -} diff --git a/Pods/Realm/Realm/ObjectStore/src/impl/apple/external_commit_helper.cpp b/Pods/Realm/Realm/ObjectStore/src/impl/apple/external_commit_helper.cpp deleted file mode 100644 index 60f7a660..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/impl/apple/external_commit_helper.cpp +++ /dev/null @@ -1,229 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "impl/external_commit_helper.hpp" - -#include "impl/realm_coordinator.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace realm; -using namespace realm::_impl; - -namespace { -// Write a byte to a pipe to notify anyone waiting for data on the pipe -void notify_fd(int fd, int read_fd) -{ - while (true) { - char c = 0; - ssize_t ret = write(fd, &c, 1); - if (ret == 1) { - break; - } - - // If the pipe's buffer is full, we need to read some of the old data in - // it to make space. We don't just read in the code waiting for - // notifications so that we can notify multiple waiters with a single - // write. - assert(ret == -1 && errno == EAGAIN); - char buff[1024]; - read(read_fd, buff, sizeof buff); - } -} -} // anonymous namespace - -void ExternalCommitHelper::FdHolder::close() -{ - if (m_fd != -1) { - ::close(m_fd); - } - m_fd = -1; -} - -// Inter-thread and inter-process notifications of changes are done using a -// named pipe in the filesystem next to the Realm file. Everyone who wants to be -// notified of commits waits for data to become available on the pipe, and anyone -// who commits a write transaction writes data to the pipe after releasing the -// write lock. Note that no one ever actually *reads* from the pipe: the data -// actually written is meaningless, and trying to read from a pipe from multiple -// processes at once is fraught with race conditions. - -// When a RLMRealm instance is created, we add a CFRunLoopSource to the current -// thread's runloop. On each cycle of the run loop, the run loop checks each of -// its sources for work to do, which in the case of CFRunLoopSource is just -// checking if CFRunLoopSourceSignal has been called since the last time it ran, -// and if so invokes the function pointer supplied when the source is created, -// which in our case just invokes `[realm handleExternalChange]`. - -// Listening for external changes is done using kqueue() on a background thread. -// kqueue() lets us efficiently wait until the amount of data which can be read -// from one or more file descriptors has changed, and tells us which of the file -// descriptors it was that changed. We use this to wait on both the shared named -// pipe, and a local anonymous pipe. When data is written to the named pipe, we -// signal the runloop source and wake up the target runloop, and when data is -// written to the anonymous pipe the background thread removes the runloop -// source from the runloop and and shuts down. -ExternalCommitHelper::ExternalCommitHelper(RealmCoordinator& parent) -: m_parent(parent) -{ - m_kq = kqueue(); - if (m_kq == -1) { - throw std::system_error(errno, std::system_category()); - } - -#if !TARGET_OS_TV - auto path = parent.get_path() + ".note"; - - // Create and open the named pipe - int ret = mkfifo(path.c_str(), 0600); - if (ret == -1) { - int err = errno; - if (err == ENOTSUP) { - // Filesystem doesn't support named pipes, so try putting it in tmp instead - // Hash collisions are okay here because they just result in doing - // extra work, as opposed to correctness problems - std::ostringstream ss; - ss << getenv("TMPDIR"); - ss << "realm_" << std::hash()(path) << ".note"; - path = ss.str(); - ret = mkfifo(path.c_str(), 0600); - err = errno; - } - // the fifo already existing isn't an error - if (ret == -1 && err != EEXIST) { - throw std::system_error(err, std::system_category()); - } - } - - m_notify_fd = open(path.c_str(), O_RDWR); - if (m_notify_fd == -1) { - throw std::system_error(errno, std::system_category()); - } - - // Make writing to the pipe return -1 when the pipe's buffer is full - // rather than blocking until there's space available - ret = fcntl(m_notify_fd, F_SETFL, O_NONBLOCK); - if (ret == -1) { - throw std::system_error(errno, std::system_category()); - } - -#else // !TARGET_OS_TV - - // tvOS does not support named pipes, so use an anonymous pipe instead - int notification_pipe[2]; - int ret = pipe(notification_pipe); - if (ret == -1) { - throw std::system_error(errno, std::system_category()); - } - - m_notify_fd = notification_pipe[0]; - m_notify_fd_write = notification_pipe[1]; - -#endif // TARGET_OS_TV - - // Create the anonymous pipe for shutdown notifications - int shutdown_pipe[2]; - ret = pipe(shutdown_pipe); - if (ret == -1) { - throw std::system_error(errno, std::system_category()); - } - - m_shutdown_read_fd = shutdown_pipe[0]; - m_shutdown_write_fd = shutdown_pipe[1]; - - m_thread = std::async(std::launch::async, [=] { - try { - listen(); - } -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - catch (std::exception const& e) { - fprintf(stderr, "uncaught exception in notifier thread: %s: %s\n", typeid(e).name(), e.what()); - asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "uncaught exception in notifier thread: %s: %s", typeid(e).name(), e.what()); - throw; - } - catch (...) { - fprintf(stderr, "uncaught exception in notifier thread\n"); - asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "uncaught exception in notifier thread"); - throw; - } -#pragma clang diagnostic pop - }); -} - -ExternalCommitHelper::~ExternalCommitHelper() -{ - notify_fd(m_shutdown_write_fd, m_shutdown_read_fd); - m_thread.wait(); // Wait for the thread to exit -} - -void ExternalCommitHelper::listen() -{ - pthread_setname_np("RLMRealm notification listener"); - - // Set up the kqueue - // EVFILT_READ indicates that we care about data being available to read - // on the given file descriptor. - // EV_CLEAR makes it wait for the amount of data available to be read to - // change rather than just returning when there is any data to read. - struct kevent ke[2]; - EV_SET(&ke[0], m_notify_fd, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0); - EV_SET(&ke[1], m_shutdown_read_fd, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0); - int ret = kevent(m_kq, ke, 2, nullptr, 0, nullptr); - assert(ret == 0); - - while (true) { - struct kevent event; - // Wait for data to become on either fd - // Return code is number of bytes available or -1 on error - ret = kevent(m_kq, nullptr, 0, &event, 1, nullptr); - assert(ret >= 0); - if (ret == 0) { - // Spurious wakeup; just wait again - continue; - } - - // Check which file descriptor had activity: if it's the shutdown - // pipe, then someone called -stop; otherwise it's the named pipe - // and someone committed a write transaction - if (event.ident == (uint32_t)m_shutdown_read_fd) { - return; - } - assert(event.ident == (uint32_t)m_notify_fd); - - m_parent.on_change(); - } -} - -void ExternalCommitHelper::notify_others() -{ - if (m_notify_fd_write != -1) { - notify_fd(m_notify_fd_write, m_notify_fd); - } - else { - notify_fd(m_notify_fd, m_notify_fd); - } -} diff --git a/Pods/Realm/Realm/ObjectStore/src/impl/apple/keychain_helper.cpp b/Pods/Realm/Realm/ObjectStore/src/impl/apple/keychain_helper.cpp deleted file mode 100644 index b12128df..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/impl/apple/keychain_helper.cpp +++ /dev/null @@ -1,115 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "impl/apple/keychain_helper.hpp" - -#include "util/format.hpp" - -#include -#include - -#include - -#include - -using realm::util::CFPtr; -using realm::util::adoptCF; - -namespace realm { -namespace keychain { - -KeychainAccessException::KeychainAccessException(int32_t error_code) -: std::runtime_error(util::format("Keychain returned unexpected status code: %1", error_code)) { } - -CFPtr convert_string(const std::string& string); -CFPtr build_search_dictionary(const std::string& account, const std::string& service, - util::Optional group); - -CFPtr convert_string(const std::string& string) -{ - auto result = adoptCF(CFStringCreateWithBytes(nullptr, reinterpret_cast(string.data()), - string.size(), kCFStringEncodingASCII, false)); - if (!result) { - throw std::bad_alloc(); - } - return result; -} - -CFPtr build_search_dictionary(const std::string& account, const std::string& service, - __unused util::Optional group) -{ - auto d = adoptCF(CFDictionaryCreateMutable(nullptr, 0, &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks)); - if (!d) { - throw std::bad_alloc(); - } - CFDictionaryAddValue(d.get(), kSecClass, kSecClassGenericPassword); - CFDictionaryAddValue(d.get(), kSecReturnData, kCFBooleanTrue); - CFDictionaryAddValue(d.get(), kSecAttrAccessible, kSecAttrAccessibleAlways); - CFDictionaryAddValue(d.get(), kSecAttrAccount, convert_string(account).get()); - CFDictionaryAddValue(d.get(), kSecAttrService, convert_string(service).get()); -#if TARGET_IPHONE_SIMULATOR -#else - if (group) { - CFDictionaryAddValue(d.get(), kSecAttrAccessGroup, convert_string(*group).get()); - } -#endif - return d; -} - -std::vector metadata_realm_encryption_key() -{ - const size_t key_size = 64; - const std::string service = "io.realm.sync.keychain"; - const std::string account = "metadata"; - - auto search_dictionary = build_search_dictionary(account, service, none); - CFDataRef retained_key_data; - if (OSStatus status = SecItemCopyMatching(search_dictionary.get(), (CFTypeRef *)&retained_key_data)) { - if (status != errSecItemNotFound) { - throw KeychainAccessException(status); - } - - // Key was not found. Generate a new key, store it, and return it. - std::vector key(key_size); - arc4random_buf(key.data(), key_size); - auto key_data = adoptCF(CFDataCreate(nullptr, reinterpret_cast(key.data()), key_size)); - if (!key_data) { - throw std::bad_alloc(); - } - - CFDictionaryAddValue(search_dictionary.get(), kSecValueData, key_data.get()); - if (OSStatus status = SecItemAdd(search_dictionary.get(), nullptr)) { - throw KeychainAccessException(status); - } - - return key; - } - CFPtr key_data = adoptCF(retained_key_data); - - // Key was previously stored. Extract it. - if (key_size != CFDataGetLength(key_data.get())) { - throw std::runtime_error("Password stored in keychain was not expected size."); - } - - auto key_bytes = reinterpret_cast(CFDataGetBytePtr(key_data.get())); - return std::vector(key_bytes, key_bytes + key_size); -} - -} -} diff --git a/Pods/Realm/Realm/ObjectStore/src/impl/collection_change_builder.cpp b/Pods/Realm/Realm/ObjectStore/src/impl/collection_change_builder.cpp deleted file mode 100644 index a2257647..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/impl/collection_change_builder.cpp +++ /dev/null @@ -1,886 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "impl/collection_change_builder.hpp" - -#include -#include - -#include - -using namespace realm; -using namespace realm::_impl; - -CollectionChangeBuilder::CollectionChangeBuilder(IndexSet deletions, - IndexSet insertions, - IndexSet modifications, - std::vector moves) -: CollectionChangeSet({std::move(deletions), std::move(insertions), std::move(modifications), {}, std::move(moves)}) -{ - for (auto&& move : this->moves) { - this->deletions.add(move.from); - this->insertions.add(move.to); - } -} - -void CollectionChangeBuilder::merge(CollectionChangeBuilder&& c) -{ - if (c.empty()) - return; - if (empty()) { - *this = std::move(c); - return; - } - - verify(); - c.verify(); - - auto for_each_col = [&](auto&& f) { - f(modifications, c.modifications); - if (m_track_columns) { - if (columns.size() < c.columns.size()) - columns.resize(c.columns.size()); - else if (columns.size() > c.columns.size()) - c.columns.resize(columns.size()); - for (size_t i = 0; i < columns.size(); ++i) - f(columns[i], c.columns[i]); - } - }; - - // First update any old moves - if (!c.moves.empty() || !c.deletions.empty() || !c.insertions.empty()) { - auto it = std::remove_if(begin(moves), end(moves), [&](auto& old) { - // Check if the moved row was moved again, and if so just update the destination - auto it = find_if(begin(c.moves), end(c.moves), [&](auto const& m) { - return old.to == m.from; - }); - if (it != c.moves.end()) { - for_each_col([&](auto& col, auto& other) { - if (col.contains(it->from)) - other.add(it->to); - }); - old.to = it->to; - *it = c.moves.back(); - c.moves.pop_back(); - ++it; - return false; - } - - // Check if the destination was deleted - // Removing the insert for this move will happen later - if (c.deletions.contains(old.to)) - return true; - - // Update the destination to adjust for any new insertions and deletions - old.to = c.insertions.shift(c.deletions.unshift(old.to)); - return false; - }); - moves.erase(it, end(moves)); - } - - // Ignore new moves of rows which were previously inserted (the implicit - // delete from the move will remove the insert) - if (!insertions.empty() && !c.moves.empty()) { - c.moves.erase(std::remove_if(begin(c.moves), end(c.moves), - [&](auto const& m) { return insertions.contains(m.from); }), - end(c.moves)); - } - - // Ensure that any previously modified rows which were moved are still modified - if (!modifications.empty() && !c.moves.empty()) { - for (auto const& move : c.moves) { - for_each_col([&](auto& col, auto& other) { - if (col.contains(move.from)) - other.add(move.to); - }); - } - } - - // Update the source position of new moves to compensate for the changes made - // in the old changeset - if (!deletions.empty() || !insertions.empty()) { - for (auto& move : c.moves) - move.from = deletions.shift(insertions.unshift(move.from)); - } - - moves.insert(end(moves), begin(c.moves), end(c.moves)); - - // New deletion indices have been shifted by the insertions, so unshift them - // before adding - deletions.add_shifted_by(insertions, c.deletions); - - // Drop any inserted-then-deleted rows, then merge in new insertions - insertions.erase_at(c.deletions); - insertions.insert_at(c.insertions); - - clean_up_stale_moves(); - - for_each_col([&](auto& col, auto& other) { - col.erase_at(c.deletions); - col.shift_for_insert_at(c.insertions); - col.add(other); - }); - - c = {}; - verify(); -} - -void CollectionChangeBuilder::clean_up_stale_moves() -{ - // Look for moves which are now no-ops, and remove them plus the associated - // insert+delete. Note that this isn't just checking for from == to due to - // that rows can also be shifted by other inserts and deletes - moves.erase(std::remove_if(begin(moves), end(moves), [&](auto const& move) { - if (move.from - deletions.count(0, move.from) != move.to - insertions.count(0, move.to)) - return false; - deletions.remove(move.from); - insertions.remove(move.to); - return true; - }), end(moves)); -} - -void CollectionChangeBuilder::parse_complete() -{ - moves.reserve(m_move_mapping.size()); - for (auto move : m_move_mapping) { - REALM_ASSERT_DEBUG(deletions.contains(move.second)); - REALM_ASSERT_DEBUG(insertions.contains(move.first)); - if (move.first == move.second) { - deletions.remove(move.second); - insertions.remove(move.first); - } - else - moves.push_back({move.second, move.first}); - } - m_move_mapping.clear(); - std::sort(begin(moves), end(moves), - [](auto const& a, auto const& b) { return a.from < b.from; }); -} - -void CollectionChangeBuilder::modify(size_t ndx, size_t col) -{ - modifications.add(ndx); - if (!m_track_columns || col == IndexSet::npos) - return; - - if (col >= columns.size()) - columns.resize(col + 1); - columns[col].add(ndx); -} - -template -void CollectionChangeBuilder::for_each_col(Func&& f) -{ - f(modifications); - if (m_track_columns) { - for (auto& col : columns) - f(col); - } -} - -void CollectionChangeBuilder::insert(size_t index, size_t count, bool track_moves) -{ - for_each_col([=](auto& col) { col.shift_for_insert_at(index, count); }); - if (!track_moves) - return; - - insertions.insert_at(index, count); - - for (auto& move : moves) { - if (move.to >= index) - ++move.to; - } - - if (m_move_mapping.empty()) - return; - - // m_move_mapping is new_ndx -> old_ndx, so updating the keys requires - // deleting and re-inserting at the new index - std::vector> shifted; - for (auto it = m_move_mapping.begin(); it != m_move_mapping.end(); ) { - if (it->first >= index) { - shifted.emplace_back(it->first + count, it->second); - it = m_move_mapping.erase(it); - } - else { - ++it; - } - } - for (auto& pair : shifted) - m_move_mapping.insert(pair); -} - -void CollectionChangeBuilder::erase(size_t index) -{ - for_each_col([=](auto& col) { col.erase_at(index); }); - size_t unshifted = insertions.erase_or_unshift(index); - if (unshifted != IndexSet::npos) - deletions.add_shifted(unshifted); - - for (size_t i = 0; i < moves.size(); ++i) { - auto& move = moves[i]; - if (move.to == index) { - moves.erase(moves.begin() + i); - --i; - } - else if (move.to > index) - --move.to; - } -} - -void CollectionChangeBuilder::clear(size_t old_size) -{ - if (old_size != std::numeric_limits::max()) { - for (auto range : deletions) - old_size += range.second - range.first; - for (auto range : insertions) - old_size -= range.second - range.first; - } - - modifications.clear(); - insertions.clear(); - moves.clear(); - m_move_mapping.clear(); - columns.clear(); - deletions.set(old_size); -} - -void CollectionChangeBuilder::move(size_t from, size_t to) -{ - REALM_ASSERT(from != to); - - bool updated_existing_move = false; - for (auto& move : moves) { - if (move.to != from) { - // Shift other moves if this row is moving from one side of them - // to the other - if (move.to >= to && move.to < from) - ++move.to; - else if (move.to <= to && move.to > from) - --move.to; - continue; - } - REALM_ASSERT(!updated_existing_move); - - // Collapse A -> B, B -> C into a single A -> C move - move.to = to; - updated_existing_move = true; - - insertions.erase_at(from); - insertions.insert_at(to); - } - - if (!updated_existing_move) { - auto shifted_from = insertions.erase_or_unshift(from); - insertions.insert_at(to); - - // Don't report deletions/moves for newly inserted rows - if (shifted_from != IndexSet::npos) { - shifted_from = deletions.add_shifted(shifted_from); - moves.push_back({shifted_from, to}); - } - } - - for_each_col([=](auto& col) { - bool modified = col.contains(from); - col.erase_at(from); - - if (modified) - col.insert_at(to); - else - col.shift_for_insert_at(to); - }); -} - -void CollectionChangeBuilder::move_over(size_t row_ndx, size_t last_row, bool track_moves) -{ - REALM_ASSERT(row_ndx <= last_row); - REALM_ASSERT(insertions.empty() || prev(insertions.end())->second - 1 <= last_row); - REALM_ASSERT(modifications.empty() || prev(modifications.end())->second - 1 <= last_row); - - if (row_ndx == last_row) { - if (track_moves) { - auto shifted_from = insertions.erase_or_unshift(row_ndx); - if (shifted_from != IndexSet::npos) - deletions.add_shifted(shifted_from); - m_move_mapping.erase(row_ndx); - } - for_each_col([=](auto& col) { col.remove(row_ndx); }); - return; - } - - for_each_col([=](auto& col) { - bool modified = col.contains(last_row); - if (modified) { - col.remove(last_row); - col.add(row_ndx); - } - else - col.remove(row_ndx); - }); - - if (!track_moves) - return; - - bool row_is_insertion = insertions.contains(row_ndx); - bool last_is_insertion = !insertions.empty() && prev(insertions.end())->second == last_row + 1; - REALM_ASSERT_DEBUG(insertions.empty() || prev(insertions.end())->second <= last_row + 1); - - // Collapse A -> B, B -> C into a single A -> C move - bool last_was_already_moved = false; - if (last_is_insertion) { - auto it = m_move_mapping.find(last_row); - if (it != m_move_mapping.end() && it->first == last_row) { - m_move_mapping[row_ndx] = it->second; - m_move_mapping.erase(it); - last_was_already_moved = true; - } - } - - // Remove moves to the row being deleted - if (row_is_insertion && !last_was_already_moved) { - auto it = m_move_mapping.find(row_ndx); - if (it != m_move_mapping.end() && it->first == row_ndx) - m_move_mapping.erase(it); - } - - // Don't report deletions/moves if last_row is newly inserted - if (last_is_insertion) { - insertions.remove(last_row); - } - // If it was previously moved, the unshifted source row has already been marked as deleted - else if (!last_was_already_moved) { - auto shifted_last_row = insertions.unshift(last_row); - shifted_last_row = deletions.add_shifted(shifted_last_row); - m_move_mapping[row_ndx] = shifted_last_row; - } - - // Don't mark the moved-over row as deleted if it was a new insertion - if (!row_is_insertion) { - deletions.add_shifted(insertions.unshift(row_ndx)); - insertions.add(row_ndx); - } - verify(); -} - -void CollectionChangeBuilder::swap(size_t ndx_1, size_t ndx_2, bool track_moves) -{ - REALM_ASSERT(ndx_1 != ndx_2); - // The order of the two indices doesn't matter semantically, but making them - // consistent simplifies the logic - if (ndx_1 > ndx_2) - std::swap(ndx_1, ndx_2); - - for_each_col([=](auto& col) { - bool row_1_modified = col.contains(ndx_1); - bool row_2_modified = col.contains(ndx_2); - if (row_1_modified != row_2_modified) { - if (row_1_modified) { - col.remove(ndx_1); - col.add(ndx_2); - } - else { - col.remove(ndx_2); - col.add(ndx_1); - } - } - }); - - if (!track_moves) - return; - - auto update_move = [&](auto existing_it, auto ndx_1, auto ndx_2) { - // update the existing move to ndx_2 to point at ndx_1 - auto original = existing_it->second; - m_move_mapping.erase(existing_it); - m_move_mapping[ndx_1] = original; - - // add a move from 1 -> 2 unless 1 was a new insertion - if (!insertions.contains(ndx_1)) { - m_move_mapping[ndx_2] = deletions.add_shifted(insertions.unshift(ndx_1)); - insertions.add(ndx_1); - } - REALM_ASSERT_DEBUG(insertions.contains(ndx_2)); - }; - - auto move_1 = m_move_mapping.find(ndx_1); - auto move_2 = m_move_mapping.find(ndx_2); - bool have_move_1 = move_1 != end(m_move_mapping) && move_1->first == ndx_1; - bool have_move_2 = move_2 != end(m_move_mapping) && move_2->first == ndx_2; - if (have_move_1 && have_move_2) { - // both are already moves, so just swap the destinations - std::swap(move_1->second, move_2->second); - } - else if (have_move_1) { - update_move(move_1, ndx_2, ndx_1); - } - else if (have_move_2) { - update_move(move_2, ndx_1, ndx_2); - } - else { - // ndx_2 needs to be done before 1 to avoid incorrect shifting - if (!insertions.contains(ndx_2)) { - m_move_mapping[ndx_1] = deletions.add_shifted(insertions.unshift(ndx_2)); - insertions.add(ndx_2); - } - if (!insertions.contains(ndx_1)) { - m_move_mapping[ndx_2] = deletions.add_shifted(insertions.unshift(ndx_1)); - insertions.add(ndx_1); - } - } -} - -void CollectionChangeBuilder::subsume(size_t old_ndx, size_t new_ndx, bool track_moves) -{ - REALM_ASSERT(old_ndx != new_ndx); - - for_each_col([=](auto& col) { - if (col.contains(old_ndx)) { - col.add(new_ndx); - } - }); - - if (!track_moves) - return; - - REALM_ASSERT_DEBUG(insertions.contains(new_ndx)); - REALM_ASSERT_DEBUG(!m_move_mapping.count(new_ndx)); - - // If the source row was already moved, update the existing move - auto it = m_move_mapping.find(old_ndx); - if (it != m_move_mapping.end() && it->first == old_ndx) { - m_move_mapping[new_ndx] = it->second; - m_move_mapping.erase(it); - } - // otherwise add a new move unless it was a new insertion - else if (!insertions.contains(old_ndx)) { - m_move_mapping[new_ndx] = deletions.shift(insertions.unshift(old_ndx)); - } - - verify(); -} - -void CollectionChangeBuilder::verify() -{ -#ifdef REALM_DEBUG - for (auto&& move : moves) { - REALM_ASSERT(deletions.contains(move.from)); - REALM_ASSERT(insertions.contains(move.to)); - } -#endif -} - -void CollectionChangeBuilder::insert_column(size_t ndx) -{ - if (ndx < columns.size()) - columns.insert(columns.begin() + ndx, IndexSet{}); -} - -void CollectionChangeBuilder::move_column(size_t from, size_t to) -{ - if (from >= columns.size() && to >= columns.size()) - return; - if (from >= columns.size() || to >= columns.size()) - columns.resize(std::max(from, to) + 1); - if (from < to) - std::rotate(begin(columns) + from, begin(columns) + from + 1, begin(columns) + to + 1); - else - std::rotate(begin(columns) + to, begin(columns) + from, begin(columns) + from + 1); -} - -namespace { -struct RowInfo { - size_t row_index; - size_t prev_tv_index; - size_t tv_index; - size_t shifted_tv_index; -}; - -// Calculates the insertions/deletions required for a query on a table without -// a sort, where `removed` includes the rows which were modified to no longer -// match the query (but not outright deleted rows, which are filtered out long -// before any of this logic), and `move_candidates` tracks the rows which may -// be the result of a move. -// -// This function is not strictly required, as calculate_moves_sorted() will -// produce correct results even for the scenarios where this function is used. -// However, this function has asymptotically better worst-case performance and -// extremely cheap best-case performance, and is guaranteed to produce a minimal -// diff when the only row moves are due to move_last_over(). -void calculate_moves_unsorted(std::vector& new_rows, IndexSet& removed, - IndexSet const& move_candidates, - CollectionChangeSet& changeset) -{ - // Here we track which row we expect to see, which in the absence of swap() - // is always the row immediately after the last row which was not moved. - size_t expected = 0; - for (auto& row : new_rows) { - if (row.shifted_tv_index == expected) { - ++expected; - continue; - } - - // We didn't find the row we were expecting to find, which means that - // either a row was moved forward to here, the row we were expecting was - // removed, or the row we were expecting moved back. - - // First check if this row even could have moved. If it can't, just - // treat it as a match and move on, and we'll handle the row we were - // expecting when we hit it later. - if (!move_candidates.contains(row.row_index)) { - expected = row.shifted_tv_index + 1; - continue; - } - - // Next calculate where we expect this row to be based on the insertions - // and removals (i.e. rows changed to not match the query), as it could - // be that the row actually ends up in this spot due to the rows before - // it being removed. - size_t calc_expected = row.tv_index - changeset.insertions.count(0, row.tv_index) + removed.count(0, row.prev_tv_index); - if (row.shifted_tv_index == calc_expected) { - expected = calc_expected + 1; - continue; - } - - // The row still isn't the expected one, so record it as a move - changeset.moves.push_back({row.prev_tv_index, row.tv_index}); - changeset.insertions.add(row.tv_index); - removed.add(row.prev_tv_index); - } -} - -class LongestCommonSubsequenceCalculator { -public: - // A pair of an index in the table and an index in the table view - struct Row { - size_t row_index; - size_t tv_index; - }; - - struct Match { - // The index in `a` at which this match begins - size_t i; - // The index in `b` at which this match begins - size_t j; - // The length of this match - size_t size; - // The number of rows in this block which were modified - size_t modified; - }; - std::vector m_longest_matches; - - LongestCommonSubsequenceCalculator(std::vector& a, std::vector& b, - size_t start_index, - IndexSet const& modifications) - : m_modified(modifications) - , a(a), b(b) - { - find_longest_matches(start_index, a.size(), - start_index, b.size()); - m_longest_matches.push_back({a.size(), b.size(), 0}); - } - -private: - IndexSet const& m_modified; - - // The two arrays of rows being diffed - // a is sorted by tv_index, b is sorted by row_index - std::vector &a, &b; - - // Find the longest matching range in (a + begin1, a + end1) and (b + begin2, b + end2) - // "Matching" is defined as "has the same row index"; the TV index is just - // there to let us turn an index in a/b into an index which can be reported - // in the output changeset. - // - // This is done with the O(N) space variant of the dynamic programming - // algorithm for longest common subsequence, where N is the maximum number - // of the most common row index (which for everything but linkview-derived - // TVs will be 1). - Match find_longest_match(size_t begin1, size_t end1, size_t begin2, size_t end2) - { - struct Length { - size_t j, len; - }; - // The length of the matching block for each `j` for the previously checked row - std::vector prev; - // The length of the matching block for each `j` for the row currently being checked - std::vector cur; - - // Calculate the length of the matching block *ending* at b[j], which - // is 1 if b[j - 1] did not match, and b[j - 1] + 1 otherwise. - auto length = [&](size_t j) -> size_t { - for (auto const& pair : prev) { - if (pair.j + 1 == j) - return pair.len + 1; - } - return 1; - }; - - // Iterate over each `j` which has the same row index as a[i] and falls - // within the range begin2 <= j < end2 - auto for_each_b_match = [&](size_t i, auto&& f) { - size_t ai = a[i].row_index; - // Find the TV indicies at which this row appears in the new results - // There should always be at least one (or it would have been - // filtered out earlier), but there can be multiple if there are dupes - auto it = lower_bound(begin(b), end(b), ai, - [](auto lft, auto rgt) { return lft.row_index < rgt; }); - REALM_ASSERT(it != end(b) && it->row_index == ai); - for (; it != end(b) && it->row_index == ai; ++it) { - size_t j = it->tv_index; - if (j < begin2) - continue; - if (j >= end2) - break; // b is sorted by tv_index so this can't transition from false to true - f(j); - } - }; - - Match best = {begin1, begin2, 0, 0}; - for (size_t i = begin1; i < end1; ++i) { - // prev = std::move(cur), but avoids discarding prev's heap allocation - cur.swap(prev); - cur.clear(); - - for_each_b_match(i, [&](size_t j) { - size_t size = length(j); - - cur.push_back({j, size}); - - // If the matching block ending at a[i] and b[j] is longer than - // the previous one, select it as the best - if (size > best.size) - best = {i - size + 1, j - size + 1, size, IndexSet::npos}; - // Given two equal-length matches, prefer the one with fewer modified rows - else if (size == best.size) { - if (best.modified == IndexSet::npos) - best.modified = m_modified.count(best.j - size + 1, best.j + 1); - auto count = m_modified.count(j - size + 1, j + 1); - if (count < best.modified) - best = {i - size + 1, j - size + 1, size, count}; - } - - // The best block should always fall within the range being searched - REALM_ASSERT(best.i >= begin1 && best.i + best.size <= end1); - REALM_ASSERT(best.j >= begin2 && best.j + best.size <= end2); - }); - } - return best; - } - - void find_longest_matches(size_t begin1, size_t end1, size_t begin2, size_t end2) - { - // FIXME: recursion could get too deep here - // recursion depth worst case is currently O(N) and each recursion uses 320 bytes of stack - // could reduce worst case to O(sqrt(N)) (and typical case to O(log N)) - // biasing equal selections towards the middle, but that's still - // insufficient for Android's 8 KB stacks - auto m = find_longest_match(begin1, end1, begin2, end2); - if (!m.size) - return; - if (m.i > begin1 && m.j > begin2) - find_longest_matches(begin1, m.i, begin2, m.j); - m_longest_matches.push_back(m); - if (m.i + m.size < end2 && m.j + m.size < end2) - find_longest_matches(m.i + m.size, end1, m.j + m.size, end2); - } -}; - -void calculate_moves_sorted(std::vector& rows, CollectionChangeSet& changeset) -{ - // The RowInfo array contains information about the old and new TV indices of - // each row, which we need to turn into two sequences of rows, which we'll - // then find matches in - std::vector a, b; - - a.reserve(rows.size()); - for (auto& row : rows) { - a.push_back({row.row_index, row.prev_tv_index}); - } - std::sort(begin(a), end(a), [](auto lft, auto rgt) { - return std::tie(lft.tv_index, lft.row_index) < std::tie(rgt.tv_index, rgt.row_index); - }); - - // Before constructing `b`, first find the first index in `a` which will - // actually differ in `b`, and skip everything else if there aren't any - size_t first_difference = IndexSet::npos; - for (size_t i = 0; i < a.size(); ++i) { - if (a[i].row_index != rows[i].row_index) { - first_difference = i; - break; - } - } - if (first_difference == IndexSet::npos) - return; - - // Note that `b` is sorted by row_index, while `a` is sorted by tv_index - b.reserve(rows.size()); - for (size_t i = 0; i < rows.size(); ++i) - b.push_back({rows[i].row_index, i}); - std::sort(begin(b), end(b), [](auto lft, auto rgt) { - return std::tie(lft.row_index, lft.tv_index) < std::tie(rgt.row_index, rgt.tv_index); - }); - - // Calculate the LCS of the two sequences - auto matches = LongestCommonSubsequenceCalculator(a, b, first_difference, - changeset.modifications).m_longest_matches; - - // And then insert and delete rows as needed to align them - size_t i = first_difference, j = first_difference; - for (auto match : matches) { - for (; i < match.i; ++i) - changeset.deletions.add(a[i].tv_index); - for (; j < match.j; ++j) - changeset.insertions.add(rows[j].tv_index); - i += match.size; - j += match.size; - } -} - -} // Anonymous namespace - -CollectionChangeBuilder CollectionChangeBuilder::calculate(std::vector const& prev_rows, - std::vector const& next_rows, - std::function row_did_change, - util::Optional const& move_candidates) -{ - REALM_ASSERT_DEBUG(!move_candidates || std::is_sorted(begin(next_rows), end(next_rows))); - - CollectionChangeBuilder ret; - - size_t deleted = 0; - std::vector old_rows; - old_rows.reserve(prev_rows.size()); - for (size_t i = 0; i < prev_rows.size(); ++i) { - if (prev_rows[i] == IndexSet::npos) { - ++deleted; - ret.deletions.add(i); - } - else - old_rows.push_back({prev_rows[i], IndexSet::npos, i, i - deleted}); - } - std::sort(begin(old_rows), end(old_rows), [](auto& lft, auto& rgt) { - return lft.row_index < rgt.row_index; - }); - - std::vector new_rows; - new_rows.reserve(next_rows.size()); - for (size_t i = 0; i < next_rows.size(); ++i) { - new_rows.push_back({next_rows[i], IndexSet::npos, i, 0}); - } - std::sort(begin(new_rows), end(new_rows), [](auto& lft, auto& rgt) { - return lft.row_index < rgt.row_index; - }); - - // Don't add rows which were modified to not match the query to `deletions` - // immediately because the unsorted move logic needs to be able to - // distinguish them from rows which were outright deleted - IndexSet removed; - - // Now that our old and new sets of rows are sorted by row index, we can - // iterate over them and either record old+new TV indices for rows present - // in both, or mark them as inserted/deleted if they appear only in one - size_t i = 0, j = 0; - while (i < old_rows.size() && j < new_rows.size()) { - auto old_index = old_rows[i]; - auto new_index = new_rows[j]; - if (old_index.row_index == new_index.row_index) { - new_rows[j].prev_tv_index = old_rows[i].tv_index; - new_rows[j].shifted_tv_index = old_rows[i].shifted_tv_index; - ++i; - ++j; - } - else if (old_index.row_index < new_index.row_index) { - removed.add(old_index.tv_index); - ++i; - } - else { - ret.insertions.add(new_index.tv_index); - ++j; - } - } - - for (; i < old_rows.size(); ++i) - removed.add(old_rows[i].tv_index); - for (; j < new_rows.size(); ++j) - ret.insertions.add(new_rows[j].tv_index); - - // Filter out the new insertions since we don't need them for any of the - // further calculations - new_rows.erase(std::remove_if(begin(new_rows), end(new_rows), - [](auto& row) { return row.prev_tv_index == IndexSet::npos; }), - end(new_rows)); - std::sort(begin(new_rows), end(new_rows), - [](auto& lft, auto& rgt) { return lft.tv_index < rgt.tv_index; }); - - for (auto& row : new_rows) { - if (row_did_change(row.row_index)) { - ret.modifications.add(row.tv_index); - } - } - - if (move_candidates) { - calculate_moves_unsorted(new_rows, removed, *move_candidates, ret); - } - else { - calculate_moves_sorted(new_rows, ret); - } - ret.deletions.add(removed); - ret.verify(); - -#ifdef REALM_DEBUG - { // Verify that applying the calculated change to prev_rows actually produces next_rows - auto rows = prev_rows; - auto it = util::make_reverse_iterator(ret.deletions.end()); - auto end = util::make_reverse_iterator(ret.deletions.begin()); - for (; it != end; ++it) { - rows.erase(rows.begin() + it->first, rows.begin() + it->second); - } - - for (auto i : ret.insertions.as_indexes()) { - rows.insert(rows.begin() + i, next_rows[i]); - } - - REALM_ASSERT(rows == next_rows); - } -#endif - - return ret; -} - -CollectionChangeSet CollectionChangeBuilder::finalize() && -{ - // Calculate which indices in the old collection were modified - auto modifications_in_old = modifications; - modifications_in_old.erase_at(insertions); - modifications_in_old.shift_for_insert_at(deletions); - - // During changeset calculation we allow marking a row as both inserted and - // modified in case changeset merging results in it no longer being an insert, - // but we don't want inserts in the final modification set - modifications.remove(insertions); - - return { - std::move(deletions), - std::move(insertions), - std::move(modifications_in_old), - std::move(modifications), - std::move(moves), - std::move(columns) - }; -} diff --git a/Pods/Realm/Realm/ObjectStore/src/impl/collection_notifier.cpp b/Pods/Realm/Realm/ObjectStore/src/impl/collection_notifier.cpp deleted file mode 100644 index 0191d3de..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/impl/collection_notifier.cpp +++ /dev/null @@ -1,481 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "impl/collection_notifier.hpp" - -#include "impl/realm_coordinator.hpp" -#include "shared_realm.hpp" - -#include -#include - -using namespace realm; -using namespace realm::_impl; - -std::function -CollectionNotifier::get_modification_checker(TransactionChangeInfo const& info, - Table const& root_table) -{ - // First check if any of the tables accessible from the root table were - // actually modified. This can be false if there were only insertions, or - // deletions which were not linked to by any row in the linking table - auto table_modified = [&](auto& tbl) { - return tbl.table_ndx < info.tables.size() - && !info.tables[tbl.table_ndx].modifications.empty(); - }; - if (!any_of(begin(m_related_tables), end(m_related_tables), table_modified)) { - return [](size_t) { return false; }; - } - - return DeepChangeChecker(info, root_table, m_related_tables); -} - -void DeepChangeChecker::find_related_tables(std::vector& out, Table const& table) -{ - auto table_ndx = table.get_index_in_group(); - if (any_of(begin(out), end(out), [=](auto& tbl) { return tbl.table_ndx == table_ndx; })) - return; - - // We need to add this table to `out` before recurring so that the check - // above works, but we can't store a pointer to the thing being populated - // because the recursive calls may resize `out`, so instead look it up by - // index every time - size_t out_index = out.size(); - out.push_back({table_ndx, {}}); - - for (size_t i = 0, count = table.get_column_count(); i != count; ++i) { - auto type = table.get_column_type(i); - if (type == type_Link || type == type_LinkList) { - out[out_index].links.push_back({i, type == type_LinkList}); - find_related_tables(out, *table.get_link_target(i)); - } - } -} - -DeepChangeChecker::DeepChangeChecker(TransactionChangeInfo const& info, - Table const& root_table, - std::vector const& related_tables) -: m_info(info) -, m_root_table(root_table) -, m_root_table_ndx(root_table.get_index_in_group()) -, m_root_modifications(m_root_table_ndx < info.tables.size() ? &info.tables[m_root_table_ndx].modifications : nullptr) -, m_related_tables(related_tables) -{ -} - -bool DeepChangeChecker::check_outgoing_links(size_t table_ndx, - Table const& table, - size_t row_ndx, size_t depth) -{ - auto it = find_if(begin(m_related_tables), end(m_related_tables), - [&](auto&& tbl) { return tbl.table_ndx == table_ndx; }); - if (it == m_related_tables.end()) - return false; - - // Check if we're already checking if the destination of the link is - // modified, and if not add it to the stack - auto already_checking = [&](size_t col) { - for (auto p = m_current_path.begin(); p < m_current_path.begin() + depth; ++p) { - if (p->table == table_ndx && p->row == row_ndx && p->col == col) - return true; - } - m_current_path[depth] = {table_ndx, row_ndx, col, false}; - return false; - }; - - for (auto const& link : it->links) { - if (already_checking(link.col_ndx)) - continue; - if (!link.is_list) { - if (table.is_null_link(link.col_ndx, row_ndx)) - continue; - auto dst = table.get_link(link.col_ndx, row_ndx); - return check_row(*table.get_link_target(link.col_ndx), dst, depth + 1); - } - - auto& target = *table.get_link_target(link.col_ndx); - auto lvr = table.get_linklist(link.col_ndx, row_ndx); - for (size_t j = 0, size = lvr->size(); j < size; ++j) { - size_t dst = lvr->get(j).get_index(); - if (check_row(target, dst, depth + 1)) - return true; - } - } - - return false; -} - -bool DeepChangeChecker::check_row(Table const& table, size_t idx, size_t depth) -{ - // Arbitrary upper limit on the maximum depth to search - if (depth >= m_current_path.size()) { - // Don't mark any of the intermediate rows checked along the path as - // not modified, as a search starting from them might hit a modification - for (size_t i = 1; i < m_current_path.size(); ++i) - m_current_path[i].depth_exceeded = true; - return false; - } - - size_t table_ndx = table.get_index_in_group(); - if (depth > 0 && table_ndx < m_info.tables.size() && m_info.tables[table_ndx].modifications.contains(idx)) - return true; - - if (m_not_modified.size() <= table_ndx) - m_not_modified.resize(table_ndx + 1); - if (m_not_modified[table_ndx].contains(idx)) - return false; - - bool ret = check_outgoing_links(table_ndx, table, idx, depth); - if (!ret && !m_current_path[depth].depth_exceeded) - m_not_modified[table_ndx].add(idx); - return ret; -} - -bool DeepChangeChecker::operator()(size_t ndx) -{ - if (m_root_modifications && m_root_modifications->contains(ndx)) - return true; - return check_row(m_root_table, ndx, 0); -} - -CollectionNotifier::CollectionNotifier(std::shared_ptr realm) -: m_realm(std::move(realm)) -, m_sg_version(Realm::Internal::get_shared_group(*m_realm).get_version_of_current_transaction()) -{ -} - -CollectionNotifier::~CollectionNotifier() -{ - // Need to do this explicitly to ensure m_realm is destroyed with the mutex - // held to avoid potential double-deletion - unregister(); -} - -size_t CollectionNotifier::add_callback(CollectionChangeCallback callback) -{ - m_realm->verify_thread(); - - auto next_token = [=] { - size_t token = 0; - for (auto& callback : m_callbacks) { - if (token <= callback.token) { - token = callback.token + 1; - } - } - return token; - }; - - std::lock_guard lock(m_callback_mutex); - auto token = next_token(); - m_callbacks.push_back({std::move(callback), {}, {}, token, false, false}); - if (m_callback_index == npos) { // Don't need to wake up if we're already sending notifications - Realm::Internal::get_coordinator(*m_realm).wake_up_notifier_worker(); - m_have_callbacks = true; - } - return token; -} - -void CollectionNotifier::remove_callback(size_t token) -{ - // the callback needs to be destroyed after releasing the lock as destroying - // it could cause user code to be called - Callback old; - { - std::lock_guard lock(m_callback_mutex); - auto it = find_callback(token); - if (it == end(m_callbacks)) { - return; - } - - size_t idx = distance(begin(m_callbacks), it); - if (m_callback_index != npos && m_callback_index >= idx) { - --m_callback_index; - } - - old = std::move(*it); - m_callbacks.erase(it); - - m_have_callbacks = !m_callbacks.empty(); - } -} - -void CollectionNotifier::suppress_next_notification(size_t token) -{ - { - std::lock_guard lock(m_realm_mutex); - REALM_ASSERT(m_realm); - m_realm->verify_thread(); - m_realm->verify_in_write(); - } - - std::lock_guard lock(m_callback_mutex); - auto it = find_callback(token); - if (it != end(m_callbacks)) { - it->skip_next = true; - } -} - -std::vector::iterator CollectionNotifier::find_callback(size_t token) -{ - REALM_ASSERT(m_error || m_callbacks.size() > 0); - - auto it = find_if(begin(m_callbacks), end(m_callbacks), - [=](const auto& c) { return c.token == token; }); - // We should only fail to find the callback if it was removed due to an error - REALM_ASSERT(m_error || it != end(m_callbacks)); - return it; -} - -void CollectionNotifier::unregister() noexcept -{ - std::lock_guard lock(m_realm_mutex); - m_realm = nullptr; -} - -bool CollectionNotifier::is_alive() const noexcept -{ - std::lock_guard lock(m_realm_mutex); - return m_realm != nullptr; -} - -std::unique_lock CollectionNotifier::lock_target() -{ - return std::unique_lock{m_realm_mutex}; -} - -void CollectionNotifier::set_table(Table const& table) -{ - m_related_tables.clear(); - DeepChangeChecker::find_related_tables(m_related_tables, table); -} - -void CollectionNotifier::add_required_change_info(TransactionChangeInfo& info) -{ - if (!do_add_required_change_info(info) || m_related_tables.empty()) { - return; - } - - auto max = max_element(begin(m_related_tables), end(m_related_tables), - [](auto&& a, auto&& b) { return a.table_ndx < b.table_ndx; }); - - if (max->table_ndx >= info.table_modifications_needed.size()) - info.table_modifications_needed.resize(max->table_ndx + 1, false); - for (auto& tbl : m_related_tables) { - info.table_modifications_needed[tbl.table_ndx] = true; - } -} - -void CollectionNotifier::prepare_handover() -{ - REALM_ASSERT(m_sg); - m_sg_version = m_sg->get_version_of_current_transaction(); - do_prepare_handover(*m_sg); - m_has_run = true; - -#ifdef REALM_DEBUG - std::lock_guard lock(m_callback_mutex); - for (auto& callback : m_callbacks) - REALM_ASSERT(!callback.skip_next); -#endif -} - -void CollectionNotifier::before_advance() -{ - for_each_callback([&](auto& lock, auto& callback) { - if (callback.changes_to_deliver.empty()) { - return; - } - - auto changes = callback.changes_to_deliver; - // acquire a local reference to the callback so that removing the - // callback from within it can't result in a dangling pointer - auto cb = callback.fn; - lock.unlock(); - cb.before(changes); - }); -} - -void CollectionNotifier::after_advance() -{ - for_each_callback([&](auto& lock, auto& callback) { - if (callback.initial_delivered && callback.changes_to_deliver.empty()) { - return; - } - callback.initial_delivered = true; - - auto changes = std::move(callback.changes_to_deliver); - // acquire a local reference to the callback so that removing the - // callback from within it can't result in a dangling pointer - auto cb = callback.fn; - lock.unlock(); - cb.after(changes); - }); -} - -void CollectionNotifier::deliver_error(std::exception_ptr error) -{ - for_each_callback([&](auto& lock, auto& callback) { - // acquire a local reference to the callback so that removing the - // callback from within it can't result in a dangling pointer - auto cb = callback.fn; - lock.unlock(); - cb.error(error); - }); - - // Remove all the callbacks as we never need to call anything ever again - // after delivering an error - m_callbacks.clear(); - m_error = true; -} - -bool CollectionNotifier::is_for_realm(Realm& realm) const noexcept -{ - std::lock_guard lock(m_realm_mutex); - return m_realm.get() == &realm; -} - -bool CollectionNotifier::package_for_delivery() -{ - if (!prepare_to_deliver()) - return false; - std::lock_guard l(m_callback_mutex); - for (auto& callback : m_callbacks) - callback.changes_to_deliver = std::move(callback.accumulated_changes).finalize(); - return true; -} - -template -void CollectionNotifier::for_each_callback(Fn&& fn) -{ - std::unique_lock callback_lock(m_callback_mutex); - for (++m_callback_index; m_callback_index < m_callbacks.size(); ++m_callback_index) { - fn(callback_lock, m_callbacks[m_callback_index]); - if (!callback_lock.owns_lock()) - callback_lock.lock(); - } - - m_callback_index = npos; -} - -void CollectionNotifier::attach_to(SharedGroup& sg) -{ - REALM_ASSERT(!m_sg); - - m_sg = &sg; - do_attach_to(sg); -} - -void CollectionNotifier::detach() -{ - REALM_ASSERT(m_sg); - do_detach_from(*m_sg); - m_sg = nullptr; -} - -void CollectionNotifier::add_changes(CollectionChangeBuilder change) -{ - std::lock_guard lock(m_callback_mutex); - for (auto& callback : m_callbacks) { - if (callback.skip_next) { - REALM_ASSERT_DEBUG(callback.accumulated_changes.empty()); - callback.skip_next = false; - } - else { - if (&callback == &m_callbacks.back()) - callback.accumulated_changes.merge(std::move(change)); - else - callback.accumulated_changes.merge(CollectionChangeBuilder(change)); - } - } -} - -NotifierPackage::NotifierPackage(std::exception_ptr error, - std::vector> notifiers, - RealmCoordinator* coordinator) -: m_notifiers(std::move(notifiers)) -, m_coordinator(coordinator) -, m_error(std::move(error)) -{ -} - -void NotifierPackage::package_and_wait(util::Optional target_version) -{ - if (!m_coordinator || m_error || !*this) - return; - - auto lock = m_coordinator->wait_for_notifiers([&] { - if (!target_version) - return true; - return std::all_of(begin(m_notifiers), end(m_notifiers), [&](auto const& n) { - return !n->have_callbacks() || (n->has_run() && n->version().version >= *target_version); - }); - }); - - // Package the notifiers for delivery and remove any which don't have anything to deliver - auto package = [&](auto& notifier) { - if (notifier->has_run() && notifier->package_for_delivery()) { - m_version = notifier->version(); - return false; - } - return true; - }; - m_notifiers.erase(std::remove_if(begin(m_notifiers), end(m_notifiers), package), end(m_notifiers)); - if (m_version && target_version && m_version->version < *target_version) { - m_notifiers.clear(); - m_version = util::none; - } - REALM_ASSERT(m_version || m_notifiers.empty()); - - m_coordinator = nullptr; -} - -void NotifierPackage::before_advance() -{ - if (m_error) - return; - for (auto& notifier : m_notifiers) - notifier->before_advance(); -} - -void NotifierPackage::deliver(SharedGroup& sg) -{ - if (m_error) { - for (auto& notifier : m_notifiers) - notifier->deliver_error(m_error); - return; - } - // Can't deliver while in a write transaction - if (sg.get_transact_stage() != SharedGroup::transact_Reading) - return; - for (auto& notifier : m_notifiers) - notifier->deliver(sg); -} - -void NotifierPackage::after_advance() -{ - if (m_error) - return; - for (auto& notifier : m_notifiers) - notifier->after_advance(); -} - -void NotifierPackage::add_notifier(std::shared_ptr notifier) -{ - m_notifiers.push_back(notifier); - m_coordinator->register_notifier(notifier); -} diff --git a/Pods/Realm/Realm/ObjectStore/src/impl/list_notifier.cpp b/Pods/Realm/Realm/ObjectStore/src/impl/list_notifier.cpp deleted file mode 100644 index beec1d57..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/impl/list_notifier.cpp +++ /dev/null @@ -1,119 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "impl/list_notifier.hpp" - -#include "shared_realm.hpp" - -#include - -using namespace realm; -using namespace realm::_impl; - -ListNotifier::ListNotifier(LinkViewRef lv, std::shared_ptr realm) -: CollectionNotifier(std::move(realm)) -, m_prev_size(lv->size()) -{ - set_table(lv->get_target_table()); - - auto& sg = Realm::Internal::get_shared_group(*get_realm()); - m_lv_handover = sg.export_linkview_for_handover(lv); -} - -void ListNotifier::release_data() noexcept -{ - m_lv.reset(); -} - -void ListNotifier::do_attach_to(SharedGroup& sg) -{ - REALM_ASSERT(m_lv_handover); - REALM_ASSERT(!m_lv); - m_lv = sg.import_linkview_from_handover(std::move(m_lv_handover)); -} - -void ListNotifier::do_detach_from(SharedGroup& sg) -{ - REALM_ASSERT(!m_lv_handover); - if (m_lv) { - m_lv_handover = sg.export_linkview_for_handover(m_lv); - m_lv = {}; - } -} - -bool ListNotifier::do_add_required_change_info(TransactionChangeInfo& info) -{ - REALM_ASSERT(!m_lv_handover); - if (!m_lv || !m_lv->is_attached()) { - return false; // origin row was deleted after the notification was added - } - - // Find the lv's column, since that isn't tracked directly - auto& table = m_lv->get_origin_table(); - size_t row_ndx = m_lv->get_origin_row_index(); - size_t col_ndx = not_found; - for (size_t i = 0, count = table.get_column_count(); i != count; ++i) { - if (table.get_column_type(i) == type_LinkList && table.get_linklist(i, row_ndx) == m_lv) { - col_ndx = i; - break; - } - } - REALM_ASSERT(col_ndx != not_found); - info.lists.push_back({table.get_index_in_group(), row_ndx, col_ndx, &m_change}); - - m_info = &info; - return true; -} - -void ListNotifier::run() -{ - if (!m_lv || !m_lv->is_attached()) { - // LV was deleted, so report all of the rows being removed if this is - // the first run after that - if (m_prev_size) { - m_change.deletions.set(m_prev_size); - m_prev_size = 0; - } - else { - m_change = {}; - } - return; - } - - auto row_did_change = get_modification_checker(*m_info, m_lv->get_target_table()); - for (size_t i = 0; i < m_lv->size(); ++i) { - if (m_change.modifications.contains(i)) - continue; - if (row_did_change(m_lv->get(i).get_index())) - m_change.modifications.add(i); - } - - for (auto const& move : m_change.moves) { - if (m_change.modifications.contains(move.to)) - continue; - if (row_did_change(m_lv->get(move.to).get_index())) - m_change.modifications.add(move.to); - } - - m_prev_size = m_lv->size(); -} - -void ListNotifier::do_prepare_handover(SharedGroup&) -{ - add_changes(std::move(m_change)); -} diff --git a/Pods/Realm/Realm/ObjectStore/src/impl/object_notifier.cpp b/Pods/Realm/Realm/ObjectStore/src/impl/object_notifier.cpp deleted file mode 100644 index bbc65b86..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/impl/object_notifier.cpp +++ /dev/null @@ -1,98 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2017 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "impl/object_notifier.hpp" - -#include "shared_realm.hpp" - -using namespace realm; -using namespace realm::_impl; - -ObjectNotifier::ObjectNotifier(Row const& row, std::shared_ptr realm) -: CollectionNotifier(std::move(realm)) -{ - REALM_ASSERT(row.get_table()); - set_table(*row.get_table()); - - auto& sg = Realm::Internal::get_shared_group(*get_realm()); - m_handover = sg.export_for_handover(row); -} - -void ObjectNotifier::release_data() noexcept -{ - m_row = nullptr; -} - -void ObjectNotifier::do_attach_to(SharedGroup& sg) -{ - REALM_ASSERT(m_handover); - REALM_ASSERT(!m_row); - m_row = sg.import_from_handover(std::move(m_handover)); -} - -void ObjectNotifier::do_detach_from(SharedGroup& sg) -{ - REALM_ASSERT(!m_handover); - if (m_row) { - m_handover = sg.export_for_handover(*m_row); - m_row = nullptr; - } -} - -bool ObjectNotifier::do_add_required_change_info(TransactionChangeInfo& info) -{ - REALM_ASSERT(!m_handover); - m_info = &info; - if (m_row && m_row->is_attached()) { - size_t table_ndx = m_row->get_table()->get_index_in_group(); - if (table_ndx >= info.table_modifications_needed.size()) - info.table_modifications_needed.resize(table_ndx + 1); - info.table_modifications_needed[table_ndx] = true; - } - return false; -} - -void ObjectNotifier::run() -{ - if (!m_row) - return; - if (!m_row->is_attached()) { - m_change.deletions.add(0); - m_row = nullptr; - return; - } - - size_t table_ndx = m_row->get_table()->get_index_in_group(); - if (table_ndx >= m_info->tables.size()) - return; - auto& change = m_info->tables[table_ndx]; - if (!change.modifications.contains(m_row->get_index())) - return; - m_change.modifications.add(0); - m_change.columns.reserve(change.columns.size()); - for (auto& col : change.columns) { - m_change.columns.emplace_back(); - if (col.contains(m_row->get_index())) - m_change.columns.back().add(0); - } -} - -void ObjectNotifier::do_prepare_handover(SharedGroup&) -{ - add_changes(std::move(m_change)); -} diff --git a/Pods/Realm/Realm/ObjectStore/src/impl/realm_coordinator.cpp b/Pods/Realm/Realm/ObjectStore/src/impl/realm_coordinator.cpp deleted file mode 100644 index 322c5d16..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/impl/realm_coordinator.cpp +++ /dev/null @@ -1,814 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "impl/realm_coordinator.hpp" - -#include "impl/collection_notifier.hpp" -#include "impl/external_commit_helper.hpp" -#include "impl/transact_log_handler.hpp" -#include "impl/weak_realm_notifier.hpp" -#include "binding_context.hpp" -#include "object_schema.hpp" -#include "object_store.hpp" -#include "schema.hpp" - -#if REALM_ENABLE_SYNC -#include "sync/sync_config.hpp" -#include "sync/sync_manager.hpp" -#include "sync/sync_session.hpp" -#endif - -#include -#include -#include - -#include -#include - -using namespace realm; -using namespace realm::_impl; - -static auto& s_coordinator_mutex = *new std::mutex; -static auto& s_coordinators_per_path = *new std::unordered_map>; - -std::shared_ptr RealmCoordinator::get_coordinator(StringData path) -{ - std::lock_guard lock(s_coordinator_mutex); - - auto& weak_coordinator = s_coordinators_per_path[path]; - if (auto coordinator = weak_coordinator.lock()) { - return coordinator; - } - - auto coordinator = std::make_shared(); - weak_coordinator = coordinator; - return coordinator; -} - -std::shared_ptr RealmCoordinator::get_coordinator(const Realm::Config& config) -{ - auto coordinator = get_coordinator(config.path); - std::lock_guard lock(coordinator->m_realm_mutex); - coordinator->set_config(config); - return coordinator; -} - -std::shared_ptr RealmCoordinator::get_existing_coordinator(StringData path) -{ - std::lock_guard lock(s_coordinator_mutex); - auto it = s_coordinators_per_path.find(path); - return it == s_coordinators_per_path.end() ? nullptr : it->second.lock(); -} - -void RealmCoordinator::create_sync_session() -{ -#if REALM_ENABLE_SYNC - if (m_sync_session) - return; - - m_sync_session = SyncManager::shared().get_session(m_config.path, *m_config.sync_config); - - std::weak_ptr weak_self = shared_from_this(); - SyncSession::Internal::set_sync_transact_callback(*m_sync_session, - [weak_self](VersionID old_version, VersionID new_version) { - if (auto self = weak_self.lock()) { - if (self->m_transaction_callback) - self->m_transaction_callback(old_version, new_version); - if (self->m_notifier) - self->m_notifier->notify_others(); - } - }); - if (m_config.sync_config->error_handler) { - SyncSession::Internal::set_error_handler(*m_sync_session, m_config.sync_config->error_handler); - } -#endif -} - -void RealmCoordinator::set_config(const Realm::Config& config) -{ - if (config.encryption_key.data() && config.encryption_key.size() != 64) - throw InvalidEncryptionKeyException(); - if (config.schema_mode == SchemaMode::ReadOnly && config.sync_config) - throw std::logic_error("Synchronized Realms cannot be opened in read-only mode"); - if (config.schema_mode == SchemaMode::Additive && config.migration_function) - throw std::logic_error("Realms opened in Additive-only schema mode do not use a migration function"); - if (config.schema_mode == SchemaMode::ReadOnly && config.migration_function) - throw std::logic_error("Realms opened in read-only mode do not use a migration function"); - if (config.schema && config.schema_version == ObjectStore::NotVersioned) - throw std::logic_error("A schema version must be specified when the schema is specified"); - if (!config.realm_data.is_null() && (!config.read_only() || !config.in_memory)) - throw std::logic_error("In-memory realms initialized from memory buffers can only be opened in read-only mode"); - if (!config.realm_data.is_null() && !config.path.empty()) - throw std::logic_error("Specifying both memory buffer and path is invalid"); - if (!config.realm_data.is_null() && !config.encryption_key.empty()) - throw std::logic_error("Memory buffers do not support encryption"); - // ResetFile also won't use the migration function, but specifying one is - // allowed to simplify temporarily switching modes during development - - bool no_existing_realm = std::all_of(begin(m_weak_realm_notifiers), end(m_weak_realm_notifiers), - [](auto& notifier) { return notifier.expired(); }); - if (no_existing_realm) { - m_config = config; - } - else { - if (m_config.read_only() != config.read_only()) { - throw MismatchedConfigException("Realm at path '%1' already opened with different read permissions.", config.path); - } - if (m_config.in_memory != config.in_memory) { - throw MismatchedConfigException("Realm at path '%1' already opened with different inMemory settings.", config.path); - } - if (m_config.encryption_key != config.encryption_key) { - throw MismatchedConfigException("Realm at path '%1' already opened with a different encryption key.", config.path); - } - if (m_config.schema_mode != config.schema_mode) { - throw MismatchedConfigException("Realm at path '%1' already opened with a different schema mode.", config.path); - } - if (config.schema && m_schema_version != ObjectStore::NotVersioned && m_schema_version != config.schema_version) { - throw MismatchedConfigException("Realm at path '%1' already opened with different schema version.", config.path); - } - -#if REALM_ENABLE_SYNC - if (bool(m_config.sync_config) != bool(config.sync_config)) { - throw MismatchedConfigException("Realm at path '%1' already opened with different sync configurations.", config.path); - } - - if (config.sync_config) { - if (m_config.sync_config->user != config.sync_config->user) { - throw MismatchedConfigException("Realm at path '%1' already opened with different sync user.", config.path); - } - if (m_config.sync_config->realm_url != config.sync_config->realm_url) { - throw MismatchedConfigException("Realm at path '%1' already opened with different sync server URL.", config.path); - } - } -#endif - - // Realm::update_schema() handles complaining about schema mismatches - } - -#if REALM_ENABLE_SYNC - if (config.sync_config) { - create_sync_session(); - } -#endif -} - -std::shared_ptr RealmCoordinator::get_realm(Realm::Config config) -{ - // realm must be declared before lock so that the mutex is released before - // we release the strong reference to realm, as Realm's destructor may want - // to acquire the same lock - std::shared_ptr realm; - std::unique_lock lock(m_realm_mutex); - - set_config(config); - - auto schema = std::move(config.schema); - auto migration_function = std::move(config.migration_function); - config.schema = {}; - - if (config.cache) { - AnyExecutionContextID execution_context(config.execution_context); - for (auto& cached_realm : m_weak_realm_notifiers) { - if (!cached_realm.is_cached_for_execution_context(execution_context)) - continue; - // can be null if we jumped in between ref count hitting zero and - // unregister_realm() getting the lock - if ((realm = cached_realm.realm())) { - // If the file is uninitialized and was opened without a schema, - // do the normal schema init - if (realm->schema_version() == ObjectStore::NotVersioned) - break; - - // Otherwise if we have a realm schema it needs to be an exact - // match (even having the same properties but in different - // orders isn't good enough) - if (schema && realm->schema() != *schema) - throw MismatchedConfigException("Realm at path '%1' already opened on current thread with different schema.", config.path); - - return realm; - } - } - } - - if (!realm) { - realm = Realm::make_shared_realm(std::move(config), shared_from_this()); - if (!config.read_only() && !m_notifier && config.automatic_change_notifications) { - try { - m_notifier = std::make_unique(*this); - } - catch (std::system_error const& ex) { - throw RealmFileException(RealmFileException::Kind::AccessError, config.path, ex.code().message(), ""); - } - } - m_weak_realm_notifiers.emplace_back(realm, m_config.cache); - } - - if (schema) { - lock.unlock(); - realm->update_schema(std::move(*schema), config.schema_version, std::move(migration_function)); - } - - return realm; -} - -std::shared_ptr RealmCoordinator::get_realm() -{ - return get_realm(m_config); -} - -const Schema* RealmCoordinator::get_schema() const noexcept -{ - return m_schema_version == uint64_t(-1) ? nullptr : &m_schema; -} - -void RealmCoordinator::update_schema(Schema const& schema, uint64_t schema_version) -{ - m_schema = schema; - m_schema_version = schema_version; -} - -RealmCoordinator::RealmCoordinator() = default; - -RealmCoordinator::~RealmCoordinator() -{ - std::lock_guard coordinator_lock(s_coordinator_mutex); - for (auto it = s_coordinators_per_path.begin(); it != s_coordinators_per_path.end(); ) { - if (it->second.expired()) { - it = s_coordinators_per_path.erase(it); - } - else { - ++it; - } - } -} - -void RealmCoordinator::unregister_realm(Realm* realm) -{ - std::lock_guard lock(m_realm_mutex); - auto new_end = remove_if(begin(m_weak_realm_notifiers), end(m_weak_realm_notifiers), - [=](auto& notifier) { return notifier.expired() || notifier.is_for_realm(realm); }); - m_weak_realm_notifiers.erase(new_end, end(m_weak_realm_notifiers)); -} - -void RealmCoordinator::clear_cache() -{ - std::vector realms_to_close; - { - std::lock_guard lock(s_coordinator_mutex); - - for (auto& weak_coordinator : s_coordinators_per_path) { - auto coordinator = weak_coordinator.second.lock(); - if (!coordinator) { - continue; - } - - coordinator->m_notifier = nullptr; - - // Gather a list of all of the realms which will be removed - for (auto& weak_realm_notifier : coordinator->m_weak_realm_notifiers) { - if (auto realm = weak_realm_notifier.realm()) { - realms_to_close.push_back(realm); - } - } - } - - s_coordinators_per_path.clear(); - } - - // Close all of the previously cached Realms. This can't be done while - // s_coordinator_mutex is held as it may try to re-lock it. - for (auto& weak_realm : realms_to_close) { - if (auto realm = weak_realm.lock()) { - realm->close(); - } - } -} - -void RealmCoordinator::clear_all_caches() -{ - std::vector> to_clear; - { - std::lock_guard lock(s_coordinator_mutex); - for (auto iter : s_coordinators_per_path) { - to_clear.push_back(iter.second); - } - } - for (auto weak_coordinator : to_clear) { - if (auto coordinator = weak_coordinator.lock()) { - coordinator->clear_cache(); - } - } -} - -void RealmCoordinator::assert_no_open_realms() noexcept -{ -#ifdef REALM_DEBUG - std::lock_guard lock(s_coordinator_mutex); - REALM_ASSERT(s_coordinators_per_path.empty()); -#endif -} - -void RealmCoordinator::wake_up_notifier_worker() -{ - if (m_notifier) { - // FIXME: this wakes up the notification workers for all processes and - // not just us. This might be worth optimizing in the future. - m_notifier->notify_others(); - } -} - -void RealmCoordinator::commit_write(Realm& realm) -{ - REALM_ASSERT(!m_config.read_only()); - REALM_ASSERT(realm.is_in_transaction()); - - { - // Need to acquire this lock before committing or another process could - // perform a write and notify us before we get the chance to set the - // skip version - std::lock_guard l(m_notifier_mutex); - - transaction::commit(Realm::Internal::get_shared_group(realm)); - - // Don't need to check m_new_notifiers because those don't skip versions - bool have_notifiers = std::any_of(m_notifiers.begin(), m_notifiers.end(), - [&](auto&& notifier) { return notifier->is_for_realm(realm); }); - if (have_notifiers) { - m_notifier_skip_version = Realm::Internal::get_shared_group(realm).get_version_of_current_transaction(); - } - } - - if (realm.m_binding_context) { - realm.m_binding_context->did_change({}, {}); - } - - if (m_notifier) { - m_notifier->notify_others(); - } -#if REALM_ENABLE_SYNC - if (m_sync_session) { - auto& sg = Realm::Internal::get_shared_group(realm); - auto version = LangBindHelper::get_version_of_latest_snapshot(sg); - SyncSession::Internal::nonsync_transact_notify(*m_sync_session, version); - } -#endif -} - -void RealmCoordinator::pin_version(VersionID versionid) -{ - REALM_ASSERT_DEBUG(!m_notifier_mutex.try_lock()); - if (m_async_error) { - return; - } - - if (!m_advancer_sg) { - try { - std::unique_ptr read_only_group; - Realm::open_with_config(m_config, m_advancer_history, m_advancer_sg, read_only_group, nullptr); - REALM_ASSERT(!read_only_group); - m_advancer_sg->begin_read(versionid); - } - catch (...) { - m_async_error = std::current_exception(); - m_advancer_sg = nullptr; - m_advancer_history = nullptr; - } - } - else if (m_new_notifiers.empty()) { - // If this is the first notifier then we don't already have a read transaction - REALM_ASSERT_3(m_advancer_sg->get_transact_stage(), ==, SharedGroup::transact_Ready); - m_advancer_sg->begin_read(versionid); - } - else { - REALM_ASSERT_3(m_advancer_sg->get_transact_stage(), ==, SharedGroup::transact_Reading); - if (versionid < m_advancer_sg->get_version_of_current_transaction()) { - // Ensure we're holding a readlock on the oldest version we have a - // handover object for, as handover objects don't - m_advancer_sg->end_read(); - m_advancer_sg->begin_read(versionid); - } - } -} - -void RealmCoordinator::register_notifier(std::shared_ptr notifier) -{ - auto version = notifier->version(); - auto& self = Realm::Internal::get_coordinator(*notifier->get_realm()); - { - std::lock_guard lock(self.m_notifier_mutex); - self.pin_version(version); - self.m_new_notifiers.push_back(std::move(notifier)); - } -} - -void RealmCoordinator::clean_up_dead_notifiers() -{ - auto swap_remove = [&](auto& container) { - bool did_remove = false; - for (size_t i = 0; i < container.size(); ++i) { - if (container[i]->is_alive()) - continue; - - // Ensure the notifier is destroyed here even if there's lingering refs - // to the async notifier elsewhere - container[i]->release_data(); - - if (container.size() > i + 1) - container[i] = std::move(container.back()); - container.pop_back(); - --i; - did_remove = true; - } - return did_remove; - }; - - if (swap_remove(m_notifiers)) { - // Make sure we aren't holding on to read versions needlessly if there - // are no notifiers left, but don't close them entirely as opening shared - // groups is expensive - if (m_notifiers.empty() && m_notifier_sg) { - REALM_ASSERT_3(m_notifier_sg->get_transact_stage(), ==, SharedGroup::transact_Reading); - m_notifier_sg->end_read(); - } - } - if (swap_remove(m_new_notifiers) && m_advancer_sg) { - REALM_ASSERT_3(m_advancer_sg->get_transact_stage(), ==, SharedGroup::transact_Reading); - if (m_new_notifiers.empty()) { - m_advancer_sg->end_read(); - } - } -} - -void RealmCoordinator::on_change() -{ - run_async_notifiers(); - - std::lock_guard lock(m_realm_mutex); - for (auto& realm : m_weak_realm_notifiers) { - realm.notify(); - } -} - -namespace { -class IncrementalChangeInfo { -public: - IncrementalChangeInfo(SharedGroup& sg, - std::vector>& notifiers) - : m_sg(sg) - { - if (notifiers.empty()) - return; - - auto cmp = [&](auto&& lft, auto&& rgt) { - return lft->version() < rgt->version(); - }; - - // Sort the notifiers by their source version so that we can pull them - // all forward to the latest version in a single pass over the transaction log - std::sort(notifiers.begin(), notifiers.end(), cmp); - - // Preallocate the required amount of space in the vector so that we can - // safely give out pointers to within the vector - size_t count = 1; - for (auto it = notifiers.begin(), next = it + 1; next != notifiers.end(); ++it, ++next) { - if (cmp(*it, *next)) - ++count; - } - m_info.reserve(count); - m_info.resize(1); - m_current = &m_info[0]; - } - - TransactionChangeInfo& current() const { return *m_current; } - - bool advance_incremental(VersionID version) - { - if (version != m_sg.get_version_of_current_transaction()) { - transaction::advance(m_sg, *m_current, version); - m_info.push_back({ - m_current->table_modifications_needed, - m_current->table_moves_needed, - std::move(m_current->lists)}); - m_current = &m_info.back(); - return true; - } - return false; - } - - void advance_to_final(VersionID version) - { - if (!m_current) { - transaction::advance(m_sg, nullptr, version); - return; - } - - transaction::advance(m_sg, *m_current, version); - - // We now need to combine the transaction change info objects so that all of - // the notifiers see the complete set of changes from their first version to - // the most recent one - for (size_t i = m_info.size() - 1; i > 0; --i) { - auto& cur = m_info[i]; - if (cur.tables.empty()) - continue; - auto& prev = m_info[i - 1]; - if (prev.tables.empty()) { - prev.tables = cur.tables; - continue; - } - - for (size_t j = 0; j < prev.tables.size() && j < cur.tables.size(); ++j) { - prev.tables[j].merge(CollectionChangeBuilder{cur.tables[j]}); - } - prev.tables.reserve(cur.tables.size()); - while (prev.tables.size() < cur.tables.size()) { - prev.tables.push_back(cur.tables[prev.tables.size()]); - } - } - - // Copy the list change info if there are multiple LinkViews for the same LinkList - auto id = [](auto const& list) { return std::tie(list.table_ndx, list.col_ndx, list.row_ndx); }; - for (size_t i = 1; i < m_current->lists.size(); ++i) { - for (size_t j = i; j > 0; --j) { - if (id(m_current->lists[i]) == id(m_current->lists[j - 1])) { - m_current->lists[j - 1].changes->merge(CollectionChangeBuilder{*m_current->lists[i].changes}); - } - } - } - } - -private: - std::vector m_info; - TransactionChangeInfo* m_current = nullptr; - SharedGroup& m_sg; -}; -} // anonymous namespace - -void RealmCoordinator::run_async_notifiers() -{ - std::unique_lock lock(m_notifier_mutex); - - clean_up_dead_notifiers(); - - if (m_notifiers.empty() && m_new_notifiers.empty()) { - return; - } - - if (!m_async_error) { - open_helper_shared_group(); - } - - if (m_async_error) { - std::move(m_new_notifiers.begin(), m_new_notifiers.end(), std::back_inserter(m_notifiers)); - m_new_notifiers.clear(); - return; - } - - VersionID version; - - // Advance all of the new notifiers to the most recent version, if any - auto new_notifiers = std::move(m_new_notifiers); - IncrementalChangeInfo new_notifier_change_info(*m_advancer_sg, new_notifiers); - - if (!new_notifiers.empty()) { - REALM_ASSERT_3(m_advancer_sg->get_transact_stage(), ==, SharedGroup::transact_Reading); - REALM_ASSERT_3(m_advancer_sg->get_version_of_current_transaction().version, - <=, new_notifiers.front()->version().version); - - // The advancer SG can be at an older version than the oldest new notifier - // if a notifier was added and then removed before it ever got the chance - // to run, as we don't move the pin forward when removing dead notifiers - transaction::advance(*m_advancer_sg, nullptr, new_notifiers.front()->version()); - - // Advance each of the new notifiers to the latest version, attaching them - // to the SG at their handover version. This requires a unique - // TransactionChangeInfo for each source version, so that things don't - // see changes from before the version they were handed over from. - // Each Info has all of the changes between that source version and the - // next source version, and they'll be merged together later after - // releasing the lock - for (auto& notifier : new_notifiers) { - new_notifier_change_info.advance_incremental(notifier->version()); - notifier->attach_to(*m_advancer_sg); - notifier->add_required_change_info(new_notifier_change_info.current()); - } - new_notifier_change_info.advance_to_final(VersionID{}); - - for (auto& notifier : new_notifiers) { - notifier->detach(); - } - - // We want to advance the non-new notifiers to the same version as the - // new notifiers to avoid having to merge changes from any new - // transaction that happen immediately after this into the new notifier - // changes - version = m_advancer_sg->get_version_of_current_transaction(); - m_advancer_sg->end_read(); - } - else { - // If we have no new notifiers we want to just advance to the latest - // version, but we have to pick a "latest" version while holding the - // notifier lock to avoid advancing over a transaction which should be - // skipped - m_advancer_sg->begin_read(); - version = m_advancer_sg->get_version_of_current_transaction(); - m_advancer_sg->end_read(); - } - REALM_ASSERT_3(m_advancer_sg->get_transact_stage(), ==, SharedGroup::transact_Ready); - - auto skip_version = m_notifier_skip_version; - m_notifier_skip_version = {0, 0}; - - // Make a copy of the notifiers vector and then release the lock to avoid - // blocking other threads trying to register or unregister notifiers while we run them - auto notifiers = m_notifiers; - m_notifiers.insert(m_notifiers.end(), new_notifiers.begin(), new_notifiers.end()); - lock.unlock(); - - if (skip_version.version) { - REALM_ASSERT(version >= skip_version); - IncrementalChangeInfo change_info(*m_notifier_sg, notifiers); - for (auto& notifier : notifiers) - notifier->add_required_change_info(change_info.current()); - change_info.advance_to_final(skip_version); - - for (auto& notifier : notifiers) - notifier->run(); - - lock.lock(); - for (auto& notifier : notifiers) - notifier->prepare_handover(); - lock.unlock(); - } - - // Advance the non-new notifiers to the same version as we advanced the new - // ones to (or the latest if there were no new ones) - IncrementalChangeInfo change_info(*m_notifier_sg, notifiers); - for (auto& notifier : notifiers) { - notifier->add_required_change_info(change_info.current()); - } - change_info.advance_to_final(version); - - // Attach the new notifiers to the main SG and move them to the main list - for (auto& notifier : new_notifiers) { - notifier->attach_to(*m_notifier_sg); - notifier->run(); - } - - // Change info is now all ready, so the notifiers can now perform their - // background work - for (auto& notifier : notifiers) { - notifier->run(); - } - - // Reacquire the lock while updating the fields that are actually read on - // other threads - lock.lock(); - for (auto& notifier : new_notifiers) { - notifier->prepare_handover(); - } - for (auto& notifier : notifiers) { - notifier->prepare_handover(); - } - clean_up_dead_notifiers(); - m_notifier_cv.notify_all(); -} - -void RealmCoordinator::open_helper_shared_group() -{ - if (!m_notifier_sg) { - try { - std::unique_ptr read_only_group; - Realm::open_with_config(m_config, m_notifier_history, m_notifier_sg, read_only_group, nullptr); - REALM_ASSERT(!read_only_group); - m_notifier_sg->begin_read(); - } - catch (...) { - // Store the error to be passed to the async notifiers - m_async_error = std::current_exception(); - m_notifier_sg = nullptr; - m_notifier_history = nullptr; - } - } - else if (m_notifiers.empty()) { - m_notifier_sg->begin_read(); - } -} - -void RealmCoordinator::advance_to_ready(Realm& realm) -{ - std::unique_lock lock(m_notifier_mutex); - _impl::NotifierPackage notifiers(m_async_error, notifiers_for_realm(realm), this); - lock.unlock(); - notifiers.package_and_wait(util::none); - - auto& sg = Realm::Internal::get_shared_group(realm); - if (notifiers) { - auto version = notifiers.version(); - if (version && *version <= sg.get_version_of_current_transaction()) - return; - } - - transaction::advance(sg, realm.m_binding_context.get(), notifiers); -} - -std::vector> RealmCoordinator::notifiers_for_realm(Realm& realm) -{ - std::vector> ret; - for (auto& notifier : m_new_notifiers) { - if (notifier->is_for_realm(realm)) - ret.push_back(notifier); - } - for (auto& notifier : m_notifiers) { - if (notifier->is_for_realm(realm)) - ret.push_back(notifier); - } - return ret; -} - -bool RealmCoordinator::advance_to_latest(Realm& realm) -{ - using sgf = SharedGroupFriend; - - auto& sg = Realm::Internal::get_shared_group(realm); - std::unique_lock lock(m_notifier_mutex); - _impl::NotifierPackage notifiers(m_async_error, notifiers_for_realm(realm), this); - lock.unlock(); - notifiers.package_and_wait(sgf::get_version_of_latest_snapshot(sg)); - - auto version = sg.get_version_of_current_transaction(); - transaction::advance(sg, realm.m_binding_context.get(), notifiers); - return version != sg.get_version_of_current_transaction(); -} - -void RealmCoordinator::promote_to_write(Realm& realm) -{ - REALM_ASSERT(!realm.is_in_transaction()); - - std::unique_lock lock(m_notifier_mutex); - _impl::NotifierPackage notifiers(m_async_error, notifiers_for_realm(realm), this); - lock.unlock(); - - auto& sg = Realm::Internal::get_shared_group(realm); - transaction::begin(sg, realm.m_binding_context.get(), notifiers); -} - -void RealmCoordinator::process_available_async(Realm& realm) -{ - REALM_ASSERT(!realm.is_in_transaction()); - - std::unique_lock lock(m_notifier_mutex); - auto notifiers = notifiers_for_realm(realm); - if (notifiers.empty()) - return; - - if (auto error = m_async_error) { - lock.unlock(); - for (auto& notifier : notifiers) - notifier->deliver_error(m_async_error); - return; - } - - bool in_read = realm.is_in_read_transaction(); - auto& sg = Realm::Internal::get_shared_group(realm); - auto version = sg.get_version_of_current_transaction(); - auto package = [&](auto& notifier) { - return !(notifier->has_run() && (!in_read || notifier->version() == version) && notifier->package_for_delivery()); - }; - notifiers.erase(std::remove_if(begin(notifiers), end(notifiers), package), end(notifiers)); - lock.unlock(); - - // no before advance because the Realm is already at the given version, - // because we're either sending initial notifications or the write was - // done on this Realm instance - - // Skip delivering if the Realm isn't in a read transaction - if (in_read) { - for (auto& notifier : notifiers) - notifier->deliver(sg); - } - - // but still call the change callbacks - for (auto& notifier : notifiers) - notifier->after_advance(); -} - -void RealmCoordinator::set_transaction_callback(std::function fn) -{ - m_transaction_callback = std::move(fn); -} diff --git a/Pods/Realm/Realm/ObjectStore/src/impl/results_notifier.cpp b/Pods/Realm/Realm/ObjectStore/src/impl/results_notifier.cpp deleted file mode 100644 index 36153d92..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/impl/results_notifier.cpp +++ /dev/null @@ -1,234 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "impl/results_notifier.hpp" - -using namespace realm; -using namespace realm::_impl; - -ResultsNotifier::ResultsNotifier(Results& target) -: CollectionNotifier(target.get_realm()) -, m_target_results(&target) -, m_target_is_in_table_order(target.is_in_table_order()) -{ - Query q = target.get_query(); - set_table(*q.get_table()); - m_query_handover = Realm::Internal::get_shared_group(*get_realm()).export_for_handover(q, MutableSourcePayload::Move); - SortDescriptor::generate_patch(target.get_sort(), m_sort_handover); - SortDescriptor::generate_patch(target.get_distinct(), m_distinct_handover); -} - -void ResultsNotifier::target_results_moved(Results& old_target, Results& new_target) -{ - auto lock = lock_target(); - - REALM_ASSERT(m_target_results == &old_target); - m_target_results = &new_target; -} - -void ResultsNotifier::release_data() noexcept -{ - m_query = nullptr; -} - -// Most of the inter-thread synchronization for run(), prepare_handover(), -// attach_to(), detach(), release_data() and deliver() is done by -// RealmCoordinator external to this code, which has some potentially -// non-obvious results on which members are and are not safe to use without -// holding a lock. -// -// add_required_change_info(), attach_to(), detach(), run(), -// prepare_handover(), and release_data() are all only ever called on a single -// background worker thread. call_callbacks() and deliver() are called on the -// target thread. Calls to prepare_handover() and deliver() are guarded by a -// lock. -// -// In total, this means that the safe data flow is as follows: -// - add_Required_change_info(), prepare_handover(), attach_to(), detach() and -// release_data() can read members written by each other -// - deliver() can read members written to in prepare_handover(), deliver(), -// and call_callbacks() -// - call_callbacks() and read members written to in deliver() -// -// Separately from the handover data flow, m_target_results is guarded by the target lock - -bool ResultsNotifier::do_add_required_change_info(TransactionChangeInfo& info) -{ - REALM_ASSERT(m_query); - m_info = &info; - - auto table_ndx = m_query->get_table()->get_index_in_group(); - if (info.table_moves_needed.size() <= table_ndx) - info.table_moves_needed.resize(table_ndx + 1); - info.table_moves_needed[table_ndx] = true; - - return has_run() && have_callbacks(); -} - -bool ResultsNotifier::need_to_run() -{ - REALM_ASSERT(m_info); - REALM_ASSERT(!m_tv.is_attached()); - - { - auto lock = lock_target(); - // Don't run the query if the results aren't actually going to be used - if (!get_realm() || (!have_callbacks() && !m_target_results->wants_background_updates())) { - return false; - } - } - - // If we've run previously, check if we need to rerun - if (has_run() && m_query->sync_view_if_needed() == m_last_seen_version) { - return false; - } - - return true; -} - -void ResultsNotifier::calculate_changes() -{ - size_t table_ndx = m_query->get_table()->get_index_in_group(); - if (has_run()) { - auto changes = table_ndx < m_info->tables.size() ? &m_info->tables[table_ndx] : nullptr; - - std::vector next_rows; - next_rows.reserve(m_tv.size()); - for (size_t i = 0; i < m_tv.size(); ++i) - next_rows.push_back(m_tv[i].get_index()); - - util::Optional move_candidates; - if (changes) { - auto const& moves = changes->moves; - for (auto& idx : m_previous_rows) { - auto it = lower_bound(begin(moves), end(moves), idx, - [](auto const& a, auto b) { return a.from < b; }); - if (it != moves.end() && it->from == idx) - idx = it->to; - else if (changes->deletions.contains(idx)) - idx = npos; - else - REALM_ASSERT_DEBUG(!changes->insertions.contains(idx)); - } - if (m_target_is_in_table_order && !m_sort) - move_candidates = changes->insertions; - } - - m_changes = CollectionChangeBuilder::calculate(m_previous_rows, next_rows, - get_modification_checker(*m_info, *m_query->get_table()), - move_candidates); - - m_previous_rows = std::move(next_rows); - } - else { - m_previous_rows.resize(m_tv.size()); - for (size_t i = 0; i < m_tv.size(); ++i) - m_previous_rows[i] = m_tv[i].get_index(); - } -} - -void ResultsNotifier::run() -{ - if (!need_to_run()) - return; - - m_query->sync_view_if_needed(); - m_tv = m_query->find_all(); - if (m_sort) { - m_tv.sort(m_sort); - } - if (m_distinct) { - m_tv.distinct(m_distinct); - } - m_last_seen_version = m_tv.sync_if_needed(); - - calculate_changes(); -} - -void ResultsNotifier::do_prepare_handover(SharedGroup& sg) -{ - if (!m_tv.is_attached()) { - // if the table version didn't change we can just reuse the same handover - // object and bump its version to the current SG version - if (m_tv_handover) - m_tv_handover->version = sg.get_version_of_current_transaction(); - - // add_changes() needs to be called even if there are no changes to - // clear the skip flag on the callbacks - add_changes({}); - return; - } - - REALM_ASSERT(m_tv.is_in_sync()); - - m_tv_handover = sg.export_for_handover(m_tv, MutableSourcePayload::Move); - - add_changes(std::move(m_changes)); - REALM_ASSERT(m_changes.empty()); - - // detach the TableView as we won't need it again and keeping it around - // makes advance_read() much more expensive - m_tv = {}; -} - -void ResultsNotifier::deliver(SharedGroup& sg) -{ - auto lock = lock_target(); - - // Target realm being null here indicates that we were unregistered while we - // were in the process of advancing the Realm version and preparing for - // delivery, i.e. the results was destroyed from the "wrong" thread - if (!get_realm()) { - return; - } - - REALM_ASSERT(!m_query_handover); - if (m_tv_to_deliver) { - Results::Internal::set_table_view(*m_target_results, - std::move(*sg.import_from_handover(std::move(m_tv_to_deliver)))); - } - REALM_ASSERT(!m_tv_to_deliver); -} - -bool ResultsNotifier::prepare_to_deliver() -{ - auto lock = lock_target(); - if (!get_realm()) - return false; - m_tv_to_deliver = std::move(m_tv_handover); - return true; -} - -void ResultsNotifier::do_attach_to(SharedGroup& sg) -{ - REALM_ASSERT(m_query_handover); - m_query = sg.import_from_handover(std::move(m_query_handover)); - m_sort = SortDescriptor::create_from_and_consume_patch(m_sort_handover, *m_query->get_table()); - m_distinct = SortDescriptor::create_from_and_consume_patch(m_distinct_handover, *m_query->get_table()); -} - -void ResultsNotifier::do_detach_from(SharedGroup& sg) -{ - REALM_ASSERT(m_query); - REALM_ASSERT(!m_tv.is_attached()); - - SortDescriptor::generate_patch(m_sort, m_sort_handover); - SortDescriptor::generate_patch(m_distinct, m_distinct_handover); - m_query_handover = sg.export_for_handover(*m_query, MutableSourcePayload::Move); - m_query = nullptr; -} diff --git a/Pods/Realm/Realm/ObjectStore/src/impl/transact_log_handler.cpp b/Pods/Realm/Realm/ObjectStore/src/impl/transact_log_handler.cpp deleted file mode 100644 index 1e8a4767..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/impl/transact_log_handler.cpp +++ /dev/null @@ -1,740 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "impl/transact_log_handler.hpp" - -#include "binding_context.hpp" -#include "impl/collection_notifier.hpp" -#include "index_set.hpp" -#include "shared_realm.hpp" - -#include -#include - -#include -#include - -using namespace realm; - -namespace { - -class KVOAdapter : public _impl::TransactionChangeInfo { -public: - KVOAdapter(std::vector& observers, BindingContext* context); - - void before(SharedGroup& sg); - void after(SharedGroup& sg); - -private: - BindingContext* m_context; - std::vector& m_observers; - std::vector m_invalidated; - - struct ListInfo { - BindingContext::ObserverState* observer; - size_t col; - _impl::CollectionChangeBuilder builder; - }; - std::vector m_lists; - VersionID m_version; -}; - -KVOAdapter::KVOAdapter(std::vector& observers, BindingContext* context) -: _impl::TransactionChangeInfo{} -, m_context(context) -, m_observers(observers) -{ - if (m_observers.empty()) - return; - - std::vector tables_needed; - for (auto& observer : observers) { - tables_needed.push_back(observer.table_ndx); - } - std::sort(begin(tables_needed), end(tables_needed)); - tables_needed.erase(std::unique(begin(tables_needed), end(tables_needed)), end(tables_needed)); - - auto realm = context->realm.lock(); - auto& group = realm->read_group(); - for (auto& observer : observers) { - auto table = group.get_table(observer.table_ndx); - for (size_t i = 0, count = table->get_column_count(); i < count; ++i) { - if (table->get_column_type(i) != type_LinkList) - continue; - m_lists.push_back({&observer, i, {}}); - } - } - - auto max = std::max_element(begin(tables_needed), end(tables_needed)); - if (*max >= table_modifications_needed.size()) - table_modifications_needed.resize(*max + 1, false); - if (*max >= table_moves_needed.size()) - table_moves_needed.resize(*max + 1, false); - for (auto& tbl : tables_needed) { - table_modifications_needed[tbl] = true; - table_moves_needed[tbl] = true; - } - for (auto& list : m_lists) - lists.push_back({list.observer->table_ndx, list.observer->row_ndx, list.col, &list.builder}); -} - -void KVOAdapter::before(SharedGroup& sg) -{ - if (!m_context) - return; - - m_version = sg.get_version_of_current_transaction(); - if (tables.empty()) - return; - - for (auto& observer : m_observers) { - size_t table_ndx = observer.table_ndx; - if (table_ndx < table_indices.size()) - table_ndx = table_indices[table_ndx]; - if (table_ndx >= tables.size()) - continue; - - auto const& table = tables[table_ndx]; - auto const& moves = table.moves; - auto idx = observer.row_ndx; - auto it = lower_bound(begin(moves), end(moves), idx, - [](auto const& a, auto b) { return a.from < b; }); - if (it != moves.end() && it->from == idx) - idx = it->to; - else if (table.deletions.contains(idx)) { - m_invalidated.push_back(observer.info); - continue; - } - else - idx = table.insertions.shift(table.deletions.unshift(idx)); - if (table.modifications.contains(idx)) { - observer.changes.resize(table.columns.size()); - size_t i = 0; - for (auto& c : table.columns) { - auto& change = observer.changes[i]; - if (table_ndx >= column_indices.size() || column_indices[table_ndx].empty()) - change.initial_column_index = i; - else if (i >= column_indices[table_ndx].size()) - change.initial_column_index = i - column_indices[table_ndx].size() + column_indices[table_ndx].back() + 1; - else - change.initial_column_index = column_indices[table_ndx][i]; - if (change.initial_column_index != npos && c.contains(idx)) - change.kind = BindingContext::ColumnInfo::Kind::Set; - ++i; - } - } - } - - for (auto& list : m_lists) { - if (list.builder.empty()) - continue; - // column should have been marked as modified and thus already exist in `changes` - REALM_ASSERT(list.col < list.observer->changes.size()); - auto& builder = list.builder; - auto& changes = list.observer->changes[list.col]; - - // KVO can't express moves (becaue NSArray doesn't have them), so - // transform them into a series of sets on each affected index when possible - if (!builder.insertions.empty() && builder.insertions.count() == builder.moves.size()) { - changes.kind = BindingContext::ColumnInfo::Kind::Set; - changes.indices = builder.modifications; - - size_t start = std::min(builder.insertions.begin()->first, builder.deletions.begin()->first); - size_t end = std::max(std::prev(builder.insertions.end())->second, - std::prev(builder.deletions.end())->second); - for (size_t i = start; i < end; ++i) - changes.indices.add(i); - } - // KVO can't express multiple types of changes at once - else if (builder.insertions.empty() + builder.modifications.empty() + builder.deletions.empty() < 2) { - changes.kind = BindingContext::ColumnInfo::Kind::SetAll; - } - else if (!builder.insertions.empty()) { - changes.kind = BindingContext::ColumnInfo::Kind::Insert; - changes.indices = builder.insertions; - } - else if (!builder.modifications.empty()) { - changes.kind = BindingContext::ColumnInfo::Kind::Set; - changes.indices = builder.modifications; - } - else { - REALM_ASSERT(!builder.deletions.empty()); - changes.kind = BindingContext::ColumnInfo::Kind::Remove; - changes.indices = builder.deletions; - } - } - m_context->will_change(m_observers, m_invalidated); -} - -void KVOAdapter::after(SharedGroup& sg) -{ - if (!m_context) - return; - m_context->did_change(m_observers, m_invalidated, - m_version != VersionID{} && - m_version != sg.get_version_of_current_transaction()); -} - -template -struct MarkDirtyMixin { - bool mark_dirty(size_t row, size_t col, _impl::Instruction instr=_impl::instr_Set) - { - // Ignore SetDefault and SetUnique as those conceptually cannot be - // changes to existing rows - if (instr == _impl::instr_Set) - static_cast(this)->mark_dirty(row, col); - return true; - } - - bool set_int(size_t c, size_t r, int_fast64_t, _impl::Instruction i, size_t) { return mark_dirty(r, c, i); } - bool set_bool(size_t c, size_t r, bool, _impl::Instruction i) { return mark_dirty(r, c, i); } - bool set_float(size_t c, size_t r, float, _impl::Instruction i) { return mark_dirty(r, c, i); } - bool set_double(size_t c, size_t r, double, _impl::Instruction i) { return mark_dirty(r, c, i); } - bool set_string(size_t c, size_t r, StringData, _impl::Instruction i, size_t) { return mark_dirty(r, c, i); } - bool set_binary(size_t c, size_t r, BinaryData, _impl::Instruction i) { return mark_dirty(r, c, i); } - bool set_olddatetime(size_t c, size_t r, OldDateTime, _impl::Instruction i) { return mark_dirty(r, c, i); } - bool set_timestamp(size_t c, size_t r, Timestamp, _impl::Instruction i) { return mark_dirty(r, c, i); } - bool set_table(size_t c, size_t r, _impl::Instruction i) { return mark_dirty(r, c, i); } - bool set_mixed(size_t c, size_t r, const Mixed&, _impl::Instruction i) { return mark_dirty(r, c, i); } - bool set_link(size_t c, size_t r, size_t, size_t, _impl::Instruction i) { return mark_dirty(r, c, i); } - bool set_null(size_t c, size_t r, _impl::Instruction i, size_t) { return mark_dirty(r, c, i); } - - bool add_int(size_t col, size_t row, int_fast64_t) { return mark_dirty(row, col); } - bool nullify_link(size_t col, size_t row, size_t) { return mark_dirty(row, col); } - bool insert_substring(size_t col, size_t row, size_t, StringData) { return mark_dirty(row, col); } - bool erase_substring(size_t col, size_t row, size_t, size_t) { return mark_dirty(row, col); } - - bool set_int_unique(size_t, size_t, size_t, int_fast64_t) { return true; } - bool set_string_unique(size_t, size_t, size_t, StringData) { return true; } -}; - -class TransactLogValidationMixin { - // Index of currently selected table - size_t m_current_table = 0; - - REALM_NORETURN - REALM_NOINLINE - void schema_error() - { - throw std::logic_error("Schema mismatch detected: another process has modified the Realm file's schema in an incompatible way"); - } - -protected: - size_t current_table() const noexcept { return m_current_table; } - -public: - bool select_descriptor(int levels, const size_t*) - { - // subtables not supported - return levels == 0; - } - - bool select_table(size_t group_level_ndx, int, const size_t*) noexcept - { - m_current_table = group_level_ndx; - return true; - } - - // Removing or renaming things while a Realm is open is never supported - bool erase_group_level_table(size_t, size_t) { schema_error(); } - bool rename_group_level_table(size_t, StringData) { schema_error(); } - bool erase_column(size_t) { schema_error(); } - bool erase_link_column(size_t, size_t, size_t) { schema_error(); } - bool rename_column(size_t, StringData) { schema_error(); } - - // Schema changes which don't involve a change in the schema version are - // allowed - bool add_search_index(size_t) { return true; } - bool remove_search_index(size_t) { return true; } - - // Additive changes and reorderings are supported - bool insert_group_level_table(size_t, size_t, StringData) { return true; } - bool insert_column(size_t, DataType, StringData, bool) { return true; } - bool insert_link_column(size_t, DataType, StringData, size_t, size_t) { return true; } - bool set_link_type(size_t, LinkType) { return true; } - bool move_column(size_t, size_t) { return true; } - bool move_group_level_table(size_t, size_t) { return true; } - - // Non-schema changes are all allowed - void parse_complete() { } - bool select_link_list(size_t, size_t, size_t) { return true; } - bool insert_empty_rows(size_t, size_t, size_t, bool) { return true; } - bool erase_rows(size_t, size_t, size_t, bool) { return true; } - bool swap_rows(size_t, size_t) { return true; } - bool clear_table() noexcept { return true; } - bool link_list_set(size_t, size_t, size_t) { return true; } - bool link_list_insert(size_t, size_t, size_t) { return true; } - bool link_list_erase(size_t, size_t) { return true; } - bool link_list_nullify(size_t, size_t) { return true; } - bool link_list_clear(size_t) { return true; } - bool link_list_move(size_t, size_t) { return true; } - bool link_list_swap(size_t, size_t) { return true; } - bool merge_rows(size_t, size_t) { return true; } - bool optimize_table() { return true; } -}; - - -// A transaction log handler that just validates that all operations made are -// ones supported by the object store -struct TransactLogValidator : public TransactLogValidationMixin, public MarkDirtyMixin { - void mark_dirty(size_t, size_t) { } -}; - -// Move the value at container[from] to container[to], shifting everything in -// between, or do nothing if either are out of bounds -template -void rotate(Container& container, size_t from, size_t to) -{ - REALM_ASSERT(from != to); - if (from >= container.size() && to >= container.size()) - return; - if (from >= container.size() || to >= container.size()) - container.resize(std::max(from, to) + 1); - if (from < to) - std::rotate(begin(container) + from, begin(container) + from + 1, begin(container) + to + 1); - else - std::rotate(begin(container) + to, begin(container) + from, begin(container) + from + 1); -} - -// Insert a default-initialized value at pos if there is anything after pos in the container. -template -void insert_empty_at(Container& container, size_t pos) -{ - if (pos < container.size()) - container.emplace(container.begin() + pos); -} - -// Shift `value` to reflect a move from `from` to `to` -void adjust_for_move(size_t& value, size_t from, size_t to) -{ - if (value == from) - value = to; - else if (value > from && value <= to) - --value; - else if (value < from && value >= to) - ++value; -} - -void adjust_for_move(std::vector& values, size_t from, size_t to) -{ - for (auto& value : values) - adjust_for_move(value, from, to); -} - -void expand_to(std::vector& cols, size_t i) -{ - auto old_size = cols.size(); - if (old_size > i) - return; - - auto new_size = std::max(old_size * 2, i + 1); - cols.resize(new_size); - std::iota(&cols[old_size], &cols[new_size], old_size == 0 ? 0 : cols[old_size - 1] + 1); -} - -void adjust_ge(std::vector& values, size_t i) -{ - for (auto& value : values) { - if (value >= i) - ++value; - } -} - -// Extends TransactLogValidator to track changes made to LinkViews -class TransactLogObserver : public TransactLogValidationMixin, public MarkDirtyMixin { - _impl::TransactionChangeInfo& m_info; - _impl::CollectionChangeBuilder* m_active = nullptr; - - _impl::CollectionChangeBuilder* get_change() - { - auto tbl_ndx = current_table(); - if (!m_info.track_all && (tbl_ndx >= m_info.table_modifications_needed.size() || !m_info.table_modifications_needed[tbl_ndx])) - return nullptr; - if (m_info.tables.size() <= tbl_ndx) { - m_info.tables.resize(std::max(m_info.tables.size() * 2, tbl_ndx + 1)); - } - return &m_info.tables[tbl_ndx]; - } - - bool need_move_info() const - { - auto tbl_ndx = current_table(); - return m_info.track_all || (tbl_ndx < m_info.table_moves_needed.size() && m_info.table_moves_needed[tbl_ndx]); - } - - -public: - TransactLogObserver(_impl::TransactionChangeInfo& info) - : m_info(info) { } - - void mark_dirty(size_t row, size_t col) - { - if (auto change = get_change()) - change->modify(row, col); - } - - void parse_complete() - { - for (auto& table : m_info.tables) { - table.parse_complete(); - } - for (auto& list : m_info.lists) { - list.changes->clean_up_stale_moves(); - } - } - - bool select_link_list(size_t col, size_t row, size_t) - { - mark_dirty(row, col); - - m_active = nullptr; - // When there are multiple source versions there could be multiple - // change objects for a single LinkView, in which case we need to use - // the last one - for (auto it = m_info.lists.rbegin(), end = m_info.lists.rend(); it != end; ++it) { - if (it->table_ndx == current_table() && it->row_ndx == row && it->col_ndx == col) { - m_active = it->changes; - break; - } - } - return true; - } - - bool link_list_set(size_t index, size_t, size_t) - { - if (m_active) - m_active->modify(index); - return true; - } - - bool link_list_insert(size_t index, size_t, size_t) - { - if (m_active) - m_active->insert(index); - return true; - } - - bool link_list_erase(size_t index, size_t) - { - if (m_active) - m_active->erase(index); - return true; - } - - bool link_list_nullify(size_t index, size_t prior_size) - { - return link_list_erase(index, prior_size); - } - - bool link_list_swap(size_t index1, size_t index2) - { - link_list_set(index1, 0, npos); - link_list_set(index2, 0, npos); - return true; - } - - bool link_list_clear(size_t old_size) - { - if (m_active) - m_active->clear(old_size); - return true; - } - - bool link_list_move(size_t from, size_t to) - { - if (m_active) - m_active->move(from, to); - return true; - } - - bool insert_empty_rows(size_t row_ndx, size_t num_rows_to_insert, size_t, bool) - { - if (auto change = get_change()) - change->insert(row_ndx, num_rows_to_insert, need_move_info()); - for (auto& list : m_info.lists) { - if (list.table_ndx == current_table() && list.row_ndx >= row_ndx) - list.row_ndx += num_rows_to_insert; - } - return true; - } - - bool erase_rows(size_t row_ndx, size_t, size_t prior_num_rows, bool unordered) - { - if (!unordered) { - if (auto change = get_change()) - change->deletions.add(row_ndx); - return true; - } - REALM_ASSERT(unordered); - size_t last_row = prior_num_rows - 1; - - for (auto it = begin(m_info.lists); it != end(m_info.lists); ) { - if (it->table_ndx == current_table()) { - if (it->row_ndx == row_ndx) { - *it = std::move(m_info.lists.back()); - m_info.lists.pop_back(); - continue; - } - if (it->row_ndx == last_row) - it->row_ndx = row_ndx; - } - ++it; - } - - if (auto change = get_change()) - change->move_over(row_ndx, last_row, need_move_info()); - return true; - } - - bool swap_rows(size_t row_ndx_1, size_t row_ndx_2) { - REALM_ASSERT(row_ndx_1 < row_ndx_2); - for (auto& list : m_info.lists) { - if (list.table_ndx == current_table()) { - if (list.row_ndx == row_ndx_1) - list.row_ndx = row_ndx_2; - else if (list.row_ndx == row_ndx_2) - list.row_ndx = row_ndx_1; - } - } - if (auto change = get_change()) - change->swap(row_ndx_1, row_ndx_2, need_move_info()); - return true; - } - - bool merge_rows(size_t from, size_t to) - { - for (auto& list : m_info.lists) { - if (list.table_ndx == current_table() && list.row_ndx == from) - list.row_ndx = to; - } - if (auto change = get_change()) - change->subsume(from, to, need_move_info()); - return true; - } - - bool clear_table() - { - auto tbl_ndx = current_table(); - auto it = remove_if(begin(m_info.lists), end(m_info.lists), - [&](auto const& lv) { return lv.table_ndx == tbl_ndx; }); - m_info.lists.erase(it, end(m_info.lists)); - if (auto change = get_change()) - change->clear(std::numeric_limits::max()); - return true; - } - - bool insert_column(size_t ndx, DataType, StringData, bool) - { - if (auto change = get_change()) - change->insert_column(ndx); - for (auto& list : m_info.lists) { - if (list.table_ndx == current_table() && list.col_ndx >= ndx) - ++list.col_ndx; - } - if (m_info.column_indices.size() <= current_table()) - m_info.column_indices.resize(current_table() + 1); - auto& indices = m_info.column_indices[current_table()]; - expand_to(indices, ndx); - insert_empty_at(indices, ndx); - indices[ndx] = npos; - return true; - } - - void prepare_table_indices() - { - if (m_info.table_indices.empty() && !m_info.table_modifications_needed.empty()) { - m_info.table_indices.resize(m_info.table_modifications_needed.size()); - std::iota(begin(m_info.table_indices), end(m_info.table_indices), 0); - } - } - - bool insert_group_level_table(size_t ndx, size_t, StringData) - { - for (auto& list : m_info.lists) { - if (list.table_ndx >= ndx) - ++list.table_ndx; - } - prepare_table_indices(); - adjust_ge(m_info.table_indices, ndx); - insert_empty_at(m_info.tables, ndx); - insert_empty_at(m_info.table_moves_needed, ndx); - insert_empty_at(m_info.table_modifications_needed, ndx); - return true; - } - - bool move_column(size_t from, size_t to) - { - if (auto change = get_change()) - change->move_column(from, to); - for (auto& list : m_info.lists) { - if (list.table_ndx == current_table()) - adjust_for_move(list.col_ndx, from, to); - } - if (m_info.column_indices.size() <= current_table()) - m_info.column_indices.resize(current_table() + 1); - expand_to(m_info.column_indices[current_table()], std::max(from, to) + 1); - rotate(m_info.column_indices[current_table()], from, to); - return true; - } - - bool move_group_level_table(size_t from, size_t to) - { - for (auto& list : m_info.lists) - adjust_for_move(list.table_ndx, from, to); - - prepare_table_indices(); - adjust_for_move(m_info.table_indices, from, to); - rotate(m_info.tables, from, to); - rotate(m_info.table_modifications_needed, from, to); - rotate(m_info.table_moves_needed, from, to); - return true; - } - - bool insert_link_column(size_t ndx, DataType type, StringData name, size_t, size_t) { return insert_column(ndx, type, name, false); } -}; - -class KVOTransactLogObserver : public TransactLogObserver { - KVOAdapter m_adapter; - _impl::NotifierPackage& m_notifiers; - SharedGroup& m_sg; - -public: - KVOTransactLogObserver(std::vector& observers, - BindingContext* context, - _impl::NotifierPackage& notifiers, - SharedGroup& sg) - : TransactLogObserver(m_adapter) - , m_adapter(observers, context) - , m_notifiers(notifiers) - , m_sg(sg) - { - } - - ~KVOTransactLogObserver() - { - m_adapter.after(m_sg); - } - - void parse_complete() - { - TransactLogObserver::parse_complete(); - m_adapter.before(m_sg); - - using sgf = _impl::SharedGroupFriend; - m_notifiers.package_and_wait(sgf::get_version_of_latest_snapshot(m_sg)); - m_notifiers.before_advance(); - } -}; - -template -void advance_with_notifications(BindingContext* context, SharedGroup& sg, Func&& func, - _impl::NotifierPackage& notifiers) -{ - auto old_version = sg.get_version_of_current_transaction(); - std::vector observers; - if (context) { - observers = context->get_observed_rows(); - } - - // Advancing to the latest version with notifiers requires using the full - // transaction log observer so that we have a point where we know what - // version we're going to before we actually advance to that version - if (observers.empty() && (!notifiers || notifiers.version())) { - notifiers.before_advance(); - func(TransactLogValidator()); - auto new_version = sg.get_version_of_current_transaction(); - if (context && old_version != new_version) - context->did_change({}, {}); - // did_change() can change the read version, and if it does we can't - // deliver notifiers - if (new_version == sg.get_version_of_current_transaction()) - notifiers.deliver(sg); - notifiers.after_advance(); - return; - } - - func(KVOTransactLogObserver(observers, context, notifiers, sg)); - notifiers.package_and_wait(sg.get_version_of_current_transaction().version); // is a no-op if parse_complete() was called - notifiers.deliver(sg); - notifiers.after_advance(); -} - -} // anonymous namespace - -namespace realm { -namespace _impl { - -namespace transaction { -void advance(SharedGroup& sg, BindingContext*, VersionID version) -{ - LangBindHelper::advance_read(sg, TransactLogValidator(), version); -} - -void advance(SharedGroup& sg, BindingContext* context, NotifierPackage& notifiers) -{ - advance_with_notifications(context, sg, [&](auto&&... args) { - LangBindHelper::advance_read(sg, std::move(args)..., notifiers.version().value_or(VersionID{})); - }, notifiers); -} - -void begin_without_validation(SharedGroup& sg) -{ - LangBindHelper::promote_to_write(sg); -} - -void begin(SharedGroup& sg, BindingContext* context, NotifierPackage& notifiers) -{ - advance_with_notifications(context, sg, [&](auto&&... args) { - LangBindHelper::promote_to_write(sg, std::move(args)...); - }, notifiers); -} - -void commit(SharedGroup& sg) -{ - LangBindHelper::commit_and_continue_as_read(sg); -} - -void cancel(SharedGroup& sg, BindingContext* context) -{ - std::vector observers; - if (context) { - observers = context->get_observed_rows(); - } - if (observers.empty()) { - LangBindHelper::rollback_and_continue_as_read(sg); - return; - } - - _impl::NotifierPackage notifiers; - LangBindHelper::rollback_and_continue_as_read(sg, KVOTransactLogObserver(observers, context, notifiers, sg)); -} - -void advance(SharedGroup& sg, TransactionChangeInfo& info, VersionID version) -{ - if (!info.track_all && info.table_modifications_needed.empty() && info.lists.empty()) { - LangBindHelper::advance_read(sg, version); - } - else { - LangBindHelper::advance_read(sg, TransactLogObserver(info), version); - } - -} - -} // namespace transaction -} // namespace _impl -} // namespace realm diff --git a/Pods/Realm/Realm/ObjectStore/src/impl/weak_realm_notifier.cpp b/Pods/Realm/Realm/ObjectStore/src/impl/weak_realm_notifier.cpp deleted file mode 100644 index 1620eeab..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/impl/weak_realm_notifier.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "impl/weak_realm_notifier.hpp" - -#include "shared_realm.hpp" -#include "util/event_loop_signal.hpp" - -using namespace realm; -using namespace realm::_impl; - - -WeakRealmNotifier::WeakRealmNotifier(const std::shared_ptr& realm, bool cache) -: m_realm(realm) -, m_execution_context(realm->config().execution_context) -, m_realm_key(realm.get()) -, m_cache(cache) -, m_signal(std::make_shared>(Callback{realm})) -{ -} - -WeakRealmNotifier::~WeakRealmNotifier() = default; - -void WeakRealmNotifier::Callback::operator()() const -{ - if (auto realm = weak_realm.lock()) { - realm->notify(); - } -} - -void WeakRealmNotifier::notify() -{ - m_signal->notify(); -} diff --git a/Pods/Realm/Realm/ObjectStore/src/index_set.cpp b/Pods/Realm/Realm/ObjectStore/src/index_set.cpp deleted file mode 100644 index a5c30c2b..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/index_set.cpp +++ /dev/null @@ -1,707 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "index_set.hpp" - -#include - -#include - -using namespace realm; -using namespace realm::_impl; - -const size_t IndexSet::npos; - -template -void MutableChunkedRangeVectorIterator::set(size_t front, size_t back) -{ - this->m_outer->count -= this->m_inner->second - this->m_inner->first; - if (this->offset() == 0) { - this->m_outer->begin = front; - } - if (this->m_inner == &this->m_outer->data.back()) { - this->m_outer->end = back; - } - this->m_outer->count += back - front; - this->m_inner->first = front; - this->m_inner->second = back; -} - -template -void MutableChunkedRangeVectorIterator::adjust(ptrdiff_t front, ptrdiff_t back) -{ - if (this->offset() == 0) { - this->m_outer->begin += front; - } - if (this->m_inner == &this->m_outer->data.back()) { - this->m_outer->end += back; - } - this->m_outer->count += -front + back; - this->m_inner->first += front; - this->m_inner->second += back; -} - -template -void MutableChunkedRangeVectorIterator::shift(ptrdiff_t distance) -{ - if (this->offset() == 0) { - this->m_outer->begin += distance; - } - if (this->m_inner == &this->m_outer->data.back()) { - this->m_outer->end += distance; - } - this->m_inner->first += distance; - this->m_inner->second += distance; -} - -void ChunkedRangeVector::push_back(value_type value) -{ - if (!empty() && m_data.back().data.size() < max_size) { - auto& range = m_data.back(); - REALM_ASSERT(range.end <= value.first); - - range.data.push_back(value); - range.count += value.second - value.first; - range.end = value.second; - } - else { - m_data.push_back({{std::move(value)}, value.first, value.second, value.second - value.first}); - } - verify(); -} - -ChunkedRangeVector::iterator ChunkedRangeVector::insert(iterator pos, value_type value) -{ - if (pos.m_outer == m_data.end()) { - push_back(std::move(value)); - return std::prev(end()); - } - - pos = ensure_space(pos); - auto& chunk = *pos.m_outer; - pos.m_inner = &*chunk.data.insert(pos.m_outer->data.begin() + pos.offset(), value); - chunk.count += value.second - value.first; - chunk.begin = std::min(chunk.begin, value.first); - chunk.end = std::max(chunk.end, value.second); - - verify(); - return pos; -} - -ChunkedRangeVector::iterator ChunkedRangeVector::ensure_space(iterator pos) -{ - if (pos.m_outer->data.size() + 1 <= max_size) - return pos; - - auto offset = pos.offset(); - - // Split the chunk in half to make space for the new insertion - auto new_pos = m_data.insert(pos.m_outer + 1, Chunk{}); - auto prev = new_pos - 1; - auto to_move = max_size / 2; - new_pos->data.reserve(to_move); - new_pos->data.assign(prev->data.end() - to_move, prev->data.end()); - prev->data.resize(prev->data.size() - to_move); - - size_t moved_count = 0; - for (auto range : new_pos->data) - moved_count += range.second - range.first; - - prev->end = prev->data.back().second; - prev->count -= moved_count; - new_pos->begin = new_pos->data.front().first; - new_pos->end = new_pos->data.back().second; - new_pos->count = moved_count; - - if (offset >= to_move) { - pos.m_outer = new_pos; - offset -= to_move; - } - else { - pos.m_outer = prev; - } - pos.m_end = m_data.end(); - pos.m_inner = &pos.m_outer->data[offset]; - verify(); - return pos; -} - -ChunkedRangeVector::iterator ChunkedRangeVector::erase(iterator pos) -{ - auto offset = pos.offset(); - auto& chunk = *pos.m_outer; - chunk.count -= pos->second - pos->first; - chunk.data.erase(chunk.data.begin() + offset); - - if (chunk.data.size() == 0) { - pos.m_outer = m_data.erase(pos.m_outer); - pos.m_end = m_data.end(); - pos.m_inner = pos.m_outer == m_data.end() ? nullptr : &pos.m_outer->data.front(); - verify(); - return pos; - } - - chunk.begin = chunk.data.front().first; - chunk.end = chunk.data.back().second; - if (offset < chunk.data.size()) - pos.m_inner = &chunk.data[offset]; - else { - ++pos.m_outer; - pos.m_inner = pos.m_outer == pos.m_end ? nullptr : &pos.m_outer->data.front(); - } - - verify(); - return pos; -} - -void ChunkedRangeVector::verify() const noexcept -{ -#ifdef REALM_DEBUG - size_t prev_end = -1; - for (auto range : *this) { - REALM_ASSERT(range.first < range.second); - REALM_ASSERT(prev_end == size_t(-1) || range.first > prev_end); - prev_end = range.second; - } - - for (auto& chunk : m_data) { - REALM_ASSERT(!chunk.data.empty()); - REALM_ASSERT(chunk.data.front().first == chunk.begin); - REALM_ASSERT(chunk.data.back().second == chunk.end); - REALM_ASSERT(chunk.count <= chunk.end - chunk.begin); - size_t count = 0; - for (auto range : chunk.data) - count += range.second - range.first; - REALM_ASSERT(count == chunk.count); - } -#endif -} - -namespace { -class ChunkedRangeVectorBuilder { -public: - using value_type = std::pair; - - ChunkedRangeVectorBuilder(ChunkedRangeVector const& expected); - void push_back(size_t index); - void push_back(std::pair range); - std::vector finalize(); -private: - std::vector m_data; - size_t m_outer_pos = 0; -}; - -ChunkedRangeVectorBuilder::ChunkedRangeVectorBuilder(ChunkedRangeVector const& expected) -{ - size_t size = 0; - for (auto const& chunk : expected.m_data) - size += chunk.data.size(); - m_data.resize(size / ChunkedRangeVector::max_size + 1); - for (size_t i = 0; i < m_data.size() - 1; ++i) - m_data[i].data.reserve(ChunkedRangeVector::max_size); -} - -void ChunkedRangeVectorBuilder::push_back(size_t index) -{ - push_back({index, index + 1}); -} - -void ChunkedRangeVectorBuilder::push_back(std::pair range) -{ - auto& chunk = m_data[m_outer_pos]; - if (chunk.data.empty()) { - chunk.data.push_back(range); - chunk.count = range.second - range.first; - chunk.begin = range.first; - } - else if (range.first == chunk.data.back().second) { - chunk.data.back().second = range.second; - chunk.count += range.second - range.first; - } - else if (chunk.data.size() < ChunkedRangeVector::max_size) { - chunk.data.push_back(range); - chunk.count += range.second - range.first; - } - else { - chunk.end = chunk.data.back().second; - ++m_outer_pos; - if (m_outer_pos >= m_data.size()) - m_data.push_back({{range}, range.first, 0, 1}); - else { - auto& chunk = m_data[m_outer_pos]; - chunk.data.push_back(range); - chunk.begin = range.first; - chunk.count = range.second - range.first; - } - } -} - -std::vector ChunkedRangeVectorBuilder::finalize() -{ - if (!m_data.empty()) { - m_data.resize(m_outer_pos + 1); - if (m_data.back().data.empty()) - m_data.pop_back(); - else - m_data.back().end = m_data.back().data.back().second; - } - return std::move(m_data); -} -} - -IndexSet::IndexSet(std::initializer_list values) -{ - for (size_t v : values) - add(v); -} - -bool IndexSet::contains(size_t index) const -{ - auto it = const_cast(this)->find(index); - return it != end() && it->first <= index; -} - -size_t IndexSet::count(size_t start_index, size_t end_index) const -{ - auto it = const_cast(this)->find(start_index); - const auto end = this->end(); - if (it == end || it->first >= end_index) { - return 0; - } - if (it->second >= end_index) - return std::min(it->second, end_index) - std::max(it->first, start_index); - - size_t ret = 0; - - if (start_index > it->first || it.offset() != 0) { - // Start index is in the middle of a chunk, so start by counting the - // rest of that chunk - ret = it->second - std::max(it->first, start_index); - for (++it; it != end && it->second < end_index && it.offset() != 0; ++it) { - ret += it->second - it->first; - } - if (it != end && it->first < end_index && it.offset() != 0) - ret += end_index - it->first; - if (it == end || it->second >= end_index) - return ret; - } - - // Now count all complete chunks that fall within the range - while (it != end && it.outer()->end <= end_index) { - REALM_ASSERT_DEBUG(it.offset() == 0); - ret += it.outer()->count; - it.next_chunk(); - } - - // Cound all complete ranges within the last chunk - while (it != end && it->second <= end_index) { - ret += it->second - it->first; - ++it; - } - - // And finally add in the partial last range - if (it != end && it->first < end_index) - ret += end_index - it->first; - return ret; -} - -IndexSet::iterator IndexSet::find(size_t index) -{ - return find(index, begin()); -} - -IndexSet::iterator IndexSet::find(size_t index, iterator begin) -{ - auto it = std::find_if(begin.outer(), m_data.end(), - [&](auto const& lft) { return lft.end > index; }); - if (it == m_data.end()) - return end(); - if (index < it->begin) - return iterator(it, m_data.end(), &it->data[0]); - auto inner_begin = it->data.begin(); - if (it == begin.outer()) - inner_begin += begin.offset(); - auto inner = std::lower_bound(inner_begin, it->data.end(), index, - [&](auto const& lft, auto) { return lft.second <= index; }); - REALM_ASSERT_DEBUG(inner != it->data.end()); - - return iterator(it, m_data.end(), &*inner); -} - -void IndexSet::add(size_t index) -{ - do_add(find(index), index); -} - -void IndexSet::add(IndexSet const& other) -{ - auto it = begin(); - for (size_t index : other.as_indexes()) { - it = do_add(find(index, it), index); - } -} - -size_t IndexSet::add_shifted(size_t index) -{ - iterator it = begin(), end = this->end(); - - // Shift for any complete chunks before the target - for (; it != end && it.outer()->end <= index; it.next_chunk()) - index += it.outer()->count; - - // And any ranges within the last partial chunk - for (; it != end && it->first <= index; ++it) - index += it->second - it->first; - - do_add(it, index); - return index; -} - -void IndexSet::add_shifted_by(IndexSet const& shifted_by, IndexSet const& values) -{ - if (values.empty()) - return; - -#ifdef REALM_DEBUG - size_t expected = std::distance(as_indexes().begin(), as_indexes().end()); - for (auto index : values.as_indexes()) { - if (!shifted_by.contains(index)) - ++expected; - } -#endif - - ChunkedRangeVectorBuilder builder(*this); - - auto old_it = cbegin(), old_end = cend(); - auto shift_it = shifted_by.cbegin(), shift_end = shifted_by.cend(); - - size_t skip_until = 0; - size_t old_shift = 0; - size_t new_shift = 0; - for (size_t index : values.as_indexes()) { - for (; shift_it != shift_end && shift_it->first <= index; ++shift_it) { - new_shift += shift_it->second - shift_it->first; - skip_until = shift_it->second; - } - if (index < skip_until) - continue; - - for (; old_it != old_end && old_it->first <= index - new_shift + old_shift; ++old_it) { - for (size_t i = old_it->first; i < old_it->second; ++i) - builder.push_back(i); - old_shift += old_it->second - old_it->first; - } - - REALM_ASSERT(index >= new_shift); - builder.push_back(index - new_shift + old_shift); - } - - copy(old_it, old_end, std::back_inserter(builder)); - m_data = builder.finalize(); - -#ifdef REALM_DEBUG - REALM_ASSERT((size_t)std::distance(as_indexes().begin(), as_indexes().end()) == expected); -#endif -} - -void IndexSet::set(size_t len) -{ - clear(); - if (len) { - push_back({0, len}); - } -} - -void IndexSet::insert_at(size_t index, size_t count) -{ - REALM_ASSERT(count > 0); - - auto pos = find(index); - auto end = this->end(); - bool in_existing = false; - if (pos != end) { - if (pos->first <= index) { - in_existing = true; - pos.adjust(0, count); - } - else { - pos.shift(count); - } - for (auto it = std::next(pos); it != end; ++it) - it.shift(count); - } - if (!in_existing) { - for (size_t i = 0; i < count; ++i) - pos = std::next(do_add(pos, index + i)); - } - - verify(); -} - -void IndexSet::insert_at(IndexSet const& positions) -{ - if (positions.empty()) - return; - if (empty()) { - *this = positions; - return; - } - - IndexIterator begin1 = cbegin(), begin2 = positions.cbegin(); - IndexIterator end1 = cend(), end2 = positions.cend(); - - ChunkedRangeVectorBuilder builder(*this); - size_t shift = 0; - while (begin1 != end1 && begin2 != end2) { - if (*begin1 + shift < *begin2) { - builder.push_back(*begin1++ + shift); - } - else { - ++shift; - builder.push_back(*begin2++); - } - } - for (; begin1 != end1; ++begin1) - builder.push_back(*begin1 + shift); - for (; begin2 != end2; ++begin2) - builder.push_back(*begin2); - - m_data = builder.finalize(); -} - -void IndexSet::shift_for_insert_at(size_t index, size_t count) -{ - REALM_ASSERT(count > 0); - - auto it = find(index); - if (it == end()) - return; - - for (auto pos = it, end = this->end(); pos != end; ++pos) - pos.shift(count); - - // If the range contained the insertion point, split the range and move - // the part of it before the insertion point back - if (it->first < index + count) { - auto old_second = it->second; - it.set(it->first - count, index); - insert(std::next(it), {index + count, old_second}); - } - verify(); -} - -void IndexSet::shift_for_insert_at(realm::IndexSet const& values) -{ - if (empty() || values.empty()) - return; - if (values.m_data.front().begin >= m_data.back().end) - return; - - IndexIterator begin1 = cbegin(), begin2 = values.cbegin(); - IndexIterator end1 = cend(), end2 = values.cend(); - - ChunkedRangeVectorBuilder builder(*this); - size_t shift = 0; - while (begin1 != end1 && begin2 != end2) { - if (*begin1 + shift < *begin2) { - builder.push_back(*begin1++ + shift); - } - else { - ++shift; - begin2++; - } - } - for (; begin1 != end1; ++begin1) - builder.push_back(*begin1 + shift); - - m_data = builder.finalize(); -} - -void IndexSet::erase_at(size_t index) -{ - auto it = find(index); - if (it != end()) - do_erase(it, index); -} - -void IndexSet::erase_at(IndexSet const& positions) -{ - if (empty() || positions.empty()) - return; - - ChunkedRangeVectorBuilder builder(*this); - - IndexIterator begin1 = cbegin(), begin2 = positions.cbegin(); - IndexIterator end1 = cend(), end2 = positions.cend(); - - size_t shift = 0; - while (begin1 != end1 && begin2 != end2) { - if (*begin1 < *begin2) { - builder.push_back(*begin1++ - shift); - } - else if (*begin1 == *begin2) { - ++shift; - ++begin1; - ++begin2; - } - else { - ++shift; - ++begin2; - } - } - for (; begin1 != end1; ++begin1) - builder.push_back(*begin1 - shift); - - m_data = builder.finalize(); -} - -size_t IndexSet::erase_or_unshift(size_t index) -{ - auto shifted = index; - iterator it = begin(), end = this->end(); - - // Shift for any complete chunks before the target - for (; it != end && it.outer()->end <= index; it.next_chunk()) - shifted -= it.outer()->count; - - // And any ranges within the last partial chunk - for (; it != end && it->second <= index; ++it) - shifted -= it->second - it->first; - - if (it == end) - return shifted; - - if (it->first <= index) - shifted = npos; - - do_erase(it, index); - - return shifted; -} - -void IndexSet::do_erase(iterator it, size_t index) -{ - if (it->first <= index) { - if (it->first + 1 == it->second) { - it = erase(it); - } - else { - it.adjust(0, -1); - ++it; - } - } - else if (it != begin() && std::prev(it)->second + 1 == it->first) { - std::prev(it).adjust(0, it->second - it->first); - it = erase(it); - } - - for (; it != end(); ++it) - it.shift(-1); -} - -IndexSet::iterator IndexSet::do_remove(iterator it, size_t begin, size_t end) -{ - for (it = find(begin, it); it != this->end() && it->first < end; it = find(begin, it)) { - // Trim off any part of the range to remove that's before the matching range - begin = std::max(it->first, begin); - - // If the matching range extends to both sides of the range to remove, - // split it on the range to remove - if (it->first < begin && it->second > end) { - auto old_second = it->second; - it.set(it->first, begin); - it = std::prev(insert(std::next(it), {end, old_second})); - } - // Range to delete now coverages (at least) one end of the matching range - else if (begin == it->first && end >= it->second) - it = erase(it); - else if (begin == it->first) - it.set(end, it->second); - else - it.set(it->first, begin); - } - return it; -} - -void IndexSet::remove(size_t index, size_t count) -{ - do_remove(find(index), index, index + count); -} - -void IndexSet::remove(realm::IndexSet const& values) -{ - auto it = begin(); - for (auto range : values) { - it = do_remove(it, range.first, range.second); - if (it == end()) - return; - } -} - -size_t IndexSet::shift(size_t index) const -{ - // FIXME: optimize - for (auto range : *this) { - if (range.first > index) - break; - index += range.second - range.first; - } - return index; -} - -size_t IndexSet::unshift(size_t index) const -{ - REALM_ASSERT_DEBUG(!contains(index)); - return index - count(0, index); -} - -void IndexSet::clear() -{ - m_data.clear(); -} - -IndexSet::iterator IndexSet::do_add(iterator it, size_t index) -{ - verify(); - bool more_before = it != begin(), valid = it != end(); - REALM_ASSERT(!more_before || index >= std::prev(it)->second); - if (valid && it->first <= index && it->second > index) { - // index is already in set - return it; - } - if (more_before && std::prev(it)->second == index) { - auto prev = std::prev(it); - // index is immediately after an existing range - prev.adjust(0, 1); - - if (valid && prev->second == it->first) { - // index joins two existing ranges - prev.adjust(0, it->second - it->first); - return std::prev(erase(it)); - } - return prev; - } - if (valid && it->first == index + 1) { - // index is immediately before an existing range - it.adjust(-1, 0); - return it; - } - - // index is not next to an existing range - return insert(it, {index, index + 1}); -} diff --git a/Pods/Realm/Realm/ObjectStore/src/list.cpp b/Pods/Realm/Realm/ObjectStore/src/list.cpp deleted file mode 100644 index c1d3591a..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/list.cpp +++ /dev/null @@ -1,229 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "list.hpp" - -#include "impl/list_notifier.hpp" -#include "impl/realm_coordinator.hpp" -#include "object_store.hpp" -#include "results.hpp" -#include "schema.hpp" -#include "shared_realm.hpp" -#include "util/format.hpp" - -#include - -using namespace realm; -using namespace realm::_impl; - -List::List() noexcept = default; -List::~List() = default; - -List::List(const List&) = default; -List& List::operator=(const List&) = default; -List::List(List&&) = default; -List& List::operator=(List&&) = default; - -List::List(std::shared_ptr r, LinkViewRef l) noexcept -: m_realm(std::move(r)) -, m_link_view(std::move(l)) -{ -} - -const ObjectSchema& List::get_object_schema() const -{ - verify_attached(); - - if (!m_object_schema) { - auto object_type = ObjectStore::object_type_for_table_name(m_link_view->get_target_table().get_name()); - auto it = m_realm->schema().find(object_type); - REALM_ASSERT(it != m_realm->schema().end()); - m_object_schema = &*it; - } - return *m_object_schema; -} - -Query List::get_query() const -{ - verify_attached(); - return m_link_view->get_target_table().where(m_link_view); -} - -size_t List::get_origin_row_index() const -{ - verify_attached(); - return m_link_view->get_origin_row_index(); -} - -void List::verify_valid_row(size_t row_ndx, bool insertion) const -{ - size_t size = m_link_view->size(); - if (row_ndx > size || (!insertion && row_ndx == size)) { - throw OutOfBoundsIndexException{row_ndx, size + insertion}; - } -} - -bool List::is_valid() const -{ - m_realm->verify_thread(); - return m_link_view && m_link_view->is_attached(); -} - -void List::verify_attached() const -{ - if (!is_valid()) { - throw InvalidatedException(); - } -} - -void List::verify_in_transaction() const -{ - verify_attached(); - if (!m_realm->is_in_transaction()) { - throw InvalidTransactionException("Must be in a write transaction"); - } -} - -size_t List::size() const -{ - verify_attached(); - return m_link_view->size(); -} - -RowExpr List::get(size_t row_ndx) const -{ - verify_attached(); - verify_valid_row(row_ndx); - return m_link_view->get(row_ndx); -} - -size_t List::get_unchecked(size_t row_ndx) const noexcept -{ - return m_link_view->get(row_ndx).get_index(); -} - -size_t List::find(ConstRow const& row) const -{ - verify_attached(); - - if (!row.is_attached() || row.get_table() != &m_link_view->get_target_table()) { - return not_found; - } - - return m_link_view->find(row.get_index()); -} - -void List::add(size_t target_row_ndx) -{ - verify_in_transaction(); - m_link_view->add(target_row_ndx); -} - -void List::insert(size_t row_ndx, size_t target_row_ndx) -{ - verify_in_transaction(); - verify_valid_row(row_ndx, true); - m_link_view->insert(row_ndx, target_row_ndx); -} - -void List::move(size_t source_ndx, size_t dest_ndx) -{ - verify_in_transaction(); - verify_valid_row(source_ndx); - verify_valid_row(dest_ndx); // Can't be one past end due to removing one earlier - m_link_view->move(source_ndx, dest_ndx); -} - -void List::remove(size_t row_ndx) -{ - verify_in_transaction(); - verify_valid_row(row_ndx); - m_link_view->remove(row_ndx); -} - -void List::remove_all() -{ - verify_in_transaction(); - m_link_view->clear(); -} - -void List::set(size_t row_ndx, size_t target_row_ndx) -{ - verify_in_transaction(); - verify_valid_row(row_ndx); - m_link_view->set(row_ndx, target_row_ndx); -} - -void List::swap(size_t ndx1, size_t ndx2) -{ - verify_in_transaction(); - verify_valid_row(ndx1); - verify_valid_row(ndx2); - m_link_view->swap(ndx1, ndx2); -} - -void List::delete_all() -{ - verify_in_transaction(); - m_link_view->remove_all_target_rows(); -} - -Results List::sort(SortDescriptor order) -{ - verify_attached(); - return Results(m_realm, m_link_view, util::none, std::move(order)); -} - -Results List::filter(Query q) -{ - verify_attached(); - return Results(m_realm, m_link_view, get_query().and_query(std::move(q))); -} - -Results List::snapshot() const -{ - verify_attached(); - return Results(m_realm, m_link_view).snapshot(); -} - -// These definitions rely on that LinkViews are interned by core -bool List::operator==(List const& rgt) const noexcept -{ - return m_link_view.get() == rgt.m_link_view.get(); -} - -namespace std { -size_t hash::operator()(realm::List const& list) const -{ - return std::hash()(list.m_link_view.get()); -} -} - -NotificationToken List::add_notification_callback(CollectionChangeCallback cb) & -{ - verify_attached(); - if (!m_notifier) { - m_notifier = std::make_shared(m_link_view, m_realm); - RealmCoordinator::register_notifier(m_notifier); - } - return {m_notifier, m_notifier->add_callback(std::move(cb))}; -} - -List::OutOfBoundsIndexException::OutOfBoundsIndexException(size_t r, size_t c) -: std::out_of_range(util::format("Requested index %1 greater than max %2", r, c)) -, requested(r), valid_count(c) {} diff --git a/Pods/Realm/Realm/ObjectStore/src/object.cpp b/Pods/Realm/Realm/ObjectStore/src/object.cpp deleted file mode 100644 index 6d80ea1c..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/object.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2017 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "object.hpp" - -#include "impl/object_notifier.hpp" -#include "impl/realm_coordinator.hpp" - -using namespace realm; - -Object::Object(SharedRealm r, ObjectSchema const& s, BasicRowExpr const& o) -: m_realm(std::move(r)), m_object_schema(&s), m_row(o) { } - -Object::Object(SharedRealm r, ObjectSchema const& s, Row const& o) -: m_realm(std::move(r)), m_object_schema(&s), m_row(o) { } - -Object::Object() = default; -Object::~Object() = default; -Object::Object(Object const&) = default; -Object::Object(Object&&) = default; -Object& Object::operator=(Object const&) = default; -Object& Object::operator=(Object&&) = default; - -NotificationToken Object::add_notification_block(CollectionChangeCallback callback) & -{ - if (!m_notifier) - m_notifier = std::make_shared<_impl::ObjectNotifier>(m_row, m_realm); - _impl::RealmCoordinator::register_notifier(m_notifier); - return {m_notifier, m_notifier->add_callback(std::move(callback))}; -} diff --git a/Pods/Realm/Realm/ObjectStore/src/object_schema.cpp b/Pods/Realm/Realm/ObjectStore/src/object_schema.cpp deleted file mode 100644 index 269dd5b1..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/object_schema.cpp +++ /dev/null @@ -1,227 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "object_schema.hpp" - -#include "object_store.hpp" -#include "property.hpp" -#include "schema.hpp" - -#include "util/format.hpp" - -#include -#include -#include - -using namespace realm; - -#define ASSERT_PROPERTY_TYPE_VALUE(property, type) \ - static_assert(static_cast(PropertyType::property) == type_##type, \ - "PropertyType and DataType must have the same values") - -ASSERT_PROPERTY_TYPE_VALUE(Int, Int); -ASSERT_PROPERTY_TYPE_VALUE(Bool, Bool); -ASSERT_PROPERTY_TYPE_VALUE(Float, Float); -ASSERT_PROPERTY_TYPE_VALUE(Double, Double); -ASSERT_PROPERTY_TYPE_VALUE(Data, Binary); -ASSERT_PROPERTY_TYPE_VALUE(Date, Timestamp); -ASSERT_PROPERTY_TYPE_VALUE(Any, Mixed); -ASSERT_PROPERTY_TYPE_VALUE(Object, Link); -ASSERT_PROPERTY_TYPE_VALUE(Array, LinkList); - -ObjectSchema::ObjectSchema() = default; -ObjectSchema::~ObjectSchema() = default; - -ObjectSchema::ObjectSchema(std::string name, std::initializer_list persisted_properties) -: name(std::move(name)) -, persisted_properties(persisted_properties) -{ - for (auto const& prop : persisted_properties) { - if (prop.is_primary) { - primary_key = prop.name; - } - } -} - -ObjectSchema::ObjectSchema(Group const& group, StringData name, size_t index) : name(name) { - ConstTableRef table; - if (index < group.size()) { - table = group.get_table(index); - } - else { - table = ObjectStore::table_for_object_type(group, name); - } - - size_t count = table->get_column_count(); - persisted_properties.reserve(count); - for (size_t col = 0; col < count; col++) { - Property property; - property.name = table->get_column_name(col).data(); - property.type = (PropertyType)table->get_column_type(col); - property.is_indexed = table->has_search_index(col); - property.is_nullable = table->is_nullable(col) || property.type == PropertyType::Object; - property.table_column = col; - if (property.type == PropertyType::Object || property.type == PropertyType::Array) { - // set link type for objects and arrays - ConstTableRef linkTable = table->get_link_target(col); - property.object_type = ObjectStore::object_type_for_table_name(linkTable->get_name().data()); - } - persisted_properties.push_back(std::move(property)); - } - - primary_key = realm::ObjectStore::get_primary_key_for_object(group, name); - set_primary_key_property(); -} - -Property *ObjectSchema::property_for_name(StringData name) { - for (auto& prop : persisted_properties) { - if (StringData(prop.name) == name) { - return ∝ - } - } - for (auto& prop : computed_properties) { - if (StringData(prop.name) == name) { - return ∝ - } - } - return nullptr; -} - -const Property *ObjectSchema::property_for_name(StringData name) const { - return const_cast(this)->property_for_name(name); -} - -bool ObjectSchema::property_is_computed(Property const& property) const { - auto end = computed_properties.end(); - return std::find(computed_properties.begin(), end, property) != end; -} - -void ObjectSchema::set_primary_key_property() -{ - if (primary_key.length()) { - if (auto primary_key_prop = primary_key_property()) { - primary_key_prop->is_primary = true; - } - } -} - -static void validate_property(Schema const& schema, - std::string const& object_name, - Property const& prop, - Property const** primary, - std::vector& exceptions) -{ - // check nullablity - if (prop.is_nullable && !prop.type_is_nullable()) { - exceptions.emplace_back("Property '%1.%2' of type '%3' cannot be nullable.", - object_name, prop.name, string_for_property_type(prop.type)); - } - else if (prop.type == PropertyType::Object && !prop.is_nullable) { - exceptions.emplace_back("Property '%1.%2' of type 'Object' must be nullable.", object_name, prop.name); - } - - // check primary keys - if (prop.is_primary) { - if (!prop.is_indexable()) { - exceptions.emplace_back("Property '%1.%2' of type '%3' cannot be made the primary key.", - object_name, prop.name, string_for_property_type(prop.type)); - } - if (*primary) { - exceptions.emplace_back("Properties'%1' and '%2' are both marked as the primary key of '%3'.", - prop.name, (*primary)->name, object_name); - } - *primary = ∝ - } - - // check indexable - if (prop.is_indexed && !prop.is_indexable()) { - exceptions.emplace_back("Property '%1.%2' of type '%3' cannot be indexed.", - object_name, prop.name, string_for_property_type(prop.type)); - } - - // check that only link properties have object types - if (prop.type != PropertyType::LinkingObjects && !prop.link_origin_property_name.empty()) { - exceptions.emplace_back("Property '%1.%2' of type '%3' cannot have an origin property name.", - object_name, prop.name, string_for_property_type(prop.type)); - } - else if (prop.type == PropertyType::LinkingObjects && prop.link_origin_property_name.empty()) { - exceptions.emplace_back("Property '%1.%2' of type '%3' must have an origin property name.", - object_name, prop.name, string_for_property_type(prop.type)); - } - - if (prop.type != PropertyType::Object && prop.type != PropertyType::Array && prop.type != PropertyType::LinkingObjects) { - if (!prop.object_type.empty()) { - exceptions.emplace_back("Property '%1.%2' of type '%3' cannot have an object type.", - object_name, prop.name, string_for_property_type(prop.type)); - } - return; - } - - - // check that the object_type is valid for link properties - auto it = schema.find(prop.object_type); - if (it == schema.end()) { - exceptions.emplace_back("Property '%1.%2' of type '%3' has unknown object type '%4'", - object_name, prop.name, string_for_property_type(prop.type), prop.object_type); - return; - } - if (prop.type != PropertyType::LinkingObjects) { - return; - } - - const Property *origin_property = it->property_for_name(prop.link_origin_property_name); - if (!origin_property) { - exceptions.emplace_back("Property '%1.%2' declared as origin of linking objects property '%3.%4' does not exist", - prop.object_type, prop.link_origin_property_name, - object_name, prop.name); - } - else if (origin_property->type != PropertyType::Object && origin_property->type != PropertyType::Array) { - exceptions.emplace_back("Property '%1.%2' declared as origin of linking objects property '%3.%4' is not a link", - prop.object_type, prop.link_origin_property_name, - object_name, prop.name); - } - else if (origin_property->object_type != object_name) { - exceptions.emplace_back("Property '%1.%2' declared as origin of linking objects property '%3.%4' links to type '%5'", - prop.object_type, prop.link_origin_property_name, - object_name, prop.name, origin_property->object_type); - } -} - -void ObjectSchema::validate(Schema const& schema, std::vector& exceptions) const -{ - const Property *primary = nullptr; - for (auto const& prop : persisted_properties) { - validate_property(schema, name, prop, &primary, exceptions); - } - for (auto const& prop : computed_properties) { - validate_property(schema, name, prop, &primary, exceptions); - } - - if (!primary_key.empty() && !primary && !primary_key_property()) { - exceptions.emplace_back("Specified primary key '%1.%2' does not exist.", name, primary_key); - } -} - -namespace realm { -bool operator==(ObjectSchema const& a, ObjectSchema const& b) -{ - return std::tie(a.name, a.primary_key, a.persisted_properties, a.computed_properties) - == std::tie(b.name, b.primary_key, b.persisted_properties, b.computed_properties); - -} -} diff --git a/Pods/Realm/Realm/ObjectStore/src/object_store.cpp b/Pods/Realm/Realm/ObjectStore/src/object_store.cpp deleted file mode 100644 index 8d489eca..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/object_store.cpp +++ /dev/null @@ -1,824 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "object_store.hpp" - -#include "object_schema.hpp" -#include "schema.hpp" -#include "shared_realm.hpp" -#include "util/format.hpp" - -#include -#include -#include -#include - -#include - -using namespace realm; - -const uint64_t ObjectStore::NotVersioned = std::numeric_limits::max(); - -namespace { -const char * const c_metadataTableName = "metadata"; -const char * const c_versionColumnName = "version"; -const size_t c_versionColumnIndex = 0; - -const char * const c_primaryKeyTableName = "pk"; -const char * const c_primaryKeyObjectClassColumnName = "pk_table"; -const size_t c_primaryKeyObjectClassColumnIndex = 0; -const char * const c_primaryKeyPropertyNameColumnName = "pk_property"; -const size_t c_primaryKeyPropertyNameColumnIndex = 1; - -const size_t c_zeroRowIndex = 0; - -const char c_object_table_prefix[] = "class_"; - -void create_metadata_tables(Group& group) { - // FIXME: the order of the creation of the two tables seems to - // matter for some Android devices. The reason is unclear, and - // further investigation is required. - // See https://github.com/realm/realm-java/issues/3651 - - TableRef table = group.get_or_add_table(c_metadataTableName); - if (table->get_column_count() == 0) { - table->add_column(type_Int, c_versionColumnName); - - // set initial version - table->add_empty_row(); - table->set_int(c_versionColumnIndex, c_zeroRowIndex, ObjectStore::NotVersioned); - } - - table = group.get_or_add_table(c_primaryKeyTableName); - if (table->get_column_count() == 0) { - table->add_column(type_String, c_primaryKeyObjectClassColumnName); - table->add_column(type_String, c_primaryKeyPropertyNameColumnName); - } - table->add_search_index(table->get_column_index(c_primaryKeyObjectClassColumnName)); -} - -void set_schema_version(Group& group, uint64_t version) { - TableRef table = group.get_or_add_table(c_metadataTableName); - table->set_int(c_versionColumnIndex, c_zeroRowIndex, version); -} - -template -auto table_for_object_schema(Group& group, ObjectSchema const& object_schema) -{ - return ObjectStore::table_for_object_type(group, object_schema.name); -} - -void add_index(Table& table, size_t col) -{ - try { - table.add_search_index(col); - } - catch (LogicError const&) { - throw std::logic_error(util::format("Cannot index property '%1.%2': indexing properties of type '%3' is not yet implemented.", - ObjectStore::object_type_for_table_name(table.get_name()), - table.get_column_name(col), - string_for_property_type((PropertyType)table.get_column_type(col)))); - } -} - -void insert_column(Group& group, Table& table, Property const& property, size_t col_ndx) -{ - // Cannot directly insert a LinkingObjects column (a computed property). - // LinkingObjects must be an artifact of an existing link column. - REALM_ASSERT(property.type != PropertyType::LinkingObjects); - - if (property.type == PropertyType::Object || property.type == PropertyType::Array) { - auto target_name = ObjectStore::table_name_for_object_type(property.object_type); - TableRef link_table = group.get_or_add_table(target_name); - table.insert_column_link(col_ndx, DataType(property.type), property.name, *link_table); - } - else { - table.insert_column(col_ndx, DataType(property.type), property.name, property.is_nullable); - if (property.requires_index()) - add_index(table, col_ndx); - } -} - -void add_column(Group& group, Table& table, Property const& property) -{ - insert_column(group, table, property, table.get_column_count()); -} - -void replace_column(Group& group, Table& table, Property const& old_property, Property const& new_property) -{ - insert_column(group, table, new_property, old_property.table_column); - table.remove_column(old_property.table_column + 1); -} - -TableRef create_table(Group& group, ObjectSchema const& object_schema) -{ - auto name = ObjectStore::table_name_for_object_type(object_schema.name); - auto table = group.get_or_add_table(name); - if (table->get_column_count() > 0) { - return table; - } - - for (auto const& prop : object_schema.persisted_properties) { - add_column(group, *table, prop); - } - - ObjectStore::set_primary_key_for_object(group, object_schema.name, object_schema.primary_key); - - return table; -} - -void copy_property_values(Property const& prop, Table& table) -{ - auto copy_property_values = [&](auto getter, auto setter) { - for (size_t i = 0, count = table.size(); i < count; i++) { - bool is_default = false; - (table.*setter)(prop.table_column, i, (table.*getter)(prop.table_column + 1, i), - is_default); - } - }; - - switch (prop.type) { - case PropertyType::Int: - copy_property_values(&Table::get_int, &Table::set_int); - break; - case PropertyType::Bool: - copy_property_values(&Table::get_bool, &Table::set_bool); - break; - case PropertyType::Float: - copy_property_values(&Table::get_float, &Table::set_float); - break; - case PropertyType::Double: - copy_property_values(&Table::get_double, &Table::set_double); - break; - case PropertyType::String: - copy_property_values(&Table::get_string, &Table::set_string); - break; - case PropertyType::Data: - copy_property_values(&Table::get_binary, &Table::set_binary); - break; - case PropertyType::Date: - copy_property_values(&Table::get_timestamp, &Table::set_timestamp); - break; - default: - break; - } -} - -void make_property_optional(Group& group, Table& table, Property property) -{ - property.is_nullable = true; - insert_column(group, table, property, property.table_column); - copy_property_values(property, table); - table.remove_column(property.table_column + 1); -} - -void make_property_required(Group& group, Table& table, Property property) -{ - property.is_nullable = false; - insert_column(group, table, property, property.table_column); - table.remove_column(property.table_column + 1); -} - -void validate_primary_column_uniqueness(Group const& group, StringData object_type, StringData primary_property) -{ - auto table = ObjectStore::table_for_object_type(group, object_type); - if (table->get_distinct_view(table->get_column_index(primary_property)).size() != table->size()) { - throw DuplicatePrimaryKeyValueException(object_type, primary_property); - } -} - -void validate_primary_column_uniqueness(Group const& group) -{ - auto pk_table = group.get_table(c_primaryKeyTableName); - for (size_t i = 0, count = pk_table->size(); i < count; ++i) { - validate_primary_column_uniqueness(group, - pk_table->get_string(c_primaryKeyObjectClassColumnIndex, i), - pk_table->get_string(c_primaryKeyPropertyNameColumnIndex, i)); - } -} -} // anonymous namespace - -// FIXME remove this after integrating OS's migration related logic into Realm java -void ObjectStore::set_schema_version(Group& group, uint64_t version) { - ::create_metadata_tables(group); - ::set_schema_version(group, version); -} - -uint64_t ObjectStore::get_schema_version(Group const& group) { - ConstTableRef table = group.get_table(c_metadataTableName); - if (!table || table->get_column_count() == 0) { - return ObjectStore::NotVersioned; - } - return table->get_int(c_versionColumnIndex, c_zeroRowIndex); -} - -StringData ObjectStore::get_primary_key_for_object(Group const& group, StringData object_type) { - ConstTableRef table = group.get_table(c_primaryKeyTableName); - if (!table) { - return ""; - } - size_t row = table->find_first_string(c_primaryKeyObjectClassColumnIndex, object_type); - if (row == not_found) { - return ""; - } - return table->get_string(c_primaryKeyPropertyNameColumnIndex, row); -} - -void ObjectStore::set_primary_key_for_object(Group& group, StringData object_type, StringData primary_key) { - TableRef table = group.get_table(c_primaryKeyTableName); - - // get row or create if new object and populate - size_t row = table->find_first_string(c_primaryKeyObjectClassColumnIndex, object_type); - if (row == not_found && primary_key.size()) { - row = table->add_empty_row(); - row = table->set_string_unique(c_primaryKeyObjectClassColumnIndex, row, object_type); - } - - // set if changing, or remove if setting to nil - if (primary_key.size() == 0) { - if (row != not_found) { - table->move_last_over(row); - } - } - else { - table->set_string(c_primaryKeyPropertyNameColumnIndex, row, primary_key); - } -} - -StringData ObjectStore::object_type_for_table_name(StringData table_name) { - if (table_name.begins_with(c_object_table_prefix)) { - return table_name.substr(sizeof(c_object_table_prefix) - 1); - } - return StringData(); -} - -std::string ObjectStore::table_name_for_object_type(StringData object_type) { - return std::string(c_object_table_prefix) + std::string(object_type); -} - -TableRef ObjectStore::table_for_object_type(Group& group, StringData object_type) { - auto name = table_name_for_object_type(object_type); - return group.get_table(name); -} - -ConstTableRef ObjectStore::table_for_object_type(Group const& group, StringData object_type) { - auto name = table_name_for_object_type(object_type); - return group.get_table(name); -} - -namespace { -struct SchemaDifferenceExplainer { - std::vector errors; - - void operator()(schema_change::AddTable op) - { - errors.emplace_back("Class '%1' has been added.", op.object->name); - } - - void operator()(schema_change::AddProperty op) - { - errors.emplace_back("Property '%1.%2' has been added.", op.object->name, op.property->name); - } - - void operator()(schema_change::RemoveProperty op) - { - errors.emplace_back("Property '%1.%2' has been removed.", op.object->name, op.property->name); - } - - void operator()(schema_change::ChangePropertyType op) - { - errors.emplace_back("Property '%1.%2' has been changed from '%3' to '%4'.", - op.object->name, op.new_property->name, - string_for_property_type(op.old_property->type), - string_for_property_type(op.new_property->type)); - } - - void operator()(schema_change::MakePropertyNullable op) - { - errors.emplace_back("Property '%1.%2' has been made optional.", op.object->name, op.property->name); - } - - void operator()(schema_change::MakePropertyRequired op) - { - errors.emplace_back("Property '%1.%2' has been made required.", op.object->name, op.property->name); - } - - void operator()(schema_change::ChangePrimaryKey op) - { - if (op.property && !op.object->primary_key.empty()) { - errors.emplace_back("Primary Key for class '%1 has changed from '%2' to '%3'.", - op.object->name, op.object->primary_key, op.property->name); - } - else if (op.property) { - errors.emplace_back("Primary Key for class '%1 has been added.", op.object->name); - } - else { - errors.emplace_back("Primary Key for class '%1 has been removed.", op.object->name); - } - } - - void operator()(schema_change::AddIndex op) - { - errors.emplace_back("Property '%1.%2' has been made indexed.", op.object->name, op.property->name); - } - - void operator()(schema_change::RemoveIndex op) - { - errors.emplace_back("Property '%1.%2' has been made unindexed.", op.object->name, op.property->name); - } -}; - -class TableHelper { -public: - TableHelper(Group& g) : m_group(g) { } - - Table& operator()(const ObjectSchema* object_schema) - { - if (object_schema != m_current_object_schema) { - m_current_table = table_for_object_schema(m_group, *object_schema); - m_current_object_schema = object_schema; - } - REALM_ASSERT(m_current_table); - return *m_current_table; - } - -private: - Group& m_group; - const ObjectSchema* m_current_object_schema = nullptr; - TableRef m_current_table; -}; - -template -void verify_no_errors(Verifier&& verifier, std::vector const& changes) -{ - for (auto& change : changes) { - change.visit(verifier); - } - - if (!verifier.errors.empty()) { - throw ErrorType(verifier.errors); - } -} -} // anonymous namespace - -bool ObjectStore::needs_migration(std::vector const& changes) -{ - using namespace schema_change; - struct Visitor { - bool operator()(AddIndex) { return false; } - bool operator()(AddProperty) { return true; } - bool operator()(AddTable) { return false; } - bool operator()(ChangePrimaryKey) { return true; } - bool operator()(ChangePropertyType) { return true; } - bool operator()(MakePropertyNullable) { return true; } - bool operator()(MakePropertyRequired) { return true; } - bool operator()(RemoveIndex) { return false; } - bool operator()(RemoveProperty) { return true; } - }; - - return std::any_of(begin(changes), end(changes), - [](auto&& change) { return change.visit(Visitor()); }); -} - -void ObjectStore::verify_no_changes_required(std::vector const& changes) -{ - verify_no_errors(SchemaDifferenceExplainer(), changes); -} - -void ObjectStore::verify_no_migration_required(std::vector const& changes) -{ - using namespace schema_change; - struct Verifier : SchemaDifferenceExplainer { - using SchemaDifferenceExplainer::operator(); - - // Adding a table or adding/removing indexes can be done automatically. - // All other changes require migrations. - void operator()(AddTable) { } - void operator()(AddIndex) { } - void operator()(RemoveIndex) { } - } verifier; - verify_no_errors(verifier, changes); -} - -void ObjectStore::verify_valid_additive_changes(std::vector const& changes) -{ - using namespace schema_change; - struct Verifier : SchemaDifferenceExplainer { - using SchemaDifferenceExplainer::operator(); - - // Additive mode allows adding things, extra columns, and adding/removing indexes - void operator()(AddTable) { } - void operator()(AddProperty) { } - void operator()(RemoveProperty) { } - void operator()(AddIndex) { } - void operator()(RemoveIndex) { } - } verifier; - verify_no_errors(verifier, changes); -} - -static void apply_non_migration_changes(Group& group, std::vector const& changes) -{ - using namespace schema_change; - struct Applier : SchemaDifferenceExplainer { - Applier(Group& group) : group{group}, table{group} { } - Group& group; - TableHelper table; - - // Produce an exception listing the unsupported schema changes for - // everything but the explicitly supported ones - using SchemaDifferenceExplainer::operator(); - - void operator()(AddTable op) { create_table(group, *op.object); } - void operator()(AddIndex op) { add_index(table(op.object), op.property->table_column); } - void operator()(RemoveIndex op) { table(op.object).remove_search_index(op.property->table_column); } - } applier{group}; - verify_no_errors(applier, changes); -} - -static void create_initial_tables(Group& group, std::vector const& changes) -{ - using namespace schema_change; - struct Applier { - Applier(Group& group) : group{group}, table{group} { } - Group& group; - TableHelper table; - - void operator()(AddTable op) { create_table(group, *op.object); } - - // Note that in normal operation none of these will be hit, as if we're - // creating the initial tables there shouldn't be anything to update. - // Implementing these makes us better able to handle weird - // not-quite-correct files produced by other things and has no obvious - // downside. - void operator()(AddProperty op) { add_column(group, table(op.object), *op.property); } - void operator()(RemoveProperty op) { table(op.object).remove_column(op.property->table_column); } - void operator()(MakePropertyNullable op) { make_property_optional(group, table(op.object), *op.property); } - void operator()(MakePropertyRequired op) { make_property_required(group, table(op.object), *op.property); } - void operator()(ChangePrimaryKey op) { ObjectStore::set_primary_key_for_object(group, op.object->name, op.property ? StringData{op.property->name} : ""); } - void operator()(AddIndex op) { add_index(table(op.object), op.property->table_column); } - void operator()(RemoveIndex op) { table(op.object).remove_search_index(op.property->table_column); } - - void operator()(ChangePropertyType op) - { - replace_column(group, table(op.object), *op.old_property, *op.new_property); - } - } applier{group}; - - for (auto& change : changes) { - change.visit(applier); - } -} - -static void apply_additive_changes(Group& group, std::vector const& changes, bool update_indexes) -{ - using namespace schema_change; - struct Applier { - Applier(Group& group, bool update_indexes) : group{group}, table{group}, update_indexes{update_indexes} { } - Group& group; - TableHelper table; - bool update_indexes; - - void operator()(AddTable op) { create_table(group, *op.object); } - void operator()(AddProperty op) { add_column(group, table(op.object), *op.property); } - void operator()(AddIndex op) { if (update_indexes) add_index(table(op.object), op.property->table_column); } - void operator()(RemoveIndex op) { if (update_indexes) table(op.object).remove_search_index(op.property->table_column); } - void operator()(RemoveProperty) { } - - // No need for errors for these, as we've already verified that they aren't present - void operator()(ChangePrimaryKey) { } - void operator()(ChangePropertyType) { } - void operator()(MakePropertyNullable) { } - void operator()(MakePropertyRequired) { } - } applier{group, update_indexes}; - - for (auto& change : changes) { - change.visit(applier); - } -} - -static void apply_pre_migration_changes(Group& group, std::vector const& changes) -{ - using namespace schema_change; - struct Applier { - Applier(Group& group) : group{group}, table{group} { } - Group& group; - TableHelper table; - - void operator()(AddTable op) { create_table(group, *op.object); } - void operator()(AddProperty op) { add_column(group, table(op.object), *op.property); } - void operator()(RemoveProperty) { /* delayed until after the migration */ } - void operator()(ChangePropertyType op) { replace_column(group, table(op.object), *op.old_property, *op.new_property); } - void operator()(MakePropertyNullable op) { make_property_optional(group, table(op.object), *op.property); } - void operator()(MakePropertyRequired op) { make_property_required(group, table(op.object), *op.property); } - void operator()(ChangePrimaryKey op) { ObjectStore::set_primary_key_for_object(group, op.object->name, op.property ? op.property->name : ""); } - void operator()(AddIndex op) { add_index(table(op.object), op.property->table_column); } - void operator()(RemoveIndex op) { table(op.object).remove_search_index(op.property->table_column); } - } applier{group}; - - for (auto& change : changes) { - change.visit(applier); - } -} - -static void apply_post_migration_changes(Group& group, std::vector const& changes, Schema const& initial_schema) -{ - using namespace schema_change; - struct Applier { - Applier(Group& group, Schema const& initial_schema) : group{group}, initial_schema(initial_schema), table(group) { } - Group& group; - Schema const& initial_schema; - TableHelper table; - - void operator()(RemoveProperty op) - { - if (!initial_schema.empty() && !initial_schema.find(op.object->name)->property_for_name(op.property->name)) - throw std::logic_error(util::format("Renamed property '%1.%2' does not exist.", op.object->name, op.property->name)); - auto table = table_for_object_schema(group, *op.object); - table->remove_column(op.property->table_column); - } - - void operator()(ChangePrimaryKey op) - { - if (op.property) { - validate_primary_column_uniqueness(group, op.object->name, op.property->name); - } - } - - void operator()(AddTable op) { create_table(group, *op.object); } - void operator()(AddIndex op) { add_index(table(op.object), op.property->table_column); } - void operator()(RemoveIndex op) { table(op.object).remove_search_index(op.property->table_column); } - - void operator()(ChangePropertyType) { } - void operator()(MakePropertyNullable) { } - void operator()(MakePropertyRequired) { } - void operator()(AddProperty) { } - } applier{group, initial_schema}; - - for (auto& change : changes) { - change.visit(applier); - } -} - -void ObjectStore::apply_schema_changes(Group& group, Schema& schema, uint64_t& schema_version, - Schema const& target_schema, uint64_t target_schema_version, - SchemaMode mode, std::vector const& changes, - std::function migration_function) -{ - create_metadata_tables(group); - - if (schema_version == ObjectStore::NotVersioned) { - create_initial_tables(group, changes); - set_schema_version(group, target_schema_version); - schema_version = target_schema_version; - schema = target_schema; - set_schema_columns(group, schema); - return; - } - - if (mode == SchemaMode::Additive) { - apply_additive_changes(group, changes, schema_version < target_schema_version); - - if (schema_version < target_schema_version) { - schema_version = target_schema_version; - set_schema_version(group, target_schema_version); - } - - schema = target_schema; - set_schema_columns(group, schema); - return; - } - - if (mode == SchemaMode::Manual) { - // Have to update the schema on the Realm before calling the migration - // function as the migration will need it - auto old_version = schema_version; - auto old_schema = schema; - schema_version = target_schema_version; - schema = target_schema; - set_schema_columns(group, schema); - - try { - migration_function(); - verify_no_changes_required(schema_from_group(group).compare(schema)); - validate_primary_column_uniqueness(group); - } - catch (...) { - schema = move(old_schema); - schema_version = old_version; - throw; - } - - set_schema_columns(group, schema); - set_schema_version(group, target_schema_version); - return; - } - - if (schema_version == target_schema_version) { - apply_non_migration_changes(group, changes); - schema = target_schema; - set_schema_columns(group, schema); - return; - } - - apply_pre_migration_changes(group, changes); - if (migration_function) { - // Have to update the schema on the Realm before calling the migration - // function as the migration will need it - auto old_version = schema_version; - auto old_schema = schema; - schema_version = target_schema_version; - schema = target_schema; - set_schema_columns(group, schema); - - try { - migration_function(); - - // Migration function may have changed the schema, so we need to re-read it - schema = schema_from_group(group); - apply_post_migration_changes(group, schema.compare(target_schema), old_schema); - validate_primary_column_uniqueness(group); - } - catch (...) { - schema = move(old_schema); - schema_version = old_version; - throw; - } - } - else { - apply_post_migration_changes(group, changes, {}); - } - - set_schema_version(group, target_schema_version); - schema_version = target_schema_version; - schema = target_schema; - set_schema_columns(group, schema); -} - -Schema ObjectStore::schema_from_group(Group const& group) { - std::vector schema; - schema.reserve(group.size()); - for (size_t i = 0; i < group.size(); i++) { - auto object_type = object_type_for_table_name(group.get_table_name(i)); - if (object_type.size()) { - schema.emplace_back(group, object_type, i); - } - } - return schema; -} - -void ObjectStore::set_schema_columns(Group const& group, Schema& schema) -{ - for (auto& object_schema : schema) { - auto table = table_for_object_schema(group, object_schema); - if (!table) { - continue; - } - for (auto& property : object_schema.persisted_properties) { - property.table_column = table->get_column_index(property.name); - } - } -} - -void ObjectStore::delete_data_for_object(Group& group, StringData object_type) { - if (TableRef table = table_for_object_type(group, object_type)) { - group.remove_table(table->get_index_in_group()); - ObjectStore::set_primary_key_for_object(group, object_type, ""); - } -} - -bool ObjectStore::is_empty(Group const& group) { - for (size_t i = 0; i < group.size(); i++) { - ConstTableRef table = group.get_table(i); - std::string object_type = object_type_for_table_name(table->get_name()); - if (!object_type.length()) { - continue; - } - if (!table->is_empty()) { - return false; - } - } - return true; -} - -void ObjectStore::rename_property(Group& group, Schema& target_schema, StringData object_type, StringData old_name, StringData new_name) -{ - TableRef table = table_for_object_type(group, object_type); - if (!table) { - throw std::logic_error(util::format("Cannot rename properties for type '%1' because it does not exist.", object_type)); - } - - auto target_object_schema = target_schema.find(object_type); - if (target_object_schema == target_schema.end()) { - throw std::logic_error(util::format("Cannot rename properties for type '%1' because it has been removed from the Realm.", object_type)); - } - - if (target_object_schema->property_for_name(old_name)) { - throw std::logic_error(util::format("Cannot rename property '%1.%2' to '%3' because the source property still exists.", - object_type, old_name, new_name)); - } - - ObjectSchema table_object_schema(group, object_type); - Property *old_property = table_object_schema.property_for_name(old_name); - if (!old_property) { - throw std::logic_error(util::format("Cannot rename property '%1.%2' because it does not exist.", object_type, old_name)); - } - - Property *new_property = table_object_schema.property_for_name(new_name); - if (!new_property) { - // New property doesn't exist in the table, which means we're probably - // renaming to an intermediate property in a multi-version migration. - // This is safe because the migration will fail schema validation unless - // this property is renamed again to a valid name before the end. - table->rename_column(old_property->table_column, new_name); - return; - } - - if (old_property->type != new_property->type || old_property->object_type != new_property->object_type) { - throw std::logic_error(util::format("Cannot rename property '%1.%2' to '%3' because it would change from type '%4' to '%5'.", - object_type, old_name, new_name, old_property->type_string(), new_property->type_string())); - } - - if (old_property->is_nullable && !new_property->is_nullable) { - throw std::logic_error(util::format("Cannot rename property '%1.%2' to '%3' because it would change from optional to required.", - object_type, old_name, new_name)); - } - - size_t column_to_remove = new_property->table_column; - table->rename_column(old_property->table_column, new_name); - table->remove_column(column_to_remove); - - // update table_column for each property since it may have shifted - for (auto& current_prop : target_object_schema->persisted_properties) { - if (current_prop.table_column == column_to_remove) - current_prop.table_column = old_property->table_column; - else if (current_prop.table_column > column_to_remove) - --current_prop.table_column; - } - - // update nullability for column - if (new_property->is_nullable && !old_property->is_nullable) { - auto prop = *new_property; - prop.table_column = old_property->table_column; - make_property_optional(group, *table, prop); - } -} - -InvalidSchemaVersionException::InvalidSchemaVersionException(uint64_t old_version, uint64_t new_version) -: logic_error(util::format("Provided schema version %1 is less than last set version %2.", new_version, old_version)) -, m_old_version(old_version), m_new_version(new_version) -{ -} - -DuplicatePrimaryKeyValueException::DuplicatePrimaryKeyValueException(std::string object_type, std::string property) -: logic_error(util::format("Primary key property '%1.%2' has duplicate values after migration.", object_type, property)) -, m_object_type(object_type), m_property(property) -{ -} - -SchemaValidationException::SchemaValidationException(std::vector const& errors) -: std::logic_error([&] { - std::string message = "Schema validation failed due to the following errors:"; - for (auto const& error : errors) { - message += std::string("\n- ") + error.what(); - } - return message; -}()) -{ -} - -SchemaMismatchException::SchemaMismatchException(std::vector const& errors) -: std::logic_error([&] { - std::string message = "Migration is required due to the following errors:"; - for (auto const& error : errors) { - message += std::string("\n- ") + error.what(); - } - return message; -}()) -{ -} - -InvalidSchemaChangeException::InvalidSchemaChangeException(std::vector const& errors) -: std::logic_error([&] { - std::string message = "The following changes cannot be made in additive-only schema mode:"; - for (auto const& error : errors) { - message += std::string("\n- ") + error.what(); - } - return message; -}()) -{ -} diff --git a/Pods/Realm/Realm/ObjectStore/src/placeholder.cpp b/Pods/Realm/Realm/ObjectStore/src/placeholder.cpp deleted file mode 100644 index 89365342..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/placeholder.cpp +++ /dev/null @@ -1 +0,0 @@ -// This file is intentionally left blank. diff --git a/Pods/Realm/Realm/ObjectStore/src/results.cpp b/Pods/Realm/Realm/ObjectStore/src/results.cpp deleted file mode 100644 index 0f966421..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/results.cpp +++ /dev/null @@ -1,626 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "results.hpp" - -#include "impl/realm_coordinator.hpp" -#include "impl/results_notifier.hpp" -#include "object_schema.hpp" -#include "object_store.hpp" -#include "schema.hpp" -#include "util/compiler.hpp" -#include "util/format.hpp" - -#include - -using namespace realm; - -Results::Results() = default; -Results::~Results() = default; - -Results::Results(SharedRealm r, Query q, SortDescriptor s, SortDescriptor d) -: m_realm(std::move(r)) -, m_query(std::move(q)) -, m_table(m_query.get_table().get()) -, m_sort(std::move(s)) -, m_distinct(std::move(d)) -, m_mode(Mode::Query) -{ -} - -Results::Results(SharedRealm r, Table& table) -: m_realm(std::move(r)) -, m_table(&table) -, m_mode(Mode::Table) -{ -} - -Results::Results(SharedRealm r, LinkViewRef lv, util::Optional q, SortDescriptor s) -: m_realm(std::move(r)) -, m_link_view(lv) -, m_table(&lv->get_target_table()) -, m_sort(std::move(s)) -, m_mode(Mode::LinkView) -{ - if (q) { - m_query = std::move(*q); - m_mode = Mode::Query; - } -} - -Results::Results(SharedRealm r, TableView tv, SortDescriptor s, SortDescriptor d) -: m_realm(std::move(r)) -, m_table_view(std::move(tv)) -, m_table(&m_table_view.get_parent()) -, m_sort(std::move(s)) -, m_distinct(std::move(d)) -, m_mode(Mode::TableView) -{ -} - -Results::Results(const Results&) = default; -Results& Results::operator=(const Results&) = default; - -Results::Results(Results&& other) -: m_realm(std::move(other.m_realm)) -, m_object_schema(std::move(other.m_object_schema)) -, m_query(std::move(other.m_query)) -, m_table_view(std::move(other.m_table_view)) -, m_link_view(std::move(other.m_link_view)) -, m_table(other.m_table) -, m_sort(std::move(other.m_sort)) -, m_distinct(std::move(other.m_distinct)) -, m_notifier(std::move(other.m_notifier)) -, m_mode(other.m_mode) -, m_update_policy(other.m_update_policy) -, m_has_used_table_view(other.m_has_used_table_view) -, m_wants_background_updates(other.m_wants_background_updates) -{ - if (m_notifier) { - m_notifier->target_results_moved(other, *this); - } -} - -Results& Results::operator=(Results&& other) -{ - this->~Results(); - new (this) Results(std::move(other)); - return *this; -} - -bool Results::is_valid() const -{ - if (m_realm) - m_realm->verify_thread(); - - if (m_table && !m_table->is_attached()) - return false; - - return true; -} - -void Results::validate_read() const -{ - // is_valid ensures that we're on the correct thread. - if (!is_valid()) - throw InvalidatedException(); -} - -void Results::validate_write() const -{ - validate_read(); - if (!m_realm || !m_realm->is_in_transaction()) - throw InvalidTransactionException("Must be in a write transaction"); -} - -size_t Results::size() -{ - validate_read(); - switch (m_mode) { - case Mode::Empty: return 0; - case Mode::Table: return m_table->size(); - case Mode::LinkView: return m_link_view->size(); - case Mode::Query: - m_query.sync_view_if_needed(); - if (!m_distinct) - return m_query.count(); - REALM_FALLTHROUGH; - case Mode::TableView: - update_tableview(); - return m_table_view.size(); - } - REALM_UNREACHABLE(); -} - -const ObjectSchema& Results::get_object_schema() const -{ - validate_read(); - - if (!m_object_schema) { - REALM_ASSERT(m_realm); - auto it = m_realm->schema().find(get_object_type()); - REALM_ASSERT(it != m_realm->schema().end()); - m_object_schema = &*it; - } - - return *m_object_schema; -} - - -StringData Results::get_object_type() const noexcept -{ - if (!m_table) { - return StringData(); - } - - return ObjectStore::object_type_for_table_name(m_table->get_name()); -} - -RowExpr Results::get(size_t row_ndx) -{ - validate_read(); - switch (m_mode) { - case Mode::Empty: break; - case Mode::Table: - if (row_ndx < m_table->size()) - return m_table->get(row_ndx); - break; - case Mode::LinkView: - if (update_linkview()) { - if (row_ndx < m_link_view->size()) - return m_link_view->get(row_ndx); - break; - } - REALM_FALLTHROUGH; - case Mode::Query: - case Mode::TableView: - update_tableview(); - if (row_ndx >= m_table_view.size()) - break; - if (m_update_policy == UpdatePolicy::Never && !m_table_view.is_row_attached(row_ndx)) - return {}; - return m_table_view.get(row_ndx); - } - - throw OutOfBoundsIndexException{row_ndx, size()}; -} - -util::Optional Results::first() -{ - validate_read(); - switch (m_mode) { - case Mode::Empty: - return none; - case Mode::Table: - return m_table->size() == 0 ? util::none : util::make_optional(m_table->front()); - case Mode::LinkView: - if (update_linkview()) - return m_link_view->size() == 0 ? util::none : util::make_optional(m_link_view->get(0)); - REALM_FALLTHROUGH; - case Mode::Query: - case Mode::TableView: - update_tableview(); - return m_table_view.size() == 0 ? util::none : util::make_optional(m_table_view.front()); - } - REALM_UNREACHABLE(); -} - -util::Optional Results::last() -{ - validate_read(); - switch (m_mode) { - case Mode::Empty: - return none; - case Mode::Table: - return m_table->size() == 0 ? util::none : util::make_optional(m_table->back()); - case Mode::LinkView: - if (update_linkview()) - return m_link_view->size() == 0 ? util::none : util::make_optional(m_link_view->get(m_link_view->size() - 1)); - REALM_FALLTHROUGH; - case Mode::Query: - case Mode::TableView: - update_tableview(); - return m_table_view.size() == 0 ? util::none : util::make_optional(m_table_view.back()); - } - REALM_UNREACHABLE(); -} - -bool Results::update_linkview() -{ - REALM_ASSERT(m_update_policy == UpdatePolicy::Auto); - - if (m_sort || m_distinct) { - m_query = get_query(); - m_mode = Mode::Query; - update_tableview(); - return false; - } - return true; -} - -void Results::update_tableview(bool wants_notifications) -{ - if (m_update_policy == UpdatePolicy::Never) { - REALM_ASSERT(m_mode == Mode::TableView); - return; - } - - switch (m_mode) { - case Mode::Empty: - case Mode::Table: - case Mode::LinkView: - return; - case Mode::Query: - m_query.sync_view_if_needed(); - m_table_view = m_query.find_all(); - if (m_sort) { - m_table_view.sort(m_sort); - } - if (m_distinct) { - m_table_view.distinct(m_distinct); - } - m_mode = Mode::TableView; - REALM_FALLTHROUGH; - case Mode::TableView: - if (wants_notifications && !m_notifier && !m_realm->is_in_transaction() && m_realm->can_deliver_notifications()) { - m_notifier = std::make_shared<_impl::ResultsNotifier>(*this); - _impl::RealmCoordinator::register_notifier(m_notifier); - } - m_has_used_table_view = true; - m_table_view.sync_if_needed(); - break; - } -} - -size_t Results::index_of(Row const& row) -{ - validate_read(); - if (!row) { - throw DetatchedAccessorException{}; - } - if (m_table && row.get_table() != m_table) { - throw IncorrectTableException( - ObjectStore::object_type_for_table_name(m_table->get_name()), - ObjectStore::object_type_for_table_name(row.get_table()->get_name()), - "Attempting to get the index of a Row of the wrong type" - ); - } - return index_of(row.get_index()); -} - -size_t Results::index_of(size_t row_ndx) -{ - validate_read(); - switch (m_mode) { - case Mode::Empty: - return not_found; - case Mode::Table: - return row_ndx; - case Mode::LinkView: - if (update_linkview()) - return m_link_view->find(row_ndx); - REALM_FALLTHROUGH; - case Mode::Query: - case Mode::TableView: - update_tableview(); - return m_table_view.find_by_source_ndx(row_ndx); - } - REALM_UNREACHABLE(); -} - -template -util::Optional Results::aggregate(size_t column, - const char* name, - Int agg_int, Float agg_float, - Double agg_double, Timestamp agg_timestamp) -{ - validate_read(); - if (!m_table) - return none; - if (column > m_table->get_column_count()) - throw OutOfBoundsIndexException{column, m_table->get_column_count()}; - - auto do_agg = [&](auto const& getter) -> util::Optional { - switch (m_mode) { - case Mode::Empty: - return none; - case Mode::Table: - return util::Optional(getter(*m_table)); - case Mode::LinkView: - m_query = this->get_query(); - m_mode = Mode::Query; - REALM_FALLTHROUGH; - case Mode::Query: - case Mode::TableView: - this->update_tableview(); - return util::Optional(getter(m_table_view)); - } - - REALM_UNREACHABLE(); - }; - - switch (m_table->get_column_type(column)) - { - case type_Timestamp: return do_agg(agg_timestamp); - case type_Double: return do_agg(agg_double); - case type_Float: return do_agg(agg_float); - case type_Int: return do_agg(agg_int); - default: - throw UnsupportedColumnTypeException{column, m_table, name}; - } -} - -util::Optional Results::max(size_t column) -{ - size_t return_ndx = npos; - auto results = aggregate(column, "max", - [&](auto const& table) { return table.maximum_int(column, &return_ndx); }, - [&](auto const& table) { return table.maximum_float(column, &return_ndx); }, - [&](auto const& table) { return table.maximum_double(column, &return_ndx); }, - [&](auto const& table) { return table.maximum_timestamp(column, &return_ndx); }); - return return_ndx == npos ? none : results; -} - -util::Optional Results::min(size_t column) -{ - size_t return_ndx = npos; - auto results = aggregate(column, "min", - [&](auto const& table) { return table.minimum_int(column, &return_ndx); }, - [&](auto const& table) { return table.minimum_float(column, &return_ndx); }, - [&](auto const& table) { return table.minimum_double(column, &return_ndx); }, - [&](auto const& table) { return table.minimum_timestamp(column, &return_ndx); }); - return return_ndx == npos ? none : results; -} - -util::Optional Results::sum(size_t column) -{ - return aggregate(column, "sum", - [=](auto const& table) { return table.sum_int(column); }, - [=](auto const& table) { return table.sum_float(column); }, - [=](auto const& table) { return table.sum_double(column); }, - [=](auto const&) -> util::None { throw UnsupportedColumnTypeException{column, m_table, "sum"}; }); -} - -util::Optional Results::average(size_t column) -{ - // Initial value to make gcc happy - size_t value_count = 0; - auto results = aggregate(column, "average", - [&](auto const& table) { return table.average_int(column, &value_count); }, - [&](auto const& table) { return table.average_float(column, &value_count); }, - [&](auto const& table) { return table.average_double(column, &value_count); }, - [&](auto const&) -> util::None { throw UnsupportedColumnTypeException{column, m_table, "average"}; }); - return value_count == 0 ? none : results; -} - -void Results::clear() -{ - switch (m_mode) { - case Mode::Empty: - return; - case Mode::Table: - validate_write(); - m_table->clear(); - break; - case Mode::Query: - // Not using Query:remove() because building the tableview and - // clearing it is actually significantly faster - case Mode::TableView: - validate_write(); - update_tableview(); - - switch (m_update_policy) { - case UpdatePolicy::Auto: - m_table_view.clear(RemoveMode::unordered); - break; - case UpdatePolicy::Never: { - // Copy the TableView because a frozen Results shouldn't let its size() change. - TableView copy(m_table_view); - copy.clear(RemoveMode::unordered); - break; - } - } - break; - case Mode::LinkView: - validate_write(); - m_link_view->remove_all_target_rows(); - break; - } -} - -Query Results::get_query() const -{ - validate_read(); - switch (m_mode) { - case Mode::Empty: - case Mode::Query: - return m_query; - case Mode::TableView: { - // A TableView has an associated Query if it was produced by Query::find_all. This is indicated - // by TableView::get_query returning a Query with a non-null table. - Query query = m_table_view.get_query(); - if (query.get_table()) { - return query; - } - - // The TableView has no associated query so create one with no conditions that is restricted - // to the rows in the TableView. - if (m_update_policy == UpdatePolicy::Auto) { - m_table_view.sync_if_needed(); - } - return Query(*m_table, std::unique_ptr(new TableView(m_table_view))); - } - case Mode::LinkView: - return m_table->where(m_link_view); - case Mode::Table: - return m_table->where(); - } - REALM_UNREACHABLE(); -} - -TableView Results::get_tableview() -{ - validate_read(); - switch (m_mode) { - case Mode::Empty: - return {}; - case Mode::LinkView: - if (update_linkview()) - return m_table->where(m_link_view).find_all(); - REALM_FALLTHROUGH; - case Mode::Query: - case Mode::TableView: - update_tableview(); - return m_table_view; - case Mode::Table: - return m_table->where().find_all(); - } - REALM_UNREACHABLE(); -} - -Results Results::sort(realm::SortDescriptor&& sort) const -{ - return Results(m_realm, get_query(), std::move(sort), m_distinct); -} - -Results Results::filter(Query&& q) const -{ - return Results(m_realm, get_query().and_query(std::move(q)), m_sort, m_distinct); -} - - -// FIXME: The current implementation of distinct() breaks the Results API. -// This is tracked by the following issues: -// - https://github.com/realm/realm-object-store/issues/266 -// - https://github.com/realm/realm-core/issues/2332 -Results Results::distinct(realm::SortDescriptor&& uniqueness) -{ - auto tv = get_tableview(); - tv.distinct(uniqueness); - return Results(m_realm, std::move(tv), m_sort, std::move(uniqueness)); -} - -Results Results::snapshot() const & -{ - validate_read(); - - return Results(*this).snapshot(); -} - -Results Results::snapshot() && -{ - validate_read(); - - switch (m_mode) { - case Mode::Empty: - return Results(); - - case Mode::Table: - case Mode::LinkView: - m_query = get_query(); - m_mode = Mode::Query; - - REALM_FALLTHROUGH; - case Mode::Query: - case Mode::TableView: - update_tableview(false); - m_notifier.reset(); - m_update_policy = UpdatePolicy::Never; - return std::move(*this); - } - REALM_UNREACHABLE(); -} - -void Results::prepare_async() -{ - if (m_notifier) { - return; - } - if (m_realm->config().read_only()) { - throw InvalidTransactionException("Cannot create asynchronous query for read-only Realms"); - } - if (m_realm->is_in_transaction()) { - throw InvalidTransactionException("Cannot create asynchronous query while in a write transaction"); - } - if (m_update_policy == UpdatePolicy::Never) { - throw std::logic_error("Cannot create asynchronous query for snapshotted Results."); - } - - m_wants_background_updates = true; - m_notifier = std::make_shared<_impl::ResultsNotifier>(*this); - _impl::RealmCoordinator::register_notifier(m_notifier); -} - -NotificationToken Results::async(std::function target) -{ - prepare_async(); - auto wrap = [=](CollectionChangeSet, std::exception_ptr e) { target(e); }; - return {m_notifier, m_notifier->add_callback(wrap)}; -} - -NotificationToken Results::add_notification_callback(CollectionChangeCallback cb) & -{ - prepare_async(); - return {m_notifier, m_notifier->add_callback(std::move(cb))}; -} - -bool Results::is_in_table_order() const -{ - switch (m_mode) { - case Mode::Empty: - case Mode::Table: - return true; - case Mode::LinkView: - return false; - case Mode::Query: - return m_query.produces_results_in_table_order() && !m_sort; - case Mode::TableView: - return m_table_view.is_in_table_order(); - } - REALM_UNREACHABLE(); // keep gcc happy -} - -void Results::Internal::set_table_view(Results& results, realm::TableView &&tv) -{ - REALM_ASSERT(results.m_update_policy != UpdatePolicy::Never); - // If the previous TableView was never actually used, then stop generating - // new ones until the user actually uses the Results object again - if (results.m_mode == Mode::TableView) { - results.m_wants_background_updates = results.m_has_used_table_view; - } - - results.m_table_view = std::move(tv); - results.m_mode = Mode::TableView; - results.m_has_used_table_view = false; - REALM_ASSERT(results.m_table_view.is_in_sync()); - REALM_ASSERT(results.m_table_view.is_attached()); -} - -Results::OutOfBoundsIndexException::OutOfBoundsIndexException(size_t r, size_t c) -: std::out_of_range(util::format("Requested index %1 greater than max %2", r, c)) -, requested(r), valid_count(c) {} - -Results::UnsupportedColumnTypeException::UnsupportedColumnTypeException(size_t column, const Table* table, const char* operation) -: std::logic_error(util::format("Cannot %1 property '%2': operation not supported for '%3' properties", - operation, table->get_column_name(column), - string_for_property_type(static_cast(table->get_column_type(column))))) -, column_index(column) -, column_name(table->get_column_name(column)) -, column_type(table->get_column_type(column)) -{ -} diff --git a/Pods/Realm/Realm/ObjectStore/src/schema.cpp b/Pods/Realm/Realm/ObjectStore/src/schema.cpp deleted file mode 100644 index f9283541..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/schema.cpp +++ /dev/null @@ -1,218 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "schema.hpp" - -#include "object_schema.hpp" -#include "object_store.hpp" -#include "object_schema.hpp" -#include "property.hpp" - -#include - -using namespace realm; - -namespace realm { -bool operator==(Schema const& a, Schema const& b) -{ - return static_cast(a) == static_cast(b); -} -} - -Schema::Schema() = default; -Schema::~Schema() = default; -Schema::Schema(Schema const&) = default; -Schema::Schema(Schema &&) = default; -Schema& Schema::operator=(Schema const&) = default; -Schema& Schema::operator=(Schema&&) = default; - -Schema::Schema(std::initializer_list types) : Schema(base(types)) { } - -Schema::Schema(base types) : base(std::move(types)) -{ - std::sort(begin(), end(), [](ObjectSchema const& lft, ObjectSchema const& rgt) { - return lft.name < rgt.name; - }); -} - -Schema::iterator Schema::find(StringData name) -{ - auto it = std::lower_bound(begin(), end(), name, [](ObjectSchema const& lft, StringData rgt) { - return lft.name < rgt; - }); - if (it != end() && it->name != name) { - it = end(); - } - return it; -} - -Schema::const_iterator Schema::find(StringData name) const -{ - return const_cast(this)->find(name); -} - -Schema::iterator Schema::find(ObjectSchema const& object) noexcept -{ - return find(object.name); -} - -Schema::const_iterator Schema::find(ObjectSchema const& object) const noexcept -{ - return const_cast(this)->find(object); -} - -void Schema::validate() const -{ - std::vector exceptions; - for (auto const& object : *this) { - object.validate(*this, exceptions); - } - - if (exceptions.size()) { - throw SchemaValidationException(exceptions); - } -} - -namespace { -struct IsNotRemoveProperty { - bool operator()(SchemaChange sc) const { return sc.visit(*this); } - bool operator()(schema_change::RemoveProperty) const { return false; } - template bool operator()(T) const { return true; } -}; -struct GetRemovedColumn { - size_t operator()(SchemaChange sc) const { return sc.visit(*this); } - size_t operator()(schema_change::RemoveProperty p) const { return p.property->table_column; } - template size_t operator()(T) const { REALM_COMPILER_HINT_UNREACHABLE(); } -}; -} - -static void compare(ObjectSchema const& existing_schema, - ObjectSchema const& target_schema, - std::vector& changes) -{ - for (auto& current_prop : existing_schema.persisted_properties) { - auto target_prop = target_schema.property_for_name(current_prop.name); - - if (!target_prop) { - changes.emplace_back(schema_change::RemoveProperty{&existing_schema, ¤t_prop}); - continue; - } - if (target_schema.property_is_computed(*target_prop)) { - changes.emplace_back(schema_change::RemoveProperty{&existing_schema, ¤t_prop}); - continue; - } - if (current_prop.type != target_prop->type || current_prop.object_type != target_prop->object_type) { - changes.emplace_back(schema_change::ChangePropertyType{&existing_schema, ¤t_prop, target_prop}); - continue; - } - if (current_prop.is_nullable != target_prop->is_nullable) { - if (current_prop.is_nullable) - changes.emplace_back(schema_change::MakePropertyRequired{&existing_schema, ¤t_prop}); - else - changes.emplace_back(schema_change::MakePropertyNullable{&existing_schema, ¤t_prop}); - } - if (target_prop->requires_index()) { - if (!current_prop.is_indexed) - changes.emplace_back(schema_change::AddIndex{&existing_schema, ¤t_prop}); - } - else if (current_prop.requires_index()) { - changes.emplace_back(schema_change::RemoveIndex{&existing_schema, ¤t_prop}); - } - } - - if (existing_schema.primary_key != target_schema.primary_key) { - changes.emplace_back(schema_change::ChangePrimaryKey{&existing_schema, target_schema.primary_key_property()}); - } - - for (auto& target_prop : target_schema.persisted_properties) { - if (!existing_schema.property_for_name(target_prop.name)) { - changes.emplace_back(schema_change::AddProperty{&existing_schema, &target_prop}); - } - } - - // Move all RemovePropertys to the end and sort in descending order of - // column index, as removing a column will shift all columns after that one - auto it = std::partition(begin(changes), end(changes), IsNotRemoveProperty{}); - std::sort(it, end(changes), - [](auto a, auto b) { return GetRemovedColumn()(a) > GetRemovedColumn()(b); }); -} - -std::vector Schema::compare(Schema const& target_schema) const -{ - std::vector changes; - for (auto &object_schema : target_schema) { - auto matching_schema = find(object_schema); - if (matching_schema == end()) { - changes.emplace_back(schema_change::AddTable{&object_schema}); - continue; - } - - ::compare(*matching_schema, object_schema, changes); - } - return changes; -} - -void Schema::copy_table_columns_from(realm::Schema const& other) -{ - for (auto& source_schema : other) { - auto matching_schema = find(source_schema); - if (matching_schema == end()) { - continue; - } - - for (auto& current_prop : source_schema.persisted_properties) { - auto target_prop = matching_schema->property_for_name(current_prop.name); - if (target_prop) { - target_prop->table_column = current_prop.table_column; - } - } - } -} - -namespace realm { -bool operator==(SchemaChange const& lft, SchemaChange const& rgt) -{ - if (lft.m_kind != rgt.m_kind) - return false; - - using namespace schema_change; - struct Visitor { - SchemaChange const& value; - - #define REALM_SC_COMPARE(type, ...) \ - bool operator()(type rgt) const \ - { \ - auto cmp = [](auto&& v) { return std::tie(__VA_ARGS__); }; \ - return cmp(value.type) == cmp(rgt); \ - } - - REALM_SC_COMPARE(AddIndex, v.object, v.property) - REALM_SC_COMPARE(AddProperty, v.object, v.property) - REALM_SC_COMPARE(AddTable, v.object) - REALM_SC_COMPARE(ChangePrimaryKey, v.object, v.property) - REALM_SC_COMPARE(ChangePropertyType, v.object, v.old_property, v.new_property) - REALM_SC_COMPARE(MakePropertyNullable, v.object, v.property) - REALM_SC_COMPARE(MakePropertyRequired, v.object, v.property) - REALM_SC_COMPARE(RemoveIndex, v.object, v.property) - REALM_SC_COMPARE(RemoveProperty, v.object, v.property) - - #undef REALM_SC_COMPARE - } visitor{lft}; - return rgt.visit(visitor); -} -} // namespace realm diff --git a/Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp b/Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp deleted file mode 100644 index fb322f2b..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/shared_realm.cpp +++ /dev/null @@ -1,792 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "shared_realm.hpp" - -#include "impl/collection_notifier.hpp" -#include "impl/realm_coordinator.hpp" -#include "impl/transact_log_handler.hpp" - -#include "binding_context.hpp" -#include "list.hpp" -#include "object.hpp" -#include "object_schema.hpp" -#include "object_store.hpp" -#include "results.hpp" -#include "schema.hpp" -#include "thread_safe_reference.hpp" - -#include "util/compiler.hpp" -#include "util/format.hpp" - -#include -#include - -#if REALM_ENABLE_SYNC -#include -#endif - -using namespace realm; -using namespace realm::_impl; - -static std::string get_initial_temporary_directory() -{ - auto tmp_dir = getenv("TMPDIR"); - if (!tmp_dir) { - return std::string(); - } - std::string tmp_dir_str(tmp_dir); - if (!tmp_dir_str.empty() && tmp_dir_str.back() != '/') { - tmp_dir_str += '/'; - } - return tmp_dir_str; -} - -static std::string temporary_directory = get_initial_temporary_directory(); - -void realm::set_temporary_directory(std::string directory_path) -{ - if (directory_path.empty()) { - throw std::invalid_argument("'directory_path` is empty."); - } - if (directory_path.back() != '/') { - throw std::invalid_argument("'directory_path` must ends with '/'."); - } - temporary_directory = std::move(directory_path); -} - -const std::string& realm::get_temporary_directory() noexcept -{ - return temporary_directory; -} - -Realm::Realm(Config config, std::shared_ptr<_impl::RealmCoordinator> coordinator) -: m_config(std::move(config)) -, m_execution_context(m_config.execution_context) -{ - open_with_config(m_config, m_history, m_shared_group, m_read_only_group, this); - - if (m_read_only_group) { - m_group = m_read_only_group.get(); - } - - // if there is an existing realm at the current path steal its schema/column mapping - if (auto existing = coordinator ? coordinator->get_schema() : nullptr) { - m_schema = *existing; - m_schema_version = coordinator->get_schema_version(); - } - else { - // otherwise get the schema from the group - m_schema_version = ObjectStore::get_schema_version(read_group()); - m_schema = ObjectStore::schema_from_group(read_group()); - - if (m_shared_group) { - m_schema_transaction_version = m_shared_group->get_version_of_current_transaction().version; - m_shared_group->end_read(); - m_group = nullptr; - } - } - - m_coordinator = std::move(coordinator); -} - -REALM_NOINLINE static void translate_file_exception(StringData path, bool read_only=false) -{ - try { - throw; - } - catch (util::File::PermissionDenied const& ex) { - throw RealmFileException(RealmFileException::Kind::PermissionDenied, ex.get_path(), - util::format("Unable to open a realm at path '%1'. Please use a path where your app has %2 permissions.", - ex.get_path(), read_only ? "read" : "read-write"), - ex.what()); - } - catch (util::File::Exists const& ex) { - throw RealmFileException(RealmFileException::Kind::Exists, ex.get_path(), - util::format("File at path '%1' already exists.", ex.get_path()), - ex.what()); - } - catch (util::File::NotFound const& ex) { - throw RealmFileException(RealmFileException::Kind::NotFound, ex.get_path(), - util::format("Directory at path '%1' does not exist.", ex.get_path()), ex.what()); - } - catch (util::File::AccessError const& ex) { - // Errors for `open()` include the path, but other errors don't. We - // don't want two copies of the path in the error, so strip it out if it - // appears, and then include it in our prefix. - std::string underlying = ex.what(); - RealmFileException::Kind error_kind = RealmFileException::Kind::AccessError; - // FIXME: Replace this with a proper specific exception type once Core adds support for it. - if (underlying == "Bad or incompatible history type") - error_kind = RealmFileException::Kind::BadHistoryError; - auto pos = underlying.find(ex.get_path()); - if (pos != std::string::npos && pos > 0) { - // One extra char at each end for the quotes - underlying.replace(pos - 1, ex.get_path().size() + 2, ""); - } - throw RealmFileException(error_kind, ex.get_path(), - util::format("Unable to open a realm at path '%1': %2.", ex.get_path(), underlying), ex.what()); - } - catch (IncompatibleLockFile const& ex) { - throw RealmFileException(RealmFileException::Kind::IncompatibleLockFile, path, - "Realm file is currently open in another process " - "which cannot share access with this process. " - "All processes sharing a single file must be the same architecture.", - ex.what()); - } - catch (FileFormatUpgradeRequired const& ex) { - throw RealmFileException(RealmFileException::Kind::FormatUpgradeRequired, path, - "The Realm file format must be allowed to be upgraded " - "in order to proceed.", - ex.what()); - } -} - -void Realm::open_with_config(const Config& config, - std::unique_ptr& history, - std::unique_ptr& shared_group, - std::unique_ptr& read_only_group, - Realm* realm) -{ - try { - if (config.read_only()) { - if (config.realm_data.is_null()) { - read_only_group = std::make_unique(config.path, config.encryption_key.data(), Group::mode_ReadOnly); - } - else { - // Create in-memory read-only realm from existing buffer (without taking ownership of the buffer) - read_only_group = std::make_unique(config.realm_data, false); - } - } - else { - bool server_synchronization_mode = bool(config.sync_config) || config.force_sync_history; - if (server_synchronization_mode) { -#if REALM_ENABLE_SYNC - history = realm::sync::make_sync_history(config.path); -#else - REALM_TERMINATE("Realm was not built with sync enabled"); -#endif - } - else { - history = realm::make_in_realm_history(config.path); - } - - SharedGroupOptions options; - options.durability = config.in_memory ? SharedGroupOptions::Durability::MemOnly : - SharedGroupOptions::Durability::Full; - options.encryption_key = config.encryption_key.data(); - options.allow_file_format_upgrade = !config.disable_format_upgrade && - config.schema_mode != SchemaMode::ResetFile; - options.upgrade_callback = [&](int from_version, int to_version) { - if (realm) { - realm->upgrade_initial_version = from_version; - realm->upgrade_final_version = to_version; - } - }; - options.temp_dir = get_temporary_directory(); - shared_group = std::make_unique(*history, options); - } - } - catch (realm::FileFormatUpgradeRequired const& ex) { - if (config.schema_mode != SchemaMode::ResetFile) { - translate_file_exception(config.path, config.read_only()); - } - util::File::remove(config.path); - open_with_config(config, history, shared_group, read_only_group, realm); - } - catch (...) { - translate_file_exception(config.path, config.read_only()); - } -} - -Realm::~Realm() -{ - if (m_coordinator) { - m_coordinator->unregister_realm(this); - } -} - -Group& Realm::read_group() -{ - verify_open(); - - if (!m_group) { - m_group = &const_cast(m_shared_group->begin_read()); - add_schema_change_handler(); - } - return *m_group; -} - -void Realm::Internal::begin_read(Realm& realm, VersionID version_id) -{ - REALM_ASSERT(!realm.m_group); - realm.m_group = &const_cast(realm.m_shared_group->begin_read(version_id)); - realm.add_schema_change_handler(); -} - -SharedRealm Realm::get_shared_realm(Config config) -{ - auto coordinator = RealmCoordinator::get_coordinator(config.path); - return coordinator->get_realm(std::move(config)); -} - -void Realm::set_schema(Schema schema, uint64_t version) -{ - schema.copy_table_columns_from(m_schema); - m_schema = schema; - m_coordinator->update_schema(schema, version); -} - -bool Realm::read_schema_from_group_if_needed() -{ - // schema of read-only Realms can't change - if (m_read_only_group) - return false; - - Group& group = read_group(); - auto current_version = m_shared_group->get_version_of_current_transaction().version; - if (m_schema_transaction_version == current_version) - return false; - - m_schema = ObjectStore::schema_from_group(group); - m_schema_version = ObjectStore::get_schema_version(group); - m_schema_transaction_version = current_version; - return true; -} - -bool Realm::reset_file_if_needed(Schema& schema, uint64_t version, std::vector& required_changes) -{ - if (m_schema_version == ObjectStore::NotVersioned) - return false; - if (m_schema_version == version) { - if (required_changes.empty()) { - set_schema(std::move(schema), version); - return true; - } - if (!ObjectStore::needs_migration(required_changes)) - return false; - } - - // FIXME: this does not work if multiple processes try to open the file at - // the same time, or even multiple threads if there is not any external - // synchronization. The latter is probably fixable, but making it - // multi-process-safe requires some sort of multi-process exclusive lock - m_group = nullptr; - m_shared_group = nullptr; - m_history = nullptr; - util::File::remove(m_config.path); - - open_with_config(m_config, m_history, m_shared_group, m_read_only_group, this); - m_schema = ObjectStore::schema_from_group(read_group()); - m_schema_version = ObjectStore::get_schema_version(read_group()); - required_changes = m_schema.compare(schema); - return false; -} - -void Realm::update_schema(Schema schema, uint64_t version, MigrationFunction migration_function, bool in_transaction) -{ - schema.validate(); - read_schema_from_group_if_needed(); - std::vector required_changes = m_schema.compare(schema); - - auto no_changes_required = [&] { - switch (m_config.schema_mode) { - case SchemaMode::Automatic: - if (version < m_schema_version && m_schema_version != ObjectStore::NotVersioned) { - throw InvalidSchemaVersionException(m_schema_version, version); - } - if (version == m_schema_version) { - if (required_changes.empty()) { - set_schema(std::move(schema), version); - return true; - } - ObjectStore::verify_no_migration_required(required_changes); - } - return false; - - case SchemaMode::ReadOnly: - if (version != m_schema_version) - throw InvalidSchemaVersionException(m_schema_version, version); - ObjectStore::verify_no_migration_required(m_schema.compare(schema)); - set_schema(std::move(schema), version); - return true; - - case SchemaMode::ResetFile: - return reset_file_if_needed(schema, version, required_changes); - - case SchemaMode::Additive: - if (required_changes.empty()) { - set_schema(std::move(schema), version); - return version == m_schema_version; - } - ObjectStore::verify_valid_additive_changes(required_changes); - return false; - - case SchemaMode::Manual: - if (version < m_schema_version && m_schema_version != ObjectStore::NotVersioned) { - throw InvalidSchemaVersionException(m_schema_version, version); - } - if (version == m_schema_version) { - ObjectStore::verify_no_changes_required(required_changes); - return true; - } - return false; - } - REALM_COMPILER_HINT_UNREACHABLE(); - }; - - if (no_changes_required()) - return; - // Either the schema version has changed or we need to do non-migration changes - - m_group->set_schema_change_notification_handler(nullptr); - if (!in_transaction) { - transaction::begin_without_validation(*m_shared_group); - } - add_schema_change_handler(); - - // Cancel the write transaction if we exit this function before committing it - struct WriteTransactionGuard { - Realm& realm; - bool& in_transaction; - // When in_transaction is true, caller is responsible to cancel the transaction. - ~WriteTransactionGuard() { if (!in_transaction && realm.is_in_transaction()) realm.cancel_transaction(); } - } write_transaction_guard{*this, in_transaction}; - - // If beginning the write transaction advanced the version, then someone else - // may have updated the schema and we need to re-read it - // We can't just begin the write transaction before checking anything because - // that means that write transactions would block opening Realms in other processes - if (read_schema_from_group_if_needed()) { - required_changes = m_schema.compare(schema); - if (no_changes_required()) - return; - } - - bool additive = m_config.schema_mode == SchemaMode::Additive; - if (migration_function && !additive) { - auto wrapper = [&] { - SharedRealm old_realm(new Realm(m_config, nullptr)); - // Need to open in read-write mode so that it uses a SharedGroup, but - // users shouldn't actually be able to write via the old realm - old_realm->m_config.schema_mode = SchemaMode::ReadOnly; - - migration_function(old_realm, shared_from_this(), m_schema); - }; - ObjectStore::apply_schema_changes(read_group(), m_schema, m_schema_version, - schema, version, m_config.schema_mode, required_changes, wrapper); - } - else { - ObjectStore::apply_schema_changes(read_group(), m_schema, m_schema_version, - schema, version, m_config.schema_mode, required_changes); - REALM_ASSERT_DEBUG(additive || (required_changes = ObjectStore::schema_from_group(read_group()).compare(schema)).empty()); - } - - if (!in_transaction) { - commit_transaction(); - } - m_coordinator->update_schema(m_schema, version); -} - -void Realm::add_schema_change_handler() -{ - if (m_coordinator && m_config.schema_mode == SchemaMode::Additive) { - m_group->set_schema_change_notification_handler([&] { - auto new_schema = ObjectStore::schema_from_group(read_group()); - auto required_changes = m_schema.compare(new_schema); - ObjectStore::verify_valid_additive_changes(required_changes); - m_schema.copy_table_columns_from(new_schema); - m_coordinator->update_schema(m_schema, m_schema_version); - }); - } -} - -static void check_read_write(Realm *realm) -{ - if (realm->config().read_only()) { - throw InvalidTransactionException("Can't perform transactions on read-only Realms."); - } -} - -void Realm::verify_thread() const -{ - if (!m_execution_context.contains()) - return; - - auto thread_id = m_execution_context.get(); - if (thread_id != std::this_thread::get_id()) - throw IncorrectThreadException(); -} - -void Realm::verify_in_write() const -{ - if (!is_in_transaction()) { - throw InvalidTransactionException("Cannot modify managed objects outside of a write transaction."); - } -} - -void Realm::verify_open() const -{ - if (is_closed()) { - throw ClosedRealmException(); - } -} - -bool Realm::is_in_transaction() const noexcept -{ - if (!m_shared_group) { - return false; - } - return m_shared_group->get_transact_stage() == SharedGroup::transact_Writing; -} - -void Realm::begin_transaction() -{ - check_read_write(this); - verify_thread(); - - if (is_in_transaction()) { - throw InvalidTransactionException("The Realm is already in a write transaction"); - } - - // If we're already in the middle of sending notifications, just begin the - // write transaction without sending more notifications. If this actually - // advances the read version this could leave the user in an inconsistent - // state, but that's unavoidable. - if (m_is_sending_notifications) { - _impl::NotifierPackage notifiers; - transaction::begin(*m_shared_group, m_binding_context.get(), notifiers); - return; - } - - // make sure we have a read transaction - read_group(); - - m_is_sending_notifications = true; - auto cleanup = util::make_scope_exit([this]() noexcept { m_is_sending_notifications = false; }); - - m_coordinator->promote_to_write(*this); -} - -void Realm::commit_transaction() -{ - check_read_write(this); - verify_thread(); - - if (!is_in_transaction()) { - throw InvalidTransactionException("Can't commit a non-existing write transaction"); - } - - m_coordinator->commit_write(*this); -} - -void Realm::cancel_transaction() -{ - check_read_write(this); - verify_thread(); - - if (!is_in_transaction()) { - throw InvalidTransactionException("Can't cancel a non-existing write transaction"); - } - - transaction::cancel(*m_shared_group, m_binding_context.get()); -} - -void Realm::invalidate() -{ - verify_open(); - verify_thread(); - check_read_write(this); - - if (m_is_sending_notifications) { - return; - } - - if (is_in_transaction()) { - cancel_transaction(); - } - if (!m_group) { - return; - } - - m_shared_group->end_read(); - m_group = nullptr; -} - -bool Realm::compact() -{ - verify_thread(); - - if (m_config.read_only()) { - throw InvalidTransactionException("Can't compact a read-only Realm"); - } - if (is_in_transaction()) { - throw InvalidTransactionException("Can't compact a Realm within a write transaction"); - } - - Group& group = read_group(); - for (auto &object_schema : m_schema) { - ObjectStore::table_for_object_type(group, object_schema.name)->optimize(); - } - m_shared_group->end_read(); - m_group = nullptr; - - return m_shared_group->compact(); -} - -void Realm::write_copy(StringData path, BinaryData key) -{ - if (key.data() && key.size() != 64) { - throw InvalidEncryptionKeyException(); - } - verify_thread(); - try { - read_group().write(path, key.data()); - } - catch (...) { - translate_file_exception(path); - } -} - -OwnedBinaryData Realm::write_copy() -{ - verify_thread(); - BinaryData buffer = read_group().write_to_mem(); - - // Since OwnedBinaryData does not have a constructor directly taking - // ownership of BinaryData, we have to do this to avoid copying the buffer - return OwnedBinaryData(std::unique_ptr((char*)buffer.data()), buffer.size()); -} - -void Realm::notify() -{ - if (is_closed() || is_in_transaction()) { - return; - } - - verify_thread(); - - if (m_binding_context) { - m_binding_context->before_notify(); - } - - auto cleanup = util::make_scope_exit([this]() noexcept { m_is_sending_notifications = false; }); - if (!m_shared_group->has_changed()) { - m_is_sending_notifications = true; - m_coordinator->process_available_async(*this); - return; - } - - if (m_binding_context) { - m_binding_context->changes_available(); - - // changes_available() may have advanced the read version, and if - // so we don't need to do anything further - if (!m_shared_group->has_changed()) - return; - } - - m_is_sending_notifications = true; - if (m_auto_refresh) { - if (m_group) { - m_coordinator->advance_to_ready(*this); - } - else { - if (m_binding_context) { - m_binding_context->did_change({}, {}); - } - m_coordinator->process_available_async(*this); - } - } -} - -bool Realm::refresh() -{ - verify_thread(); - check_read_write(this); - - // can't be any new changes if we're in a write transaction - if (is_in_transaction()) { - return false; - } - // don't advance if we're already in the process of advancing as that just - // makes things needlessly complicated - if (m_is_sending_notifications) { - return false; - } - - m_is_sending_notifications = true; - auto cleanup = util::make_scope_exit([this]() noexcept { m_is_sending_notifications = false; }); - - if (m_binding_context) { - m_binding_context->before_notify(); - } - if (m_group) { - return m_coordinator->advance_to_latest(*this); - } - - // No current read transaction, so just create a new one - read_group(); - m_coordinator->process_available_async(*this); - return true; -} - -bool Realm::can_deliver_notifications() const noexcept -{ - if (m_config.read_only()) { - return false; - } - - if (m_binding_context && !m_binding_context->can_deliver_notifications()) { - return false; - } - - return true; -} - -uint64_t Realm::get_schema_version(const Realm::Config &config) -{ - auto coordinator = RealmCoordinator::get_existing_coordinator(config.path); - if (coordinator) { - return coordinator->get_schema_version(); - } - - return ObjectStore::get_schema_version(Realm(config, nullptr).read_group()); -} - -void Realm::close() -{ - if (m_coordinator) { - m_coordinator->unregister_realm(this); - } - - m_group = nullptr; - m_shared_group = nullptr; - m_history = nullptr; - m_read_only_group = nullptr; - m_binding_context = nullptr; - m_coordinator = nullptr; -} - -util::Optional Realm::file_format_upgraded_from_version() const -{ - if (upgrade_initial_version != upgrade_final_version) { - return upgrade_initial_version; - } - return util::none; -} - -template -realm::ThreadSafeReference Realm::obtain_thread_safe_reference(T const& value) -{ - verify_thread(); - if (is_in_transaction()) { - throw InvalidTransactionException("Cannot obtain thread safe reference during a write transaction."); - } - return ThreadSafeReference(value); -} - -template ThreadSafeReference Realm::obtain_thread_safe_reference(Object const& value); -template ThreadSafeReference Realm::obtain_thread_safe_reference(List const& value); -template ThreadSafeReference Realm::obtain_thread_safe_reference(Results const& value); - -template -T Realm::resolve_thread_safe_reference(ThreadSafeReference reference) -{ - verify_thread(); - if (is_in_transaction()) { - throw InvalidTransactionException("Cannot resolve thread safe reference during a write transaction."); - } - if (reference.is_invalidated()) { - throw std::logic_error("Cannot resolve thread safe reference more than once."); - } - if (!reference.has_same_config(*this)) { - throw MismatchedRealmException("Cannot resolve thread safe reference in Realm with different configuration " - "than the source Realm."); - } - - // Ensure we're on the same version as the reference - if (!m_group) { - // A read transaction doesn't yet exist, so create at the reference's version - m_group = &const_cast(m_shared_group->begin_read(reference.m_version_id)); - add_schema_change_handler(); - } - else { - // A read transaction does exist, but let's make sure that its version matches the reference's - auto current_version = m_shared_group->get_version_of_current_transaction(); - SharedGroup::VersionID reference_version = SharedGroup::VersionID(reference.m_version_id); - - if (reference_version == current_version) { - return std::move(reference).import_into_realm(shared_from_this()); - } - - refresh(); - - current_version = m_shared_group->get_version_of_current_transaction(); - - // If the reference's version is behind, advance it to our version - if (reference_version < current_version) { - // Duplicate config for uncached Realm so we don't advance the user's Realm - Realm::Config config = m_coordinator->get_config(); - config.cache = false; - SharedRealm temporary_realm = m_coordinator->get_realm(config); - REALM_ASSERT(!temporary_realm->is_in_read_transaction()); - - // Begin read in temporary Realm at reference's version - temporary_realm->m_group = - &const_cast(temporary_realm->m_shared_group->begin_read(reference_version)); - - // With reference imported, advance temporary Realm to our version - T imported_value = std::move(reference).import_into_realm(temporary_realm); - transaction::advance(*temporary_realm->m_shared_group, temporary_realm->m_binding_context.get(), - current_version); - reference = ThreadSafeReference(imported_value); - } - } - - return std::move(reference).import_into_realm(shared_from_this()); -} - -template Object Realm::resolve_thread_safe_reference(ThreadSafeReference reference); -template List Realm::resolve_thread_safe_reference(ThreadSafeReference reference); -template Results Realm::resolve_thread_safe_reference(ThreadSafeReference reference); - -MismatchedConfigException::MismatchedConfigException(StringData message, StringData path) -: std::logic_error(util::format(message.data(), path)) { } - -MismatchedRealmException::MismatchedRealmException(StringData message) -: std::logic_error(message.data()) { } - -// FIXME Those are exposed for Java async queries, mainly because of handover related methods. -SharedGroup& RealmFriend::get_shared_group(Realm& realm) -{ - return *realm.m_shared_group; -} - -Group& RealmFriend::read_group_to(Realm& realm, VersionID& version) -{ - if (!realm.m_group) { - realm.m_group = &const_cast(realm.m_shared_group->begin_read(version)); - realm.add_schema_change_handler(); - } - else if (version != realm.m_shared_group->get_version_of_current_transaction()) { - realm.m_shared_group->end_read(); - realm.m_group = &const_cast(realm.m_shared_group->begin_read(version)); - } - return *realm.m_group; -} diff --git a/Pods/Realm/Realm/ObjectStore/src/sync/impl/sync_file.cpp b/Pods/Realm/Realm/ObjectStore/src/sync/impl/sync_file.cpp deleted file mode 100644 index 9c5027aa..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/sync/impl/sync_file.cpp +++ /dev/null @@ -1,363 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "sync/impl/sync_file.hpp" - -#include "util/time.hpp" - -#include -#include - -#include -#include -#include - -#if WIN32 -#include -#include - -inline static int mkstemp(char* _template) { return _open(_mktemp(_template), _O_CREAT | _O_TEMPORARY, _S_IREAD | _S_IWRITE); } -#else -#include -#endif - - -using File = realm::util::File; - -namespace realm { - -namespace { - -uint8_t value_of_hex_digit(char hex_digit) -{ - if (hex_digit >= '0' && hex_digit <= '9') { - return hex_digit - '0'; - } else if (hex_digit >= 'A' && hex_digit <= 'F') { - return 10 + hex_digit - 'A'; - } else if (hex_digit >= 'a' && hex_digit <= 'f') { - return 10 + hex_digit - 'a'; - } else { - throw std::invalid_argument("Cannot get the value of a character that isn't a hex digit."); - } -} - -bool filename_is_reserved(const std::string& filename) { - return (filename == "." || filename == ".."); -} - -bool character_is_unreserved(char character) -{ - bool is_capital_letter = (character >= 'A' && character <= 'Z'); - bool is_lowercase_letter = (character >= 'a' && character <= 'z'); - bool is_number = (character >= '0' && character <= '9'); - bool is_allowed_symbol = (character == '-' || character == '_' || character == '.'); - return is_capital_letter || is_lowercase_letter || is_number || is_allowed_symbol; -} - -char decoded_char_for(const std::string& percent_encoding, size_t index) -{ - if (index+2 >= percent_encoding.length()) { - throw std::invalid_argument("Malformed string: not enough characters after '%' before end of string."); - } - REALM_ASSERT(percent_encoding[index] == '%'); - return (16*value_of_hex_digit(percent_encoding[index + 1])) + value_of_hex_digit(percent_encoding[index + 2]); -} - -} // (anonymous namespace) - -namespace util { - -void remove_nonempty_dir(const std::string& path) -{ - // Open the directory and list all the files. - DIR *dir_listing = opendir(path.c_str()); - if (!dir_listing) { - return; - } - auto cleanup = util::make_scope_exit([=]() noexcept { closedir(dir_listing); }); - while (struct dirent *file = readdir(dir_listing)) { - auto file_type = file->d_type; - std::string file_name = file->d_name; - if (file_name == "." || file_name == "..") { - continue; - } - if (file_type == DT_REG || file_type == DT_FIFO) { - File::try_remove(file_path_by_appending_component(path, file_name)); - } else if (file_type == DT_DIR) { - // Directory, recurse - remove_nonempty_dir(file_path_by_appending_component(path, file_name, FilePathType::Directory)); - } - } - // Delete the directory itself - try { - util::remove_dir(path); - } - catch (File::NotFound const&) { - } -} - -std::string make_percent_encoded_string(const std::string& raw_string) -{ - std::string buffer; - buffer.reserve(raw_string.size()); - for (size_t i=0; i 0); - if (filename_is_reserved(user_identity)) { - throw std::invalid_argument("A user can't have an identifier reserved by the filesystem."); - } - auto user_path = file_path_by_appending_component(get_base_sync_directory(), - user_identity, - util::FilePathType::Directory); - util::try_make_dir(user_path); - return user_path; -} - -void SyncFileManager::remove_user_directory(const std::string& user_identity) const -{ - REALM_ASSERT(user_identity.length() > 0); - if (filename_is_reserved(user_identity)) { - throw std::invalid_argument("A user can't have an identifier reserved by the filesystem."); - } - auto user_path = file_path_by_appending_component(get_base_sync_directory(), - user_identity, - util::FilePathType::Directory); - util::remove_nonempty_dir(user_path); -} - -bool SyncFileManager::remove_realm(const std::string& absolute_path) const -{ - REALM_ASSERT(absolute_path.length() > 0); - bool success = true; - // Remove the Realm file (e.g. "example.realm"). - success = File::try_remove(absolute_path); - // Remove the lock file (e.g. "example.realm.lock"). - auto lock_path = util::file_path_by_appending_extension(absolute_path, "lock"); - success = File::try_remove(lock_path); - // Remove the management directory (e.g. "example.realm.management"). - auto management_path = util::file_path_by_appending_extension(absolute_path, "management"); - try { - util::remove_nonempty_dir(management_path); - } - catch (File::NotFound const&) { - } - catch (File::AccessError const&) { - success = false; - } - return success; -} - -bool SyncFileManager::copy_realm_file(const std::string& old_path, const std::string& new_path) const -{ - REALM_ASSERT(old_path.length() > 0); - try { - if (File::exists(new_path)) { - return false; - } - File::copy(old_path, new_path); - } - catch (File::NotFound const&) { - return false; - } - catch (File::AccessError const&) { - return false; - } - return true; -} - -bool SyncFileManager::remove_realm(const std::string& user_identity, const std::string& raw_realm_path) const -{ - REALM_ASSERT(user_identity.length() > 0); - REALM_ASSERT(raw_realm_path.length() > 0); - if (filename_is_reserved(user_identity) || filename_is_reserved(raw_realm_path)) { - throw std::invalid_argument("A user or Realm can't have an identifier reserved by the filesystem."); - } - auto escaped = util::make_percent_encoded_string(raw_realm_path); - auto realm_path = util::file_path_by_appending_component(user_directory(user_identity), escaped); - return remove_realm(realm_path); -} - -std::string SyncFileManager::path(const std::string& user_identity, const std::string& raw_realm_path) const -{ - REALM_ASSERT(user_identity.length() > 0); - REALM_ASSERT(raw_realm_path.length() > 0); - if (filename_is_reserved(user_identity) || filename_is_reserved(raw_realm_path)) { - throw std::invalid_argument("A user or Realm can't have an identifier reserved by the filesystem."); - } - auto escaped = util::make_percent_encoded_string(raw_realm_path); - auto realm_path = util::file_path_by_appending_component(user_directory(user_identity), escaped); - return realm_path; -} - -std::string SyncFileManager::metadata_path() const -{ - auto dir_path = file_path_by_appending_component(get_utility_directory(), - c_metadata_directory, - util::FilePathType::Directory); - util::try_make_dir(dir_path); - return util::file_path_by_appending_component(dir_path, c_metadata_realm); -} - -bool SyncFileManager::remove_metadata_realm() const -{ - auto dir_path = file_path_by_appending_component(get_utility_directory(), - c_metadata_directory, - util::FilePathType::Directory); - try { - util::remove_nonempty_dir(dir_path); - return true; - } - catch (File::AccessError const&) { - return false; - } -} - -} // realm diff --git a/Pods/Realm/Realm/ObjectStore/src/sync/impl/sync_metadata.cpp b/Pods/Realm/Realm/ObjectStore/src/sync/impl/sync_metadata.cpp deleted file mode 100644 index 9a82cc5f..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/sync/impl/sync_metadata.cpp +++ /dev/null @@ -1,355 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "sync/impl/sync_metadata.hpp" - -#include "object_schema.hpp" -#include "object_store.hpp" -#include "property.hpp" -#include "results.hpp" -#include "schema.hpp" -#if REALM_PLATFORM_APPLE -#include "impl/apple/keychain_helper.hpp" -#endif - -#include -#include - -namespace realm { - -static const char * const c_sync_userMetadata = "UserMetadata"; -static const char * const c_sync_marked_for_removal = "marked_for_removal"; -static const char * const c_sync_identity = "identity"; -static const char * const c_sync_auth_server_url = "auth_server_url"; -static const char * const c_sync_user_token = "user_token"; - -static const char * const c_sync_fileActionMetadata = "FileActionMetadata"; -static const char * const c_sync_original_name = "original_name"; -static const char * const c_sync_new_name = "new_name"; -static const char * const c_sync_action = "action"; -static const char * const c_sync_url = "url"; - - -SyncMetadataManager::SyncMetadataManager(std::string path, - bool should_encrypt, - util::Optional> encryption_key) -{ - std::lock_guard lock(m_metadata_lock); - - auto make_nullable_string_property = [](const char *name) -> Property { - Property p = {name, PropertyType::String}; - p.is_nullable = true; - return p; - }; - - auto make_primary_key_property = [](const char *name) -> Property { - Property p = {name, PropertyType::String}; - p.is_indexed = true; - p.is_primary = true; - return p; - }; - - Realm::Config config; - config.path = std::move(path); - config.schema = Schema{ - {c_sync_userMetadata, { - make_primary_key_property(c_sync_identity), - {c_sync_marked_for_removal, PropertyType::Bool}, - make_nullable_string_property(c_sync_auth_server_url), - make_nullable_string_property(c_sync_user_token), - }}, - {c_sync_fileActionMetadata, { - make_primary_key_property(c_sync_original_name), - {c_sync_action, PropertyType::Int}, - make_nullable_string_property(c_sync_new_name), - {c_sync_url, PropertyType::String}, - {c_sync_identity, PropertyType::String}, - }}, - }; - config.schema_mode = SchemaMode::Additive; - config.schema_version = 0; -#if REALM_PLATFORM_APPLE - if (should_encrypt && !encryption_key) { - encryption_key = keychain::metadata_realm_encryption_key(); - } -#endif - if (should_encrypt) { - if (!encryption_key) { - throw std::invalid_argument("Metadata Realm encryption was specified, but no encryption key was provided."); - } - config.encryption_key = std::move(*encryption_key); - } - - // Open the Realm. - SharedRealm realm = Realm::get_shared_realm(config); - - // Get data about the (hardcoded) schemas. - DescriptorRef descriptor = ObjectStore::table_for_object_type(realm->read_group(), - c_sync_userMetadata)->get_descriptor(); - m_user_schema = { - descriptor->get_column_index(c_sync_identity), - descriptor->get_column_index(c_sync_marked_for_removal), - descriptor->get_column_index(c_sync_user_token), - descriptor->get_column_index(c_sync_auth_server_url) - }; - - descriptor = ObjectStore::table_for_object_type(realm->read_group(), c_sync_fileActionMetadata)->get_descriptor(); - m_file_action_schema = { - descriptor->get_column_index(c_sync_original_name), - descriptor->get_column_index(c_sync_new_name), - descriptor->get_column_index(c_sync_action), - descriptor->get_column_index(c_sync_url), - descriptor->get_column_index(c_sync_identity) - }; - - m_metadata_config = std::move(config); -} - -Realm::Config SyncMetadataManager::get_configuration() const -{ - std::lock_guard lock(m_metadata_lock); - return m_metadata_config; -} - -SyncUserMetadataResults SyncMetadataManager::all_unmarked_users() const -{ - return get_users(false); -} - -SyncUserMetadataResults SyncMetadataManager::all_users_marked_for_removal() const -{ - return get_users(true); -} - -SyncUserMetadataResults SyncMetadataManager::get_users(bool marked) const -{ - // Open the Realm. - SharedRealm realm = Realm::get_shared_realm(get_configuration()); - - TableRef table = ObjectStore::table_for_object_type(realm->read_group(), c_sync_userMetadata); - Query query = table->where().equal(m_user_schema.idx_marked_for_removal, marked); - - Results results(realm, std::move(query)); - return SyncUserMetadataResults(std::move(results), std::move(realm), m_user_schema); -} - -SyncFileActionMetadataResults SyncMetadataManager::all_pending_actions() const -{ - SharedRealm realm = Realm::get_shared_realm(get_configuration()); - TableRef table = ObjectStore::table_for_object_type(realm->read_group(), c_sync_fileActionMetadata); - Results results(realm, table->where()); - return SyncFileActionMetadataResults(std::move(results), std::move(realm), m_file_action_schema); -} - -SyncUserMetadata::SyncUserMetadata(Schema schema, SharedRealm realm, RowExpr row) -: m_invalid(row.get_bool(schema.idx_marked_for_removal)) -, m_schema(std::move(schema)) -, m_realm(std::move(realm)) -, m_row(row) -{ } - -SyncUserMetadata::SyncUserMetadata(const SyncMetadataManager& manager, std::string identity, bool make_if_absent) -: m_schema(manager.m_user_schema) -{ - // Open the Realm. - m_realm = Realm::get_shared_realm(manager.get_configuration()); - - // Retrieve or create the row for this object. - TableRef table = ObjectStore::table_for_object_type(m_realm->read_group(), c_sync_userMetadata); - size_t row_idx = table->find_first_string(m_schema.idx_identity, identity); - if (row_idx == not_found) { - if (!make_if_absent) { - m_invalid = true; - m_realm = nullptr; - return; - } - m_realm->begin_transaction(); - row_idx = table->find_first_string(m_schema.idx_identity, identity); - if (row_idx == not_found) { - row_idx = table->add_empty_row(); - table->set_string(m_schema.idx_identity, row_idx, identity); - m_realm->commit_transaction(); - } else { - // Someone beat us to adding this user. - m_realm->cancel_transaction(); - } - } - m_row = table->get(row_idx); - if (make_if_absent) { - // User existed in the table, but had been marked for deletion. Unmark it. - m_realm->begin_transaction(); - table->set_bool(m_schema.idx_marked_for_removal, row_idx, false); - m_realm->commit_transaction(); - m_invalid = false; - } else { - m_invalid = m_row.get_bool(m_schema.idx_marked_for_removal); - } -} - -bool SyncUserMetadata::is_valid() const -{ - return !m_invalid; -} - -std::string SyncUserMetadata::identity() const -{ - m_realm->verify_thread(); - StringData result = m_row.get_string(m_schema.idx_identity); - return result; -} - -util::Optional SyncUserMetadata::get_optional_string_field(size_t col_idx) const -{ - REALM_ASSERT(!m_invalid); - m_realm->verify_thread(); - StringData result = m_row.get_string(col_idx); - return result.is_null() ? util::none : util::make_optional(std::string(result)); -} - -util::Optional SyncUserMetadata::server_url() const -{ - return get_optional_string_field(m_schema.idx_auth_server_url); -} - -util::Optional SyncUserMetadata::user_token() const -{ - return get_optional_string_field(m_schema.idx_user_token); -} - -void SyncUserMetadata::set_state(util::Optional server_url, util::Optional user_token) -{ - if (m_invalid) { - return; - } - m_realm->verify_thread(); - m_realm->begin_transaction(); - m_row.set_string(m_schema.idx_user_token, *user_token); - m_row.set_string(m_schema.idx_auth_server_url, *server_url); - m_realm->commit_transaction(); -} - -void SyncUserMetadata::mark_for_removal() -{ - if (m_invalid) { - return; - } - m_realm->verify_thread(); - m_realm->begin_transaction(); - m_row.set_bool(m_schema.idx_marked_for_removal, true); - m_realm->commit_transaction(); -} - -void SyncUserMetadata::remove() -{ - m_invalid = true; - m_realm->begin_transaction(); - TableRef table = ObjectStore::table_for_object_type(m_realm->read_group(), c_sync_userMetadata); - table->move_last_over(m_row.get_index()); - m_realm->commit_transaction(); - m_realm = nullptr; -} - -util::Optional SyncFileActionMetadata::metadata_for_path(const std::string& original_name, const SyncMetadataManager& manager) -{ - auto realm = Realm::get_shared_realm(manager.get_configuration()); - auto schema = manager.m_file_action_schema; - TableRef table = ObjectStore::table_for_object_type(realm->read_group(), c_sync_fileActionMetadata); - size_t row_idx = table->find_first_string(schema.idx_original_name, original_name); - if (row_idx == not_found) { - return none; - } - return SyncFileActionMetadata(std::move(schema), std::move(realm), table->get(row_idx)); -} - -SyncFileActionMetadata::SyncFileActionMetadata(const SyncMetadataManager& manager, - Action action, - const std::string& original_name, - const std::string& url, - const std::string& user_identity, - util::Optional new_name) -: m_schema(manager.m_file_action_schema) -{ - size_t raw_action = static_cast(action); - - // Open the Realm. - m_realm = Realm::get_shared_realm(manager.get_configuration()); - - // Retrieve or create the row for this object. - TableRef table = ObjectStore::table_for_object_type(m_realm->read_group(), c_sync_fileActionMetadata); - m_realm->begin_transaction(); - size_t row_idx = table->find_first_string(m_schema.idx_original_name, original_name); - if (row_idx == not_found) { - row_idx = table->add_empty_row(); - table->set_string(m_schema.idx_original_name, row_idx, original_name); - } - table->set_string(m_schema.idx_new_name, row_idx, new_name); - table->set_int(m_schema.idx_action, row_idx, raw_action); - table->set_string(m_schema.idx_url, row_idx, url); - table->set_string(m_schema.idx_user_identity, row_idx, user_identity); - m_realm->commit_transaction(); - m_row = table->get(row_idx); -} - -SyncFileActionMetadata::SyncFileActionMetadata(Schema schema, SharedRealm realm, RowExpr row) -: m_schema(std::move(schema)) -, m_realm(std::move(realm)) -, m_row(row) -{ } - -std::string SyncFileActionMetadata::original_name() const -{ - m_realm->verify_thread(); - return m_row.get_string(m_schema.idx_original_name); -} - -util::Optional SyncFileActionMetadata::new_name() const -{ - m_realm->verify_thread(); - StringData result = m_row.get_string(m_schema.idx_new_name); - return result.is_null() ? util::none : util::make_optional(std::string(result)); -} - -SyncFileActionMetadata::Action SyncFileActionMetadata::action() const -{ - m_realm->verify_thread(); - return static_cast(m_row.get_int(m_schema.idx_action)); -} - -std::string SyncFileActionMetadata::url() const -{ - m_realm->verify_thread(); - return m_row.get_string(m_schema.idx_url); -} - -std::string SyncFileActionMetadata::user_identity() const -{ - m_realm->verify_thread(); - return m_row.get_string(m_schema.idx_user_identity); -} - -void SyncFileActionMetadata::remove() -{ - m_realm->verify_thread(); - m_realm->begin_transaction(); - TableRef table = ObjectStore::table_for_object_type(m_realm->read_group(), c_sync_fileActionMetadata); - table->move_last_over(m_row.get_index()); - m_realm->commit_transaction(); - m_realm = nullptr; -} - -} diff --git a/Pods/Realm/Realm/ObjectStore/src/sync/sync_manager.cpp b/Pods/Realm/Realm/ObjectStore/src/sync/sync_manager.cpp deleted file mode 100644 index 75bc25c8..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/sync/sync_manager.cpp +++ /dev/null @@ -1,479 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "sync/sync_manager.hpp" - -#include "sync/impl/sync_client.hpp" -#include "sync/impl/sync_file.hpp" -#include "sync/impl/sync_metadata.hpp" -#include "sync/sync_session.hpp" -#include "sync/sync_user.hpp" - -#include - -using namespace realm; -using namespace realm::_impl; - -SyncManager& SyncManager::shared() -{ - // The singleton is heap-allocated in order to fix an issue when running unit tests where tests would crash after - // they were done running because the manager was destroyed too early. - static SyncManager& manager = *new SyncManager; - return manager; -} - -void SyncManager::configure_file_system(const std::string& base_file_path, - MetadataMode metadata_mode, - util::Optional> custom_encryption_key, - bool reset_metadata_on_error) -{ - struct UserCreationData { - std::string identity; - std::string user_token; - util::Optional server_url; - }; - - std::vector users_to_add; - { - std::lock_guard lock(m_file_system_mutex); - - // Set up the file manager. - if (m_file_manager) { - REALM_ASSERT(m_file_manager->base_path() == base_file_path); - } else { - m_file_manager = std::make_unique(base_file_path); - } - - // Set up the metadata manager, and perform initial loading/purging work. - if (m_metadata_manager) { - return; - } - switch (metadata_mode) { - case MetadataMode::NoEncryption: - m_metadata_manager = std::make_unique(m_file_manager->metadata_path(), - false); - break; - case MetadataMode::Encryption: - try { - m_metadata_manager = std::make_unique(m_file_manager->metadata_path(), - true, - std::move(custom_encryption_key)); - } catch (RealmFileException const& ex) { - if (reset_metadata_on_error && m_file_manager->remove_metadata_realm()) { - m_metadata_manager = std::make_unique(m_file_manager->metadata_path(), - true, - std::move(custom_encryption_key)); - } else { - throw; - } - } - break; - case MetadataMode::NoMetadata: - return; - } - - REALM_ASSERT(m_metadata_manager); - // Perform any necessary file actions. - std::vector completed_actions; - SyncFileActionMetadataResults file_actions = m_metadata_manager->all_pending_actions(); - for (size_t i = 0; i < file_actions.size(); i++) { - auto file_action = file_actions.get(i); - if (run_file_action(file_action)) { - completed_actions.emplace_back(std::move(file_action)); - } - } - for (auto& action : completed_actions) { - action.remove(); - } - // Load persisted users into the users map. - SyncUserMetadataResults users = m_metadata_manager->all_unmarked_users(); - for (size_t i = 0; i < users.size(); i++) { - // Note that 'admin' style users are not persisted. - auto user_data = users.get(i); - auto user_token = user_data.user_token(); - auto identity = user_data.identity(); - auto server_url = user_data.server_url(); - if (user_token) { - UserCreationData data = { std::move(identity), std::move(*user_token), std::move(server_url) }; - users_to_add.emplace_back(std::move(data)); - } - } - // Delete any users marked for death. - std::vector dead_users; - SyncUserMetadataResults users_to_remove = m_metadata_manager->all_users_marked_for_removal(); - dead_users.reserve(users_to_remove.size()); - for (size_t i = 0; i < users_to_remove.size(); i++) { - auto user = users_to_remove.get(i); - // FIXME: delete user data in a different way? (This deletes a logged-out user's data as soon as the app - // launches again, which might not be how some apps want to treat their data.) - try { - m_file_manager->remove_user_directory(user.identity()); - dead_users.emplace_back(std::move(user)); - } catch (util::File::AccessError const&) { - continue; - } - } - for (auto& user : dead_users) { - user.remove(); - } - } - { - std::lock_guard lock(m_user_mutex); - for (auto& user_data : users_to_add) { - m_users.insert({ user_data.identity, std::make_shared(user_data.user_token, - user_data.identity, - user_data.server_url) }); - } - } -} - -bool SyncManager::immediately_run_file_actions(const std::string& realm_path) -{ - if (!m_metadata_manager) { - return false; - } - auto metadata = SyncFileActionMetadata::metadata_for_path(realm_path, *m_metadata_manager); - if (!metadata) { - return false; - } - if (run_file_action(*metadata)) { - metadata->remove(); - return true; - } - return false; -} - -// Perform a file action. Returns whether or not the file action can be removed. -bool SyncManager::run_file_action(const SyncFileActionMetadata& md) -{ - switch (md.action()) { - case SyncFileActionMetadata::Action::DeleteRealm: - // Delete all the files for the given Realm. - m_file_manager->remove_realm(md.original_name()); - return true; - case SyncFileActionMetadata::Action::HandleRealmForClientReset: - // Copy the primary Realm file to the recovery dir, and then delete the Realm. - auto new_name = md.new_name(); - auto original_name = md.original_name(); - if (!util::File::exists(original_name)) { - // The Realm file doesn't exist anymore. - return true; - } - if (new_name && !util::File::exists(*new_name) && m_file_manager->copy_realm_file(original_name, *new_name)) { - // We successfully copied the Realm file to the recovery directory. - m_file_manager->remove_realm(original_name); - return true; - } - return false; - } - return false; -} - -void SyncManager::reset_for_testing() -{ - std::lock_guard lock(m_file_system_mutex); - m_file_manager = nullptr; - m_metadata_manager = nullptr; - { - // Destroy all the users. - std::lock_guard lock(m_user_mutex); - m_users.clear(); - } - { - std::lock_guard lock(m_mutex); - - // Stop the client. This will abort any uploads that inactive sessions are waiting for. - if (m_sync_client) - m_sync_client->stop(); - - { - std::lock_guard lock(m_session_mutex); - -#if REALM_ASSERTIONS_ENABLED - // Callers of `SyncManager::reset_for_testing` should ensure there are no active sessions - // prior to calling `reset_for_testing`. - auto no_active_sessions = std::all_of(m_active_sessions.begin(), m_active_sessions.end(), [](auto& element){ - return element.second.expired(); - }); - REALM_ASSERT(no_active_sessions); -#endif - - // Destroy any remaining inactive sessions. - // FIXME: We shouldn't have any inactive sessions at this point! Sessions are expected to - // remain inactive until their final upload completes, at which point they are unregistered - // and destroyed. Our call to `sync::Client::stop` above aborts all uploads, so all sessions - // should have already been destroyed. - m_inactive_sessions.clear(); - } - - // Destroy the client now that we have no remaining sessions. - m_sync_client = nullptr; - - // Reset even more state. - // NOTE: these should always match the defaults. - m_log_level = util::Logger::Level::info; - m_logger_factory = nullptr; - m_client_reconnect_mode = ReconnectMode::normal; - m_client_validate_ssl = true; - } -} - -void SyncManager::set_log_level(util::Logger::Level level) noexcept -{ - std::lock_guard lock(m_mutex); - m_log_level = level; -} - -void SyncManager::set_logger_factory(SyncLoggerFactory& factory) noexcept -{ - std::lock_guard lock(m_mutex); - m_logger_factory = &factory; -} - -void SyncManager::set_client_should_reconnect_immediately(bool reconnect_immediately) -{ - std::lock_guard lock(m_mutex); - m_client_reconnect_mode = reconnect_immediately ? ReconnectMode::immediate : ReconnectMode::normal; -} - -bool SyncManager::client_should_reconnect_immediately() const noexcept -{ - std::lock_guard lock(m_mutex); - return m_client_reconnect_mode == ReconnectMode::immediate; -} - -void SyncManager::set_client_should_validate_ssl(bool validate_ssl) -{ - std::lock_guard lock(m_mutex); - m_client_validate_ssl = validate_ssl; -} - -bool SyncManager::client_should_validate_ssl() const noexcept -{ - std::lock_guard lock(m_mutex); - return m_client_validate_ssl; -} - -util::Logger::Level SyncManager::log_level() const noexcept -{ - std::lock_guard lock(m_mutex); - return m_log_level; -} - -bool SyncManager::perform_metadata_update(std::function update_function) const -{ - std::lock_guard lock(m_file_system_mutex); - if (!m_metadata_manager) { - return false; - } - update_function(*m_metadata_manager); - return true; -} - -std::shared_ptr SyncManager::get_user(const std::string& identity, - std::string refresh_token, - util::Optional auth_server_url, - bool is_admin) -{ - std::lock_guard lock(m_user_mutex); - auto it = m_users.find(identity); - if (it == m_users.end()) { - // No existing user. - auto new_user = std::make_shared(std::move(refresh_token), identity, auth_server_url, is_admin); - m_users.insert({ identity, new_user }); - return new_user; - } else { - auto user = it->second; - if (auth_server_url && *auth_server_url != user->server_url()) { - throw std::invalid_argument("Cannot retrieve an existing user specifying a different auth server."); - } - if (is_admin != user->is_admin()) { - throw std::invalid_argument("Cannot retrieve an existing user with a different admin status."); - } - if (user->state() == SyncUser::State::Error) { - return nullptr; - } - user->update_refresh_token(std::move(refresh_token)); - return user; - } -} - -std::shared_ptr SyncManager::get_existing_logged_in_user(const std::string& identity) const -{ - std::lock_guard lock(m_user_mutex); - auto it = m_users.find(identity); - if (it == m_users.end()) { - return nullptr; - } - auto ptr = it->second; - return (ptr->state() == SyncUser::State::Active ? ptr : nullptr); -} - -std::vector> SyncManager::all_logged_in_users() const -{ - std::lock_guard lock(m_user_mutex); - std::vector> users; - users.reserve(m_users.size()); - for (auto& it : m_users) { - auto user = it.second; - if (user->state() == SyncUser::State::Active) { - users.emplace_back(std::move(user)); - } - } - return users; -} - -std::shared_ptr SyncManager::get_current_user() const -{ - std::lock_guard lock(m_user_mutex); - - auto is_active_user = [](auto& el) { return el.second->state() == SyncUser::State::Active; }; - auto it = std::find_if(m_users.begin(), m_users.end(), is_active_user); - if (it == m_users.end()) { - return nullptr; - } - if (std::find_if(std::next(it), m_users.end(), is_active_user) != m_users.end()) { - throw std::logic_error("Current user is not valid if more that one valid, logged-in user exists."); - } - return it->second; -} - -std::string SyncManager::path_for_realm(const std::string& user_identity, const std::string& raw_realm_url) const -{ - std::lock_guard lock(m_file_system_mutex); - REALM_ASSERT(m_file_manager); - return m_file_manager->path(user_identity, raw_realm_url); -} - -std::string SyncManager::recovery_directory_path() const -{ - std::lock_guard lock(m_file_system_mutex); - REALM_ASSERT(m_file_manager); - return m_file_manager->recovery_directory_path(); -} - -std::shared_ptr SyncManager::get_existing_active_session(const std::string& path) const -{ - std::lock_guard lock(m_session_mutex); - return get_existing_active_session_locked(path); -} - -std::shared_ptr SyncManager::get_existing_active_session_locked(const std::string& path) const -{ - REALM_ASSERT(!m_session_mutex.try_lock()); - auto it = m_active_sessions.find(path); - if (it == m_active_sessions.end()) { - return nullptr; - } - if (auto session = it->second.lock()) { - return session; - } - return nullptr; -} - -std::unique_ptr SyncManager::get_existing_inactive_session_locked(const std::string& path) -{ - REALM_ASSERT(!m_session_mutex.try_lock()); - auto it = m_inactive_sessions.find(path); - if (it == m_inactive_sessions.end()) { - return nullptr; - } - auto ret = std::move(it->second); - m_inactive_sessions.erase(it); - return ret; -} - -std::shared_ptr SyncManager::get_session(const std::string& path, const SyncConfig& sync_config) -{ - auto& client = get_sync_client(); // Throws - - // The session is declared outside the scope of the lock so that if an exception is thrown - // it'll be destroyed after the lock has been dropped. This avoids deadlocking when - // dropped_last_reference_to_session attempts to lock the mutex. - std::shared_ptr shared_session; - - std::lock_guard lock(m_session_mutex); - if (auto session = get_existing_active_session_locked(path)) { - return session; - } - - std::unique_ptr session = get_existing_inactive_session_locked(path); - bool session_is_new = false; - if (!session) { - session_is_new = true; - session.reset(new SyncSession(client, path, sync_config)); - } - - auto session_deleter = [this](SyncSession *session) { dropped_last_reference_to_session(session); }; - shared_session = std::shared_ptr(session.release(), std::move(session_deleter)); - m_active_sessions[path] = shared_session; - if (session_is_new) { - sync_config.user->register_session(shared_session); - } else { - SyncSession::revive_if_needed(shared_session); - } - return shared_session; -} - -void SyncManager::dropped_last_reference_to_session(SyncSession* session) -{ - { - std::lock_guard lock(m_session_mutex); - auto path = session->path(); - REALM_ASSERT_DEBUG(m_active_sessions.count(path)); - m_active_sessions.erase(path); - m_inactive_sessions[path].reset(session); - } - session->close(); -} - -void SyncManager::unregister_session(const std::string& path) -{ - std::lock_guard lock(m_session_mutex); - if (m_active_sessions.count(path)) - return; - auto it = m_inactive_sessions.find(path); - REALM_ASSERT(it != m_inactive_sessions.end()); - m_inactive_sessions.erase(path); -} - -SyncClient& SyncManager::get_sync_client() const -{ - std::lock_guard lock(m_mutex); - if (!m_sync_client) - m_sync_client = create_sync_client(); // Throws - return *m_sync_client; -} - -std::unique_ptr SyncManager::create_sync_client() const -{ - REALM_ASSERT(!m_mutex.try_lock()); - - std::unique_ptr logger; - if (m_logger_factory) { - logger = m_logger_factory->make_logger(m_log_level); // Throws - } - else { - auto stderr_logger = std::make_unique(); // Throws - stderr_logger->set_level_threshold(m_log_level); - logger = std::move(stderr_logger); - } - return std::make_unique(std::move(logger), - m_client_reconnect_mode, - m_client_validate_ssl); -} diff --git a/Pods/Realm/Realm/ObjectStore/src/sync/sync_session.cpp b/Pods/Realm/Realm/ObjectStore/src/sync/sync_session.cpp deleted file mode 100644 index 9ff0df1d..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/sync/sync_session.cpp +++ /dev/null @@ -1,686 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "sync/sync_session.hpp" - -#include "sync/impl/sync_client.hpp" -#include "sync/impl/sync_file.hpp" -#include "sync/impl/sync_metadata.hpp" -#include "sync/sync_manager.hpp" -#include "sync/sync_user.hpp" - -#include -#include - - -using namespace realm; -using namespace realm::_impl; -using namespace realm::_impl::sync_session_states; - -constexpr const char SyncError::c_original_file_path_key[]; -constexpr const char SyncError::c_recovery_file_path_key[]; - -/// A state which a `SyncSession` can currently be within. State classes handle various actions -/// and state transitions. -/// -/// STATES: -/// -/// WAITING_FOR_ACCESS_TOKEN: upon entering this state, the binding is informed -/// that the session wants an access token. The session is now waiting for the -/// binding to provide the token. -/// From: INACTIVE -/// To: -/// * ACTIVE: when the binding successfully refreshes the token -/// * INACTIVE: if asked to log out, or if asked to close and the stop policy -/// is Immediate. -/// * DYING: if asked to close and the stop policy is AfterChangesUploaded -/// * ERROR: if a fatal error occurs -/// -/// ACTIVE: the session is connected to the Realm Object Server and is actively -/// transferring data. -/// From: WAITING_FOR_ACCESS_TOKEN, DYING -/// To: -/// * WAITING_FOR_ACCESS_TOKEN: if the session is informed (through the error -/// handler) that the token expired -/// * INACTIVE: if asked to log out, or if asked to close and the stop policy -/// is Immediate. -/// * DYING: if asked to close and the stop policy is AfterChangesUploaded -/// * ERROR: if a fatal error occurs -/// -/// DYING: the session is performing clean-up work in preparation to be destroyed. -/// From: ACTIVE -/// To: -/// * INACTIVE: when the clean-up work completes, if the session wasn't -/// revived, or if explicitly asked to log out before the -/// clean-up work begins -/// * ACTIVE: if the session is revived -/// * ERROR: if a fatal error occurs -/// -/// INACTIVE: the user owning this session has logged out, the `sync::Session` -/// owned by this session is destroyed, and the session is quiescent. -/// From: initial, WAITING_FOR_ACCESS_TOKEN, ACTIVE, DYING -/// To: -/// * WAITING_FOR_ACCESS_TOKEN: if the session is revived -/// * ERROR: if a fatal error occurs -/// -/// ERROR: a non-recoverable error has occurred, and this session is semantically -/// invalid. The binding must create a new session with a different configuration. -/// From: WAITING_FOR_ACCESS_TOKEN, ACTIVE, DYING, INACTIVE -/// To: -/// * (none, this is a terminal state) -/// -struct SyncSession::State { - virtual ~State() { } - - virtual void enter_state(std::unique_lock&, SyncSession&) const { } - - virtual void refresh_access_token(std::unique_lock&, - SyncSession&, std::string, - const util::Optional&) const { } - - virtual void bind_with_admin_token(std::unique_lock&, - SyncSession&, const std::string&, const std::string&) const { } - - /// Returns true iff the lock is still locked when the method returns. - virtual bool access_token_expired(std::unique_lock&, SyncSession&) const { return true; } - - virtual void nonsync_transact_notify(std::unique_lock&, SyncSession&, sync::Session::version_type) const { } - - virtual bool revive_if_needed(std::unique_lock&, SyncSession&) const { return false; } - - virtual void log_out(std::unique_lock&, SyncSession&) const { } - - virtual void close_if_connecting(std::unique_lock&, SyncSession&) const { } - - virtual void close(std::unique_lock&, SyncSession&) const { } - - static const State& waiting_for_access_token; - static const State& active; - static const State& dying; - static const State& inactive; - static const State& error; -}; - -struct sync_session_states::WaitingForAccessToken : public SyncSession::State { - void enter_state(std::unique_lock&, SyncSession& session) const override - { - session.m_deferred_close = false; - } - - void refresh_access_token(std::unique_lock& lock, SyncSession& session, - std::string access_token, - const util::Optional& server_url) const override - { - // Since the sync session was previously unbound, it's safe to do this from the - // calling thread. - if (!session.m_server_url) { - session.m_server_url = server_url; - } - if (session.m_session_has_been_bound) { - session.m_session->refresh(std::move(access_token)); - } else { - session.m_session->bind(*session.m_server_url, std::move(access_token)); - session.m_session_has_been_bound = true; - } - if (session.m_deferred_commit_notification) { - session.m_session->nonsync_transact_notify(*session.m_deferred_commit_notification); - session.m_deferred_commit_notification = util::none; - } - session.advance_state(lock, active); - if (session.m_deferred_close) { - session.m_deferred_close = false; - session.m_state->close(lock, session); - } - } - - void log_out(std::unique_lock& lock, SyncSession& session) const override - { - session.advance_state(lock, inactive); - } - - void nonsync_transact_notify(std::unique_lock&, - SyncSession& session, - sync::Session::version_type version) const override - { - // Notify at first available opportunity. - session.m_deferred_commit_notification = version; - } - - void close_if_connecting(std::unique_lock& lock, SyncSession& session) const override - { - // Ignore the sync configuration's stop policy as we're not yet connected. - session.advance_state(lock, inactive); - } - - void close(std::unique_lock&, SyncSession& session) const override - { - session.m_deferred_close = true; - } -}; - -struct sync_session_states::Active : public SyncSession::State { - void refresh_access_token(std::unique_lock&, SyncSession& session, - std::string access_token, - const util::Optional&) const override - { - session.m_session->refresh(std::move(access_token)); - } - - bool access_token_expired(std::unique_lock& lock, SyncSession& session) const override - { - session.advance_state(lock, waiting_for_access_token); - std::shared_ptr session_ptr = session.shared_from_this(); - lock.unlock(); - session.m_config.bind_session_handler(session_ptr->m_realm_path, session_ptr->m_config, session_ptr); - return false; - } - - void log_out(std::unique_lock& lock, SyncSession& session) const override - { - session.advance_state(lock, inactive); - } - - void nonsync_transact_notify(std::unique_lock&, SyncSession& session, - sync::Session::version_type version) const override - { - // Fully ready sync session, notify immediately. - session.m_session->nonsync_transact_notify(version); - } - - void close(std::unique_lock& lock, SyncSession& session) const override - { - switch (session.m_config.stop_policy) { - case SyncSessionStopPolicy::Immediately: - session.advance_state(lock, inactive); - break; - case SyncSessionStopPolicy::LiveIndefinitely: - // Don't do anything; session lives forever. - break; - case SyncSessionStopPolicy::AfterChangesUploaded: - // Wait for all pending changes to upload. - session.advance_state(lock, dying); - break; - } - } -}; - -struct sync_session_states::Dying : public SyncSession::State { - void enter_state(std::unique_lock&, SyncSession& session) const override - { - size_t current_death_count = ++session.m_death_count; - session.m_session->async_wait_for_upload_completion([session=&session, current_death_count](std::error_code) { - std::unique_lock lock(session->m_state_mutex); - if (session->m_state == &State::dying && session->m_death_count == current_death_count) { - session->advance_state(lock, inactive); - } - }); - } - - bool revive_if_needed(std::unique_lock& lock, SyncSession& session) const override - { - // Revive. - session.advance_state(lock, active); - return false; - } - - void log_out(std::unique_lock& lock, SyncSession& session) const override - { - session.advance_state(lock, inactive); - } -}; - -struct sync_session_states::Inactive : public SyncSession::State { - void enter_state(std::unique_lock& lock, SyncSession& session) const override - { - session.m_session = nullptr; - session.m_server_url = util::none; - session.unregister(lock); - } - - void bind_with_admin_token(std::unique_lock& lock, SyncSession& session, - const std::string& admin_token, - const std::string& server_url) const override - { - session.create_sync_session(); - session.advance_state(lock, waiting_for_access_token); - session.m_state->refresh_access_token(lock, session, admin_token, server_url); - } - - bool revive_if_needed(std::unique_lock& lock, SyncSession& session) const override - { - // Revive. - session.create_sync_session(); - session.advance_state(lock, waiting_for_access_token); - return true; - } -}; - -struct sync_session_states::Error : public SyncSession::State { - void enter_state(std::unique_lock&, SyncSession& session) const override - { - session.m_session = nullptr; - session.m_config = { nullptr, "", SyncSessionStopPolicy::Immediately, nullptr }; - } - - // Everything else is a no-op when in the error state. -}; - - -const SyncSession::State& SyncSession::State::waiting_for_access_token = WaitingForAccessToken(); -const SyncSession::State& SyncSession::State::active = Active(); -const SyncSession::State& SyncSession::State::dying = Dying(); -const SyncSession::State& SyncSession::State::inactive = Inactive(); -const SyncSession::State& SyncSession::State::error = Error(); - - -SyncSession::SyncSession(SyncClient& client, std::string realm_path, SyncConfig config) -: m_state(&State::inactive) -, m_config(std::move(config)) -, m_realm_path(std::move(realm_path)) -, m_client(client) { } - -std::string SyncSession::get_recovery_file_path() -{ - return util::reserve_unique_file_name(SyncManager::shared().recovery_directory_path(), - util::create_timestamped_template("recovered_realm")); -} - -// This method should only be called from within the error handler callback registered upon the underlying `m_session`. -void SyncSession::handle_error(SyncError error) -{ - bool should_invalidate_session = error.is_fatal; - auto error_code = error.error_code; - - if (error_code.category() == realm::sync::protocol_error_category()) { - using ProtocolError = realm::sync::ProtocolError; - switch (static_cast(error_code.value())) { - // Connection level errors - case ProtocolError::connection_closed: - case ProtocolError::other_error: - // Not real errors, don't need to be reported to the binding. - return; - case ProtocolError::unknown_message: - case ProtocolError::bad_syntax: - case ProtocolError::limits_exceeded: - case ProtocolError::wrong_protocol_version: - case ProtocolError::bad_session_ident: - case ProtocolError::reuse_of_session_ident: - case ProtocolError::bound_in_other_session: - case ProtocolError::bad_message_order: - break; - // Session errors - case ProtocolError::session_closed: - case ProtocolError::other_session_error: - case ProtocolError::disabled_session: - // The binding doesn't need to be aware of these because they are strictly informational, and do not - // represent actual errors. - return; - case ProtocolError::token_expired: { - std::unique_lock lock(m_state_mutex); - // This isn't an error from the binding's point of view. If we're connected we'll - // simply ask the binding to log in again. - m_state->access_token_expired(lock, *this); - return; - } - case ProtocolError::bad_authentication: { - std::shared_ptr user_to_invalidate; - should_invalidate_session = false; - { - std::unique_lock lock(m_state_mutex); - user_to_invalidate = user(); - advance_state(lock, State::error); - } - if (user_to_invalidate) - user_to_invalidate->invalidate(); - break; - } - case ProtocolError::illegal_realm_path: - case ProtocolError::no_such_realm: - case ProtocolError::permission_denied: - case ProtocolError::bad_client_version: - break; - case ProtocolError::bad_server_file_ident: - case ProtocolError::bad_client_file_ident: - case ProtocolError::bad_server_version: - case ProtocolError::diverging_histories: { - // Add a SyncFileActionMetadata marking the Realm as needing to be deleted. - auto recovery_path = get_recovery_file_path(); - auto original_path = path(); - error.user_info[SyncError::c_original_file_path_key] = original_path; - error.user_info[SyncError::c_recovery_file_path_key] = recovery_path; - SyncManager::shared().perform_metadata_update([this, - original_path=std::move(original_path), - recovery_path=std::move(recovery_path)](const auto& manager) { - SyncFileActionMetadata(manager, - SyncFileActionMetadata::Action::HandleRealmForClientReset, - original_path, - m_config.realm_url, - m_config.user->identity(), - util::Optional(std::move(recovery_path))); - }); - break; - } - case ProtocolError::bad_changeset: - break; - } - } else if (error_code.category() == realm::sync::client_error_category()) { - using ClientError = realm::sync::Client::Error; - switch (static_cast(error_code.value())) { - case ClientError::connection_closed: - // Not real errors, don't need to be reported to the binding. - return; - case ClientError::unknown_message: - case ClientError::bad_syntax: - case ClientError::limits_exceeded: - case ClientError::bad_session_ident: - case ClientError::bad_message_order: - case ClientError::bad_file_ident_pair: - case ClientError::bad_progress: - case ClientError::bad_changeset_header_syntax: - case ClientError::bad_changeset_size: - case ClientError::bad_origin_file_ident: - case ClientError::bad_server_version: - case ClientError::bad_changeset: - case ClientError::bad_request_ident: - case ClientError::bad_error_code: - case ClientError::bad_compression: - // Don't do anything special for these errors. - // Future functionality may require special-case handling for existing - // errors, or newly introduced error codes. - break; - } - } else { - // Unrecognized error code; just ignore it. - return; - } - if (should_invalidate_session) { - std::unique_lock lock(m_state_mutex); - advance_state(lock, State::error); - } - if (m_error_handler) { - m_error_handler(shared_from_this(), std::move(error)); - } -} - -void SyncSession::handle_progress_update(uint64_t downloaded, uint64_t downloadable, - uint64_t uploaded, uint64_t uploadable) -{ - std::vector> invocations; - { - std::lock_guard lock(m_progress_notifier_mutex); - m_current_progress = Progress{uploadable, downloadable, uploaded, downloaded}; - - for (auto it = m_notifiers.begin(); it != m_notifiers.end();) { - auto& package = it->second; - package.update(*m_current_progress); - - bool should_delete = false; - invocations.emplace_back(package.create_invocation(*m_current_progress, should_delete)); - - it = (should_delete ? m_notifiers.erase(it) : std::next(it)); - } - } - // Run the notifiers only after we've released the lock. - for (auto& invocation : invocations) { - invocation(); - } -} - -void SyncSession::NotifierPackage::update(const Progress& current_progress) -{ - if (is_streaming || captured_transferrable) - return; - - captured_transferrable = direction == NotifierType::download ? current_progress.downloadable - : current_progress.uploadable; -} - -std::function SyncSession::NotifierPackage::create_invocation(const Progress& current_progress, bool& is_expired) const -{ - REALM_ASSERT(is_streaming || captured_transferrable); - - bool is_download = direction == NotifierType::download; - uint64_t transferred = is_download ? current_progress.downloaded : current_progress.uploaded; - uint64_t transferrable; - if (is_streaming) { - transferrable = is_download ? current_progress.downloadable : current_progress.uploadable; - } else { - transferrable = *captured_transferrable; - } - // A notifier is expired if at least as many bytes have been transferred - // as were originally considered transferrable. - is_expired = !is_streaming && transferred >= *captured_transferrable; - return [=, package=*this](){ - package.notifier(transferred, transferrable); - }; -} - -void SyncSession::create_sync_session() -{ - REALM_ASSERT(!m_session); - m_session = std::make_unique(m_client.client, m_realm_path); - - // The next time we get a token, call `bind()` instead of `refresh()`. - m_session_has_been_bound = false; - - // Configure the error handler. - std::weak_ptr weak_self = shared_from_this(); - auto wrapped_handler = [this, weak_self](std::error_code error_code, bool is_fatal, std::string message) { - auto self = weak_self.lock(); - if (!self) { - // An error was delivered after the session it relates to was destroyed. There's nothing useful - // we can do with it. - return; - } - handle_error(SyncError{error_code, std::move(message), is_fatal}); - }; - m_session->set_error_handler(std::move(wrapped_handler)); - - // Configure the sync transaction callback. - auto wrapped_callback = [this, weak_self](VersionID old_version, VersionID new_version) { - if (auto self = weak_self.lock()) { - if (m_sync_transact_callback) { - m_sync_transact_callback(old_version, new_version); - } - } - }; - m_session->set_sync_transact_callback(std::move(wrapped_callback)); - - // Set up the wrapped progress handler callback - auto wrapped_progress_handler = [this, weak_self](uint_fast64_t downloaded, uint_fast64_t downloadable, - uint_fast64_t uploaded, uint_fast64_t uploadable) { - if (auto self = weak_self.lock()) { - handle_progress_update(downloaded, downloadable, uploaded, uploadable); - } - }; - m_session->set_progress_handler(std::move(wrapped_progress_handler)); -} - -void SyncSession::set_sync_transact_callback(std::function callback) -{ - m_sync_transact_callback = std::move(callback); -} - -void SyncSession::set_error_handler(std::function handler) -{ - m_error_handler = std::move(handler); -} - -void SyncSession::advance_state(std::unique_lock& lock, const State& state) -{ - REALM_ASSERT(lock.owns_lock()); - REALM_ASSERT(&state != m_state); - m_state = &state; - m_state->enter_state(lock, *this); -} - -void SyncSession::nonsync_transact_notify(sync::Session::version_type version) -{ - std::unique_lock lock(m_state_mutex); - m_state->nonsync_transact_notify(lock, *this, version); -} - -void SyncSession::revive_if_needed(std::shared_ptr session) -{ - REALM_ASSERT(session); - util::Optional&> handler; - { - std::unique_lock lock(session->m_state_mutex); - if (session->m_state->revive_if_needed(lock, *session)) { - handler = session->m_config.bind_session_handler; - } - } - if (handler) { - handler.value()(session->m_realm_path, session->m_config, session); - } -} - -void SyncSession::log_out() -{ - std::unique_lock lock(m_state_mutex); - m_state->log_out(lock, *this); -} - -void SyncSession::close() -{ - std::unique_lock lock(m_state_mutex); - m_state->close(lock, *this); -} - -void SyncSession::close_if_connecting() -{ - std::unique_lock lock(m_state_mutex); - m_state->close_if_connecting(lock, *this); -} - -void SyncSession::unregister(std::unique_lock& lock) -{ - REALM_ASSERT(lock.owns_lock()); - REALM_ASSERT(m_state == &State::inactive); // Must stop an active session before unregistering. - - lock.unlock(); - SyncManager::shared().unregister_session(m_realm_path); -} - -bool SyncSession::can_wait_for_network_completion() const -{ - return m_state == &State::active || m_state == &State::dying; -} - -bool SyncSession::wait_for_upload_completion(std::function callback) -{ - std::unique_lock lock(m_state_mutex); - // FIXME: instead of dropping the callback if we haven't yet `bind()`ed, - // save it and register it when the session `bind()`s. - if (can_wait_for_network_completion()) { - REALM_ASSERT(m_session); - m_session->async_wait_for_upload_completion(std::move(callback)); - return true; - } - return false; -} - -bool SyncSession::wait_for_download_completion(std::function callback) -{ - std::unique_lock lock(m_state_mutex); - // FIXME: instead of dropping the callback if we haven't yet `bind()`ed, - // save it and register it when the session `bind()`s. - if (can_wait_for_network_completion()) { - REALM_ASSERT(m_session); - m_session->async_wait_for_download_completion(std::move(callback)); - return true; - } - return false; -} - -bool SyncSession::wait_for_upload_completion_blocking() -{ - std::unique_lock lock(m_state_mutex); - if (can_wait_for_network_completion()) { - REALM_ASSERT(m_session); - m_session->wait_for_upload_complete_or_client_stopped(); - return true; - } - return false; -} - -uint64_t SyncSession::register_progress_notifier(std::function notifier, - NotifierType direction, bool is_streaming) -{ - std::function invocation; - uint64_t token_value = 0; - { - std::lock_guard lock(m_progress_notifier_mutex); - token_value = m_progress_notifier_token++; - NotifierPackage package{std::move(notifier), is_streaming, direction}; - if (!m_current_progress) { - // Simply register the package, since we have no data yet. - m_notifiers.emplace(token_value, std::move(package)); - return token_value; - } - package.update(*m_current_progress); - bool skip_registration = false; - invocation = package.create_invocation(*m_current_progress, skip_registration); - if (skip_registration) { - token_value = 0; - } else { - m_notifiers.emplace(token_value, std::move(package)); - } - } - invocation(); - return token_value; -} - -void SyncSession::unregister_progress_notifier(uint64_t token) -{ - std::lock_guard lock(m_progress_notifier_mutex); - m_notifiers.erase(token); -} - -void SyncSession::refresh_access_token(std::string access_token, util::Optional server_url) -{ - std::unique_lock lock(m_state_mutex); - if (!m_server_url && !server_url) { - // The first time this method is called, the server URL must be provided. - return; - } - m_state->refresh_access_token(lock, *this, std::move(access_token), server_url); -} - -void SyncSession::bind_with_admin_token(std::string admin_token, std::string server_url) -{ - std::unique_lock lock(m_state_mutex); - m_state->bind_with_admin_token(lock, *this, admin_token, server_url); -} - -SyncSession::PublicState SyncSession::state() const -{ - std::unique_lock lock(m_state_mutex); - if (m_state == &State::waiting_for_access_token) { - return PublicState::WaitingForAccessToken; - } else if (m_state == &State::active) { - return PublicState::Active; - } else if (m_state == &State::dying) { - return PublicState::Dying; - } else if (m_state == &State::inactive) { - return PublicState::Inactive; - } else if (m_state == &State::error) { - return PublicState::Error; - } - REALM_UNREACHABLE(); -} diff --git a/Pods/Realm/Realm/ObjectStore/src/sync/sync_user.cpp b/Pods/Realm/Realm/ObjectStore/src/sync/sync_user.cpp deleted file mode 100644 index c5d8c71d..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/sync/sync_user.cpp +++ /dev/null @@ -1,195 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "sync/sync_user.hpp" - -#include "sync/impl/sync_metadata.hpp" -#include "sync/sync_manager.hpp" -#include "sync/sync_session.hpp" - -namespace realm { - -SyncUser::SyncUser(std::string refresh_token, - std::string identity, - util::Optional server_url, - bool is_admin) -: m_state(State::Active) -, m_server_url(server_url.value_or("")) -, m_is_admin(is_admin) -, m_refresh_token(std::move(refresh_token)) -, m_identity(std::move(identity)) -{ - if (!is_admin) { - SyncManager::shared().perform_metadata_update([this, server_url=std::move(server_url)](const auto& manager) { - auto metadata = SyncUserMetadata(manager, m_identity); - metadata.set_state(server_url, m_refresh_token); - }); - } -} - -std::vector> SyncUser::all_sessions() -{ - std::lock_guard lock(m_mutex); - std::vector> sessions; - if (m_state == State::Error) { - return sessions; - } - for (auto it = m_sessions.begin(); it != m_sessions.end();) { - if (auto ptr_to_session = it->second.lock()) { - if (!ptr_to_session->is_in_error_state()) { - sessions.emplace_back(std::move(ptr_to_session)); - it++; - continue; - } - } - // This session is bad, destroy it. - it = m_sessions.erase(it); - } - return sessions; -} - -std::shared_ptr SyncUser::session_for_on_disk_path(const std::string& path) -{ - std::lock_guard lock(m_mutex); - if (m_state == State::Error) { - return nullptr; - } - auto it = m_sessions.find(path); - if (it == m_sessions.end()) { - return nullptr; - } - auto locked = it->second.lock(); - if (!locked) { - // Remove the session from the map, because it has fatally errored out or the entry is invalid. - m_sessions.erase(it); - } - return locked; -} - -void SyncUser::update_refresh_token(std::string token) -{ - std::vector> sessions_to_revive; - { - std::unique_lock lock(m_mutex); - switch (m_state) { - case State::Error: - return; - case State::Active: - m_refresh_token = token; - break; - case State::LoggedOut: { - sessions_to_revive.reserve(m_waiting_sessions.size()); - m_refresh_token = token; - m_state = State::Active; - for (auto& pair : m_waiting_sessions) { - if (auto ptr = pair.second.lock()) { - m_sessions[pair.first] = ptr; - sessions_to_revive.emplace_back(std::move(ptr)); - } - } - m_waiting_sessions.clear(); - break; - } - } - // Update persistent user metadata. - if (!m_is_admin) { - SyncManager::shared().perform_metadata_update([=](const auto& manager) { - auto metadata = SyncUserMetadata(manager, m_identity); - metadata.set_state(m_server_url, token); - }); - } - } - // (Re)activate all pending sessions. - // Note that we do this after releasing the lock, since the session may - // need to access protected User state in the process of binding itself. - for (auto& session : sessions_to_revive) { - SyncSession::revive_if_needed(session); - } -} - -void SyncUser::log_out() -{ - if (m_is_admin) { - // Admin users cannot be logged out. - return; - } - std::lock_guard lock(m_mutex); - if (m_state == State::LoggedOut) { - return; - } - m_state = State::LoggedOut; - // Move all active sessions into the waiting sessions pool. If the user is - // logged back in, they will automatically be reactivated. - for (auto& pair : m_sessions) { - if (auto ptr = pair.second.lock()) { - ptr->log_out(); - m_waiting_sessions[pair.first] = ptr; - } - } - m_sessions.clear(); - // Mark the user as 'dead' in the persisted metadata Realm. - if (!m_is_admin) { - SyncManager::shared().perform_metadata_update([=](const auto& manager) { - auto metadata = SyncUserMetadata(manager, m_identity, false); - metadata.mark_for_removal(); - }); - } -} - -void SyncUser::invalidate() -{ - std::lock_guard lock(m_mutex); - m_state = State::Error; -} - -std::string SyncUser::refresh_token() const -{ - std::lock_guard lock(m_mutex); - return m_refresh_token; -} - -SyncUser::State SyncUser::state() const -{ - std::lock_guard lock(m_mutex); - return m_state; -} - -void SyncUser::register_session(std::shared_ptr session) -{ - const std::string& path = session->path(); - std::unique_lock lock(m_mutex); - switch (m_state) { - case State::Active: - // Immediately ask the session to come online. - m_sessions[path] = session; - if (m_is_admin) { - session->bind_with_admin_token(m_refresh_token, session->config().realm_url); - } else { - lock.unlock(); - SyncSession::revive_if_needed(std::move(session)); - } - break; - case State::LoggedOut: - m_waiting_sessions[path] = session; - break; - case State::Error: - break; - } -} - -} diff --git a/Pods/Realm/Realm/ObjectStore/src/thread_safe_reference.cpp b/Pods/Realm/Realm/ObjectStore/src/thread_safe_reference.cpp deleted file mode 100644 index 68b0eb5d..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/thread_safe_reference.cpp +++ /dev/null @@ -1,126 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "thread_safe_reference.hpp" - -#include "impl/realm_coordinator.hpp" -#include "list.hpp" -#include "object.hpp" -#include "object_schema.hpp" -#include "results.hpp" - -#include - -using namespace realm; - -ThreadSafeReferenceBase::ThreadSafeReferenceBase(SharedRealm source_realm) : m_source_realm(std::move(source_realm)) -{ - m_source_realm->verify_thread(); - if (m_source_realm->is_in_transaction()) { - throw InvalidTransactionException("Cannot obtain thread safe reference during a write transaction."); - } - - try { - m_version_id = get_source_shared_group().pin_version(); - } catch (...) { - invalidate(); - throw; - } -} - -ThreadSafeReferenceBase::~ThreadSafeReferenceBase() -{ - if (!is_invalidated()) - invalidate(); -} - -template -V ThreadSafeReferenceBase::invalidate_after_import(Realm& destination_realm, T construct_with_shared_group) { - destination_realm.verify_thread(); - REALM_ASSERT_DEBUG(!m_source_realm->is_in_transaction()); - REALM_ASSERT_DEBUG(!is_invalidated()); - - SharedGroup& destination_shared_group = Realm::Internal::get_shared_group(destination_realm); - auto unpin_version = util::make_scope_exit([&]() noexcept { invalidate(); }); - - return construct_with_shared_group(destination_shared_group); -} - -SharedGroup& ThreadSafeReferenceBase::get_source_shared_group() const { - return Realm::Internal::get_shared_group(*m_source_realm); -} - -bool ThreadSafeReferenceBase::has_same_config(Realm& realm) const { - return &Realm::Internal::get_coordinator(*m_source_realm) == &Realm::Internal::get_coordinator(realm); -} - -void ThreadSafeReferenceBase::invalidate() { - REALM_ASSERT_DEBUG(m_source_realm); - SharedRealm thread_local_realm = Realm::Internal::get_coordinator(*m_source_realm).get_realm(); - Realm::Internal::get_shared_group(*thread_local_realm).unpin_version(m_version_id); - m_source_realm = nullptr; -} - -ThreadSafeReference::ThreadSafeReference(List const& list) -: ThreadSafeReferenceBase(list.get_realm()) -, m_link_view(get_source_shared_group().export_linkview_for_handover(list.m_link_view)) { } - -List ThreadSafeReference::import_into_realm(SharedRealm realm) && { - return invalidate_after_import(*realm, [&](SharedGroup& shared_group) { - LinkViewRef link_view = shared_group.import_linkview_from_handover(std::move(m_link_view)); - return List(std::move(realm), std::move(link_view)); - }); -} - -ThreadSafeReference::ThreadSafeReference(Object const& object) -: ThreadSafeReferenceBase(object.realm()) -, m_row(get_source_shared_group().export_for_handover(object.row())) -, m_object_schema_name(object.get_object_schema().name) { } - -Object ThreadSafeReference::import_into_realm(SharedRealm realm) && { - return invalidate_after_import(*realm, [&](SharedGroup& shared_group) { - Row row = *shared_group.import_from_handover(std::move(m_row)); - auto object_schema = realm->schema().find(m_object_schema_name); - REALM_ASSERT_DEBUG(object_schema != realm->schema().end()); - return Object(std::move(realm), *object_schema, row); - }); -} - -ThreadSafeReference::ThreadSafeReference(Results const& results) -: ThreadSafeReferenceBase(results.get_realm()) -, m_query(get_source_shared_group().export_for_handover(results.get_query(), ConstSourcePayload::Copy)) -, m_sort_order([&]() { - SortDescriptor::HandoverPatch sort_order; - SortDescriptor::generate_patch(results.get_sort(), sort_order); - return sort_order; -}()) -, m_distinct_descriptor([&]() { - SortDescriptor::HandoverPatch distinct_descriptor; - SortDescriptor::generate_patch(results.get_distinct(), distinct_descriptor); - return distinct_descriptor; -}()){ } - -Results ThreadSafeReference::import_into_realm(SharedRealm realm) && { - return invalidate_after_import(*realm, [&](SharedGroup& shared_group) { - Query query = *shared_group.import_from_handover(std::move(m_query)); - Table& table = *query.get_table(); - SortDescriptor sort_descriptor = SortDescriptor::create_from_and_consume_patch(m_sort_order, table); - SortDescriptor distinct_descriptor = SortDescriptor::create_from_and_consume_patch(m_distinct_descriptor, table); - return Results(std::move(realm), std::move(query), std::move(sort_descriptor), std::move(distinct_descriptor)); - }); -} diff --git a/Pods/Realm/Realm/ObjectStore/src/util/format.cpp b/Pods/Realm/Realm/ObjectStore/src/util/format.cpp deleted file mode 100644 index 4103c8d9..00000000 --- a/Pods/Realm/Realm/ObjectStore/src/util/format.cpp +++ /dev/null @@ -1,82 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#include "util/format.hpp" - -#include - -#include -#include - -namespace realm { namespace _impl { -Printable::Printable(StringData value) : m_type(Type::String), m_string(value.data()) { } - -void Printable::print(std::ostream& out) const -{ - switch (m_type) { - case Printable::Type::Bool: - out << (m_uint ? "true" : "false"); - break; - case Printable::Type::Uint: - out << m_uint; - break; - case Printable::Type::Int: - out << m_int; - break; - case Printable::Type::String: - out << m_string; - break; - } -} - -std::string format(const char* fmt, std::initializer_list values) -{ - std::stringstream ss; - while (*fmt) { - auto next = strchr(fmt, '%'); - - // emit the rest of the format string if there are no more percents - if (!next) { - ss << fmt; - break; - } - - // emit everything up to the next percent - ss.write(fmt, next - fmt); - ++next; - REALM_ASSERT(*next); - - // %% produces a single escaped % - if (*next == '%') { - ss << '%'; - fmt = next + 1; - continue; - } - REALM_ASSERT(isdigit(*next)); - - // The const_cast is safe because stroul does not actually modify - // the pointed-to string, but it lacks a const overload - auto index = strtoul(next, const_cast(&fmt), 10) - 1; - REALM_ASSERT(index < values.size()); - (values.begin() + index)->print(ss); - } - return ss.str(); -} - -} // namespace _impl -} // namespace realm diff --git a/Pods/Realm/Realm/RLMAccessor.mm b/Pods/Realm/Realm/RLMAccessor.mm deleted file mode 100644 index 724ccf02..00000000 --- a/Pods/Realm/Realm/RLMAccessor.mm +++ /dev/null @@ -1,801 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMAccessor.h" - -#import "RLMArray_Private.hpp" -#import "RLMListBase.h" -#import "RLMObjectSchema_Private.hpp" -#import "RLMObjectStore.h" -#import "RLMObject_Private.hpp" -#import "RLMObservation.hpp" -#import "RLMProperty_Private.h" -#import "RLMRealm_Private.hpp" -#import "RLMResults_Private.h" -#import "RLMSchema_Private.h" -#import "RLMUtil.hpp" -#import "results.hpp" -#import "property.hpp" - -#import -#import - -typedef NS_ENUM(char, RLMAccessorCode) { - RLMAccessorCodeByte, - RLMAccessorCodeShort, - RLMAccessorCodeInt, - RLMAccessorCodeLong, - RLMAccessorCodeLongLong, - RLMAccessorCodeFloat, - RLMAccessorCodeDouble, - RLMAccessorCodeBool, - RLMAccessorCodeString, - RLMAccessorCodeDate, - RLMAccessorCodeData, - RLMAccessorCodeLink, - RLMAccessorCodeArray, - RLMAccessorCodeLinkingObjects, - RLMAccessorCodeAny, - - RLMAccessorCodeIntObject, - RLMAccessorCodeFloatObject, - RLMAccessorCodeDoubleObject, - RLMAccessorCodeBoolObject, -}; - -template -static T get(__unsafe_unretained RLMObjectBase *const obj, NSUInteger index) { - RLMVerifyAttached(obj); - return obj->_row.get_table()->get(obj->_info->objectSchema->persisted_properties[index].table_column, obj->_row.get_index()); -} - -template -static NSNumber *getBoxed(__unsafe_unretained RLMObjectBase *const obj, NSUInteger index) { - RLMVerifyAttached(obj); - auto col = obj->_info->objectSchema->persisted_properties[index].table_column; - if (obj->_row.is_null(col)) { - return nil; - } - return @(obj->_row.get_table()->get(col, obj->_row.get_index())); -} - - -// long getter/setter -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, long long val, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - obj->_row.get_table()->set_int(colIndex, obj->_row.get_index(), val, setDefault); -} - -// float getter/setter -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, float val, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - obj->_row.get_table()->set_float(colIndex, obj->_row.get_index(), val, setDefault); -} - -// double getter/setter -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, double val, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - obj->_row.get_table()->set_double(colIndex, obj->_row.get_index(), val, setDefault); -} - -// bool getter/setter -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, BOOL val, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - obj->_row.get_table()->set_bool(colIndex, obj->_row.get_index(), val, setDefault); -} - -// string getter/setter -static inline NSString *RLMGetString(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex) { - return RLMStringDataToNSString(get(obj, colIndex)); -} -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, __unsafe_unretained NSString *const val, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - try { - obj->_row.get_table()->set_string(colIndex, obj->_row.get_index(), RLMStringDataWithNSString(val), setDefault); - } - catch (std::exception const& e) { - @throw RLMException(e); - } -} - -// date getter/setter -static inline NSDate *RLMGetDate(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex) { - return RLMTimestampToNSDate(get(obj, colIndex)); -} -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, __unsafe_unretained NSDate *const date, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - if (date) { - obj->_row.get_table()->set_timestamp(colIndex, obj->_row.get_index(), RLMTimestampForNSDate(date), setDefault); - } - else { - obj->_row.set_null(colIndex); - } -} - -// data getter/setter -static inline NSData *RLMGetData(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex) { - return RLMBinaryDataToNSData(get(obj, colIndex)); -} -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, __unsafe_unretained NSData *const data, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - - try { - obj->_row.get_table()->set_binary(colIndex, obj->_row.get_index(), RLMBinaryDataForNSData(data), setDefault); - } - catch (std::exception const& e) { - @throw RLMException(e); - } -} - -static inline RLMObjectBase *RLMGetLinkedObjectForValue(__unsafe_unretained RLMRealm *const realm, - __unsafe_unretained NSString *const className, - __unsafe_unretained id const value, - RLMCreationOptions creationOptions) NS_RETURNS_RETAINED; -static inline RLMObjectBase *RLMGetLinkedObjectForValue(__unsafe_unretained RLMRealm *const realm, - __unsafe_unretained NSString *const className, - __unsafe_unretained id const value, - RLMCreationOptions creationOptions) { - RLMObjectBase *link = RLMDynamicCast(value); - if (!link || ![link->_objectSchema.className isEqualToString:className]) { - // create from non-rlmobject - return RLMCreateObjectInRealmWithValue(realm, className, value, creationOptions & RLMCreationOptionsCreateOrUpdate); - } - - if (link.isInvalidated) { - @throw RLMException(@"Adding a deleted or invalidated object to a Realm is not permitted"); - } - - if (link->_realm == realm) { - return link; - } - - if (creationOptions & RLMCreationOptionsPromoteUnmanaged) { - if (!link->_realm) { - RLMAddObjectToRealm(link, realm, creationOptions & RLMCreationOptionsCreateOrUpdate); - return link; - } - @throw RLMException(@"Can not add objects from a different Realm"); - } - - // copy from another realm or copy from unmanaged - return RLMCreateObjectInRealmWithValue(realm, className, link, creationOptions & RLMCreationOptionsCreateOrUpdate); -} - -// link getter/setter -static inline RLMObjectBase *RLMGetLink(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex) { - RLMVerifyAttached(obj); - auto col = obj->_info->objectSchema->persisted_properties[colIndex].table_column; - - if (obj->_row.is_null_link(col)) { - return nil; - } - NSUInteger index = obj->_row.get_link(col); - return RLMCreateObjectAccessor(obj->_realm, obj->_info->linkTargetType(colIndex), index); -} - -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, - __unsafe_unretained RLMObjectBase *const val, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - if (!val) { - obj->_row.nullify_link(colIndex); - return; - } - - RLMObjectBase *link = RLMGetLinkedObjectForValue(obj->_realm, val->_objectSchema.className, - val, RLMCreationOptionsPromoteUnmanaged); - - // make sure it is the correct type - if (link->_row.get_table() != obj->_row.get_table()->get_link_target(colIndex)) { - @throw RLMException(@"Can't set object of type '%@' to property of type '%@'", - val->_objectSchema.className, - obj->_info->propertyForTableColumn(colIndex).objectClassName); - } - obj->_row.get_table()->set_link(colIndex, obj->_row.get_index(), link->_row.get_index(), setDefault); -} - -// array getter/setter -static inline RLMArray *RLMGetArray(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex) { - RLMVerifyAttached(obj); - auto prop = obj->_info->rlmObjectSchema.properties[colIndex]; - return [[RLMArrayLinkView alloc] initWithParent:obj property:prop]; -} - -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, - __unsafe_unretained id const array, __unused bool setDefault) { - RLMVerifyInWriteTransaction(obj); - - realm::LinkViewRef linkView = obj->_row.get_linklist(colIndex); - // remove all old - // FIXME: make sure delete rules don't purge objects - linkView->clear(); - for (RLMObjectBase *link in array) { - RLMObjectBase * addedLink = RLMGetLinkedObjectForValue(obj->_realm, link->_objectSchema.className, link, RLMCreationOptionsPromoteUnmanaged); - linkView->add(addedLink->_row.get_index()); - } -} - -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, - __unsafe_unretained NSNumber *const intObject, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - - if (intObject) { - obj->_row.get_table()->set_int(colIndex, obj->_row.get_index(), intObject.longLongValue, setDefault); - } - else { - obj->_row.get_table()->set_null(colIndex, obj->_row.get_index(), setDefault); - } -} - -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, - __unsafe_unretained NSNumber *const floatObject, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - - if (floatObject) { - obj->_row.get_table()->set_float(colIndex, obj->_row.get_index(), floatObject.floatValue, setDefault); - } - else { - obj->_row.get_table()->set_null(colIndex, obj->_row.get_index(), setDefault); - } -} - -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, - __unsafe_unretained NSNumber *const doubleObject, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - - if (doubleObject) { - obj->_row.get_table()->set_double(colIndex, obj->_row.get_index(), doubleObject.doubleValue, setDefault); - } - else { - obj->_row.get_table()->set_null(colIndex, obj->_row.get_index(), setDefault); - } -} - -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger colIndex, - __unsafe_unretained NSNumber *const boolObject, bool setDefault) { - RLMVerifyInWriteTransaction(obj); - - if (boolObject) { - obj->_row.get_table()->set_bool(colIndex, obj->_row.get_index(), boolObject.boolValue, setDefault); - } - else { - obj->_row.get_table()->set_null(colIndex, obj->_row.get_index(), setDefault); - } -} - -static inline RLMLinkingObjects *RLMGetLinkingObjects(__unsafe_unretained RLMObjectBase *const obj, - __unsafe_unretained RLMProperty *const property) { - auto& objectInfo = obj->_realm->_info[property.objectClassName]; - auto linkingProperty = objectInfo.objectSchema->property_for_name(property.linkOriginPropertyName.UTF8String); - auto backlinkView = obj->_row.get_table()->get_backlink_view(obj->_row.get_index(), objectInfo.table(), linkingProperty->table_column); - realm::Results results(obj->_realm->_realm, std::move(backlinkView)); - return [RLMLinkingObjects resultsWithObjectInfo:objectInfo results:std::move(results)]; -} - -// any getter/setter -static inline id RLMGetAnyProperty(__unsafe_unretained RLMObjectBase *const obj, NSUInteger col_ndx) { - RLMVerifyAttached(obj); - return RLMMixedToObjc(obj->_row.get_mixed(col_ndx)); -} -static inline void RLMSetValue(__unsafe_unretained RLMObjectBase *const obj, NSUInteger, __unsafe_unretained id, bool) { - RLMVerifyInWriteTransaction(obj); - @throw RLMException(@"Modifying Mixed properties is not supported"); -} - -// dynamic getter with column closure -static IMP RLMAccessorGetter(RLMProperty *prop, RLMAccessorCode accessorCode) { - NSUInteger index = prop.index; - switch (accessorCode) { - case RLMAccessorCodeByte: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return (char)get(obj, index); - }); - case RLMAccessorCodeShort: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return (short)get(obj, index); - }); - case RLMAccessorCodeInt: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return (int)get(obj, index); - }); - case RLMAccessorCodeLongLong: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return get(obj, index); - }); - case RLMAccessorCodeLong: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return (long)get(obj, index); - }); - case RLMAccessorCodeFloat: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return get(obj, index); - }); - case RLMAccessorCodeDouble: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return get(obj, index); - }); - case RLMAccessorCodeBool: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return get(obj, index); - }); - case RLMAccessorCodeString: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return RLMGetString(obj, index); - }); - case RLMAccessorCodeDate: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return RLMGetDate(obj, index); - }); - case RLMAccessorCodeData: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return RLMGetData(obj, index); - }); - case RLMAccessorCodeLink: - return imp_implementationWithBlock(^id(__unsafe_unretained RLMObjectBase *const obj) { - return RLMGetLink(obj, index); - }); - case RLMAccessorCodeArray: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return RLMGetArray(obj, index); - }); - case RLMAccessorCodeAny: - @throw RLMException(@"Cannot create accessor class for schema with Mixed properties"); - case RLMAccessorCodeIntObject: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return getBoxed(obj, index); - }); - case RLMAccessorCodeFloatObject: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return getBoxed(obj, index); - }); - case RLMAccessorCodeDoubleObject: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return getBoxed(obj, index); - }); - case RLMAccessorCodeBoolObject: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return getBoxed(obj, index); - }); - case RLMAccessorCodeLinkingObjects: - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj) { - return RLMGetLinkingObjects(obj, prop); - }); - } -} - -template -static void RLMWrapSetter(__unsafe_unretained RLMObjectBase *const obj, __unsafe_unretained NSString *const name, Function&& f) { - if (RLMObservationInfo *info = RLMGetObservationInfo(obj->_observationInfo, obj->_row.get_index(), *obj->_info)) { - info->willChange(name); - f(); - info->didChange(name); - } - else { - f(); - } -} - -template -static IMP RLMMakeSetter(RLMProperty *prop) { - NSUInteger index = prop.index; - NSString *name = prop.name; - if (prop.isPrimary) { - return imp_implementationWithBlock(^(__unused RLMObjectBase *obj, __unused ArgType val) { - @throw RLMException(@"Primary key can't be changed after an object is inserted."); - }); - } - return imp_implementationWithBlock(^(__unsafe_unretained RLMObjectBase *const obj, ArgType val) { - RLMWrapSetter(obj, name, [&] { - RLMSetValue(obj, obj->_info->objectSchema->persisted_properties[index].table_column, static_cast(val), false); - }); - }); -} - -// dynamic setter with column closure -static IMP RLMAccessorSetter(RLMProperty *prop, RLMAccessorCode accessorCode) { - switch (accessorCode) { - case RLMAccessorCodeByte: return RLMMakeSetter(prop); - case RLMAccessorCodeShort: return RLMMakeSetter(prop); - case RLMAccessorCodeInt: return RLMMakeSetter(prop); - case RLMAccessorCodeLong: return RLMMakeSetter(prop); - case RLMAccessorCodeLongLong: return RLMMakeSetter(prop); - case RLMAccessorCodeFloat: return RLMMakeSetter(prop); - case RLMAccessorCodeDouble: return RLMMakeSetter(prop); - case RLMAccessorCodeBool: return RLMMakeSetter(prop); - case RLMAccessorCodeString: return RLMMakeSetter(prop); - case RLMAccessorCodeDate: return RLMMakeSetter(prop); - case RLMAccessorCodeData: return RLMMakeSetter(prop); - case RLMAccessorCodeLink: return RLMMakeSetter(prop); - case RLMAccessorCodeArray: return RLMMakeSetter(prop); - case RLMAccessorCodeAny: return RLMMakeSetter(prop); - case RLMAccessorCodeIntObject: return RLMMakeSetter *>(prop); - case RLMAccessorCodeFloatObject: return RLMMakeSetter *>(prop); - case RLMAccessorCodeDoubleObject: return RLMMakeSetter *>(prop); - case RLMAccessorCodeBoolObject: return RLMMakeSetter *>(prop); - case RLMAccessorCodeLinkingObjects: return nil; - } -} - -// call getter for superclass for property at colIndex -static id RLMSuperGet(RLMObjectBase *obj, NSString *propName) { - typedef id (*getter_type)(RLMObjectBase *, SEL); - RLMProperty *prop = obj->_objectSchema[propName]; - Class superClass = class_getSuperclass(obj.class); - getter_type superGetter = (getter_type)[superClass instanceMethodForSelector:prop.getterSel]; - return superGetter(obj, prop.getterSel); -} - -// call setter for superclass for property at colIndex -static void RLMSuperSet(RLMObjectBase *obj, NSString *propName, id val) { - typedef void (*setter_type)(RLMObjectBase *, SEL, RLMArray *ar); - RLMProperty *prop = obj->_objectSchema[propName]; - Class superClass = class_getSuperclass(obj.class); - setter_type superSetter = (setter_type)[superClass instanceMethodForSelector:prop.setterSel]; - superSetter(obj, prop.setterSel, val); -} - -// getter/setter for unmanaged object -static IMP RLMAccessorUnmanagedGetter(RLMProperty *prop, RLMAccessorCode accessorCode) { - // only override getters for RLMArray and linking objects properties - if (accessorCode == RLMAccessorCodeArray) { - NSString *objectClassName = prop.objectClassName; - NSString *propName = prop.name; - - return imp_implementationWithBlock(^(RLMObjectBase *obj) { - id val = RLMSuperGet(obj, propName); - if (!val) { - val = [[RLMArray alloc] initWithObjectClassName:objectClassName]; - RLMSuperSet(obj, propName, val); - } - return val; - }); - } - else if (accessorCode == RLMAccessorCodeLinkingObjects) { - return imp_implementationWithBlock(^(RLMObjectBase *){ - return [RLMResults emptyDetachedResults]; - }); - } - return nil; -} -static IMP RLMAccessorUnmanagedSetter(RLMProperty *prop, RLMAccessorCode accessorCode) { - // only override getters for RLMArray and linking objects properties - if (accessorCode == RLMAccessorCodeArray) { - NSString *propName = prop.name; - NSString *objectClassName = prop.objectClassName; - return imp_implementationWithBlock(^(RLMObjectBase *obj, id ar) { - // make copy when setting (as is the case for all other variants) - RLMArray *unmanagedAr = [[RLMArray alloc] initWithObjectClassName:objectClassName]; - [unmanagedAr addObjects:ar]; - RLMSuperSet(obj, propName, unmanagedAr); - }); - } - return nil; -} - -// macros/helpers to generate objc type strings for registering methods -#define GETTER_TYPES(C) C "@:" -#define SETTER_TYPES(C) "v@:" C - -// getter type strings -// NOTE: this typecode is really the the first charachter of the objc/runtime.h type -// the @ type maps to multiple core types (string, date, array, mixed, any which are id in objc) -static const char *getterTypeStringForObjcCode(char code) { - switch (code) { - case 's': return GETTER_TYPES("s"); - case 'i': return GETTER_TYPES("i"); - case 'l': return GETTER_TYPES("l"); - case 'q': return GETTER_TYPES("q"); - case 'f': return GETTER_TYPES("f"); - case 'd': return GETTER_TYPES("d"); - case 'B': return GETTER_TYPES("B"); - case 'c': return GETTER_TYPES("c"); - case '@': return GETTER_TYPES("@"); - default: @throw RLMException(@"Invalid accessor code"); - } -} - -// setter type strings -// NOTE: this typecode is really the the first charachter of the objc/runtime.h type -// the @ type maps to multiple core types (string, date, array, mixed, any which are id in objc) -static const char *setterTypeStringForObjcCode(char code) { - switch (code) { - case 's': return SETTER_TYPES("s"); - case 'i': return SETTER_TYPES("i"); - case 'l': return SETTER_TYPES("l"); - case 'q': return SETTER_TYPES("q"); - case 'f': return SETTER_TYPES("f"); - case 'd': return SETTER_TYPES("d"); - case 'B': return SETTER_TYPES("B"); - case 'c': return SETTER_TYPES("c"); - case '@': return SETTER_TYPES("@"); - default: @throw RLMException(@"Invalid accessor code"); - } -} - -// get accessor lookup code based on objc type and rlm type -static RLMAccessorCode accessorCodeForType(char objcTypeCode, RLMPropertyType rlmType) { - switch (objcTypeCode) { - case 't': return RLMAccessorCodeArray; - case '@': // custom accessors for strings and subtables - switch (rlmType) { // custom accessor codes for types that map to objc objects - case RLMPropertyTypeObject: return RLMAccessorCodeLink; - case RLMPropertyTypeString: return RLMAccessorCodeString; - case RLMPropertyTypeArray: return RLMAccessorCodeArray; - case RLMPropertyTypeDate: return RLMAccessorCodeDate; - case RLMPropertyTypeData: return RLMAccessorCodeData; - case RLMPropertyTypeAny: return RLMAccessorCodeAny; - - case RLMPropertyTypeBool: return RLMAccessorCodeBoolObject; - case RLMPropertyTypeDouble: return RLMAccessorCodeDoubleObject; - case RLMPropertyTypeFloat: return RLMAccessorCodeFloatObject; - case RLMPropertyTypeInt: return RLMAccessorCodeIntObject; - - case RLMPropertyTypeLinkingObjects: return RLMAccessorCodeLinkingObjects; - } - case 'c': - switch (rlmType) { - case RLMPropertyTypeInt: return RLMAccessorCodeByte; - case RLMPropertyTypeBool: return RLMAccessorCodeBool; - default: - @throw RLMException(@"Unexpected property type for Objective-C type code"); - } - case 'B': return RLMAccessorCodeBool; - case 's': return RLMAccessorCodeShort; - case 'i': return RLMAccessorCodeInt; - case 'l': return RLMAccessorCodeLong; - case 'q': return RLMAccessorCodeLongLong; - case 'f': return RLMAccessorCodeFloat; - case 'd': return RLMAccessorCodeDouble; - default: - @throw RLMException(@"Invalid type for objc typecode"); - } -} - -// implement the class method className on accessors to return the className of the -// base object -void RLMReplaceClassNameMethod(Class accessorClass, NSString *className) { - Class metaClass = object_getClass(accessorClass); - IMP imp = imp_implementationWithBlock(^(Class){ return className; }); - class_addMethod(metaClass, @selector(className), imp, "@@:"); -} - -// implement the shared schema method -void RLMReplaceSharedSchemaMethod(Class accessorClass, RLMObjectSchema *schema) { - Class metaClass = object_getClass(accessorClass); - IMP imp = imp_implementationWithBlock(^(Class cls) { - if (cls == accessorClass) { - return schema; - } - - // If we aren't being called directly on the class this was overriden - // for, the class is either a subclass which we haven't initialized yet, - // or it's a runtime-generated class which should use the parent's - // schema. We check for the latter by checking if the immediate - // descendent of the desired class is a class generated by us (there - // may be further subclasses not generated by us for things like KVO). - Class parent = class_getSuperclass(cls); - while (parent != accessorClass) { - cls = parent; - parent = class_getSuperclass(cls); - } - if (RLMIsGeneratedClass(cls)) { - return schema; - } - - return [RLMSchema sharedSchemaForClass:cls]; - }); - class_addMethod(metaClass, @selector(sharedSchema), imp, "@@:"); -} - -static NSMutableSet *s_generatedClasses = [NSMutableSet new]; -static void RLMMarkClassAsGenerated(Class cls) { - @synchronized (s_generatedClasses) { - [s_generatedClasses addObject:cls]; - } -} - -bool RLMIsGeneratedClass(Class cls) { - @synchronized (s_generatedClasses) { - return [s_generatedClasses containsObject:cls]; - } -} - -static Class RLMCreateAccessorClass(Class objectClass, - RLMObjectSchema *schema, - NSString *accessorClassPrefix, - IMP (*getterGetter)(RLMProperty *, RLMAccessorCode), - IMP (*setterGetter)(RLMProperty *, RLMAccessorCode)) { - // throw if no schema, prefix, or object class - if (!objectClass || !schema || !accessorClassPrefix) { - @throw RLMException(@"Missing arguments"); - } - if (!RLMIsObjectOrSubclass(objectClass)) { - @throw RLMException(@"objectClass must derive from RLMObject or Object"); - } - - // create and register proxy class which derives from object class - NSString *accessorClassName = [accessorClassPrefix stringByAppendingString:schema.className]; - Class accClass = objc_getClass(accessorClassName.UTF8String); - if (!accClass) { - accClass = objc_allocateClassPair(objectClass, accessorClassName.UTF8String, 0); - objc_registerClassPair(accClass); - } - - // override getters/setters for each propery - NSArray *allProperties = [schema.properties arrayByAddingObjectsFromArray:schema.computedProperties]; - for (RLMProperty *prop in allProperties) { - RLMAccessorCode accessorCode = accessorCodeForType(prop.objcType, prop.type); - if (prop.getterSel && getterGetter) { - IMP getterImp = getterGetter(prop, accessorCode); - if (getterImp) { - class_replaceMethod(accClass, prop.getterSel, getterImp, getterTypeStringForObjcCode(prop.objcType)); - } - } - if (prop.setterSel && setterGetter) { - IMP setterImp = setterGetter(prop, accessorCode); - if (setterImp) { - class_replaceMethod(accClass, prop.setterSel, setterImp, setterTypeStringForObjcCode(prop.objcType)); - } - } - } - - RLMMarkClassAsGenerated(accClass); - - return accClass; -} - -Class RLMAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema, NSString *prefix) { - return RLMCreateAccessorClass(objectClass, schema, prefix, RLMAccessorGetter, RLMAccessorSetter); -} - -Class RLMUnmanagedAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema) { - return RLMCreateAccessorClass(objectClass, schema, @"RLMUnmanaged_", - RLMAccessorUnmanagedGetter, RLMAccessorUnmanagedSetter); -} - -void RLMDynamicValidatedSet(RLMObjectBase *obj, NSString *propName, id val) { - RLMObjectSchema *schema = obj->_objectSchema; - RLMProperty *prop = schema[propName]; - if (!prop) { - @throw RLMException(@"Invalid property name '%@' for class '%@'.", propName, obj->_objectSchema.className); - } - if (prop.isPrimary) { - @throw RLMException(@"Primary key can't be changed to '%@' after an object is inserted.", val); - } - if (!RLMIsObjectValidForProperty(val, prop)) { - @throw RLMException(@"Invalid property value '%@' for property '%@' of class '%@'", val, propName, obj->_objectSchema.className); - } - - RLMDynamicSet(obj, prop, RLMCoerceToNil(val), RLMCreationOptionsPromoteUnmanaged); -} - -// Precondition: the property is not a primary key -void RLMDynamicSet(__unsafe_unretained RLMObjectBase *const obj, __unsafe_unretained RLMProperty *const prop, - __unsafe_unretained id const val, RLMCreationOptions creationOptions) { - REALM_ASSERT_DEBUG(!prop.isPrimary); - bool setDefault = creationOptions & RLMCreationOptionsSetDefault; - - auto col = obj->_info->tableColumn(prop); - RLMWrapSetter(obj, prop.name, [&] { - switch (accessorCodeForType(prop.objcType, prop.type)) { - case RLMAccessorCodeByte: - case RLMAccessorCodeShort: - case RLMAccessorCodeInt: - case RLMAccessorCodeLong: - case RLMAccessorCodeLongLong: - RLMSetValue(obj, col, [val longLongValue], setDefault); - break; - case RLMAccessorCodeFloat: - RLMSetValue(obj, col, [val floatValue], setDefault); - break; - case RLMAccessorCodeDouble: - RLMSetValue(obj, col, [val doubleValue], setDefault); - break; - case RLMAccessorCodeBool: - RLMSetValue(obj, col, [val boolValue], setDefault); - break; - case RLMAccessorCodeIntObject: - RLMSetValue(obj, col, (NSNumber *)val, setDefault); - break; - case RLMAccessorCodeFloatObject: - RLMSetValue(obj, col, (NSNumber *)val, setDefault); - break; - case RLMAccessorCodeDoubleObject: - RLMSetValue(obj, col, (NSNumber *)val, setDefault); - break; - case RLMAccessorCodeBoolObject: - RLMSetValue(obj, col, (NSNumber *)val, setDefault); - break; - case RLMAccessorCodeString: - RLMSetValue(obj, col, (NSString *)val, setDefault); - break; - case RLMAccessorCodeDate: - RLMSetValue(obj, col, (NSDate *)val, setDefault); - break; - case RLMAccessorCodeData: - RLMSetValue(obj, col, (NSData *)val, setDefault); - break; - case RLMAccessorCodeLink: { - if (!val || val == NSNull.null) { - RLMSetValue(obj, col, (RLMObjectBase *)nil, setDefault); - } - else { - RLMSetValue(obj, col, RLMGetLinkedObjectForValue(obj->_realm, prop.objectClassName, val, creationOptions), setDefault); - } - break; - } - case RLMAccessorCodeArray: - if (!val || val == NSNull.null) { - RLMSetValue(obj, col, (id)nil, setDefault); - } - else { - id rawLinks = val; - NSMutableArray *links = [NSMutableArray array]; - for (id rawLink in rawLinks) { - [links addObject:RLMGetLinkedObjectForValue(obj->_realm, prop.objectClassName, rawLink, creationOptions)]; - } - RLMSetValue(obj, col, links, setDefault); - } - break; - case RLMAccessorCodeAny: - RLMSetValue(obj, col, val, setDefault); - break; - case RLMAccessorCodeLinkingObjects: - @throw RLMException(@"Linking objects properties are read-only"); - } - }); -} - -id RLMDynamicGet(__unsafe_unretained RLMObjectBase *const obj, __unsafe_unretained RLMProperty *const prop) { - auto index = prop.index; - switch (accessorCodeForType(prop.objcType, prop.type)) { - case RLMAccessorCodeIntObject: - case RLMAccessorCodeByte: - case RLMAccessorCodeShort: - case RLMAccessorCodeInt: - case RLMAccessorCodeLong: - case RLMAccessorCodeLongLong: return getBoxed(obj, index); - case RLMAccessorCodeFloatObject: - case RLMAccessorCodeFloat: return getBoxed(obj, index); - case RLMAccessorCodeDoubleObject: - case RLMAccessorCodeDouble: return getBoxed(obj, index); - case RLMAccessorCodeBoolObject: - case RLMAccessorCodeBool: return getBoxed(obj, index); - case RLMAccessorCodeString: return RLMGetString(obj, index); - case RLMAccessorCodeDate: return RLMGetDate(obj, index); - case RLMAccessorCodeData: return RLMGetData(obj, index); - case RLMAccessorCodeLink: return RLMGetLink(obj, index); - case RLMAccessorCodeArray: return RLMGetArray(obj, index); - case RLMAccessorCodeAny: return RLMGetAnyProperty(obj, index); - case RLMAccessorCodeLinkingObjects: return RLMGetLinkingObjects(obj, prop); - } -} - -id RLMDynamicGetByName(__unsafe_unretained RLMObjectBase *const obj, __unsafe_unretained NSString *const propName, bool asList) { - RLMProperty *prop = obj->_objectSchema[propName]; - if (!prop) { - @throw RLMException(@"Invalid property name '%@' for class '%@'.", propName, obj->_objectSchema.className); - } - if (asList && prop.type == RLMPropertyTypeArray && prop.swiftIvar) { - RLMListBase *list = object_getIvar(obj, prop.swiftIvar); - if (!list._rlmArray) { - list._rlmArray = RLMDynamicGet(obj, prop); - } - return list; - } - return RLMDynamicGet(obj, prop); -} diff --git a/Pods/Realm/Realm/RLMAnalytics.mm b/Pods/Realm/Realm/RLMAnalytics.mm deleted file mode 100644 index b33afd84..00000000 --- a/Pods/Realm/Realm/RLMAnalytics.mm +++ /dev/null @@ -1,243 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -// Asynchronously submits build information to Realm if running in an iOS -// simulator or on OS X if a debugger is attached. Does nothing if running on an -// iOS / watchOS device or if a debugger is *not* attached. -// -// To be clear: this does *not* run when your app is in production or on -// your end-user’s devices; it will only run in the simulator or when a debugger -// is attached. -// -// Why are we doing this? In short, because it helps us build a better product -// for you. None of the data personally identifies you, your employer or your -// app, but it *will* help us understand what language you use, what iOS -// versions you target, etc. Having this info will help prioritizing our time, -// adding new features and deprecating old features. Collecting an anonymized -// bundle & anonymized MAC is the only way for us to count actual usage of the -// other metrics accurately. If we don’t have a way to deduplicate the info -// reported, it will be useless, as a single developer building their Swift app -// 10 times would report 10 times more than a single Objective-C developer that -// only builds once, making the data all but useless. -// No one likes sharing data unless it’s necessary, we get it, and we’ve -// debated adding this for a long long time. Since Realm is a free product -// without an email signup, we feel this is a necessary step so we can collect -// relevant data to build a better product for you. If you truly, absolutely -// feel compelled to not send this data back to Realm, then you can set an env -// variable named REALM_DISABLE_ANALYTICS. Since Realm is free we believe -// letting these analytics run is a small price to pay for the product & support -// we give you. -// -// Currently the following information is reported: -// - What version of Realm is being used, and from which language (obj-c or Swift). -// - What version of OS X it's running on (in case Xcode aggressively drops -// support for older versions again, we need to know what we need to support). -// - The minimum iOS/OS X version that the application is targeting (again, to -// help us decide what versions we need to support). -// - An anonymous MAC address and bundle ID to aggregate the other information on. -// - What version of Swift is being used (if applicable). - -#import "RLMAnalytics.hpp" - -#import - -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_MAC || (TARGET_OS_WATCH && TARGET_OS_SIMULATOR) || (TARGET_OS_TV && TARGET_OS_SIMULATOR) -#import "RLMRealm.h" -#import "RLMUtil.hpp" - -#import -#import -#import -#import -#import - -#import - -#ifndef REALM_COCOA_VERSION -#import "RLMVersion.h" -#endif - -#import - -// Declared for RealmSwiftObjectUtil -@interface NSObject (SwiftVersion) -+ (NSString *)swiftVersion; -@end - -// Wrapper for sysctl() that handles the memory management stuff -static auto RLMSysCtl(int *mib, u_int mibSize, size_t *bufferSize) { - std::unique_ptr buffer(nullptr, &free); - - int ret = sysctl(mib, mibSize, nullptr, bufferSize, nullptr, 0); - if (ret != 0) { - return buffer; - } - - buffer.reset(malloc(*bufferSize)); - if (!buffer) { - return buffer; - } - - ret = sysctl(mib, mibSize, buffer.get(), bufferSize, nullptr, 0); - if (ret != 0) { - buffer.reset(); - } - - return buffer; -} - -// Get the version of OS X we're running on (even in the simulator this gives -// the OS X version and not the simulated iOS version) -static NSString *RLMOSVersion() { - std::array mib = {{CTL_KERN, KERN_OSRELEASE}}; - size_t bufferSize; - auto buffer = RLMSysCtl(&mib[0], mib.size(), &bufferSize); - if (!buffer) { - return nil; - } - - return [[NSString alloc] initWithBytesNoCopy:buffer.release() - length:bufferSize - 1 - encoding:NSUTF8StringEncoding - freeWhenDone:YES]; -} - -// Hash the data in the given buffer and convert it to a hex-format string -static NSString *RLMHashData(const void *bytes, size_t length) { - unsigned char buffer[CC_SHA256_DIGEST_LENGTH]; - CC_SHA256(bytes, static_cast(length), buffer); - - char formatted[CC_SHA256_DIGEST_LENGTH * 2 + 1]; - for (int i = 0; i < CC_SHA256_DIGEST_LENGTH; ++i) { - sprintf(formatted + i * 2, "%02x", buffer[i]); - } - - return [[NSString alloc] initWithBytes:formatted - length:CC_SHA256_DIGEST_LENGTH * 2 - encoding:NSUTF8StringEncoding]; -} - -// Returns the hash of the MAC address of the first network adaptor since the -// vendorIdentifier isn't constant between iOS simulators. -static NSString *RLMMACAddress() { - int en0 = static_cast(if_nametoindex("en0")); - if (!en0) { - return nil; - } - - std::array mib = {{CTL_NET, PF_ROUTE, 0, AF_LINK, NET_RT_IFLIST, en0}}; - size_t bufferSize; - auto buffer = RLMSysCtl(&mib[0], mib.size(), &bufferSize); - if (!buffer) { - return nil; - } - - // sockaddr_dl struct is immediately after the if_msghdr struct in the buffer - auto sockaddr = reinterpret_cast(static_cast(buffer.get()) + 1); - auto mac = reinterpret_cast(sockaddr->sdl_data + sockaddr->sdl_nlen); - - return RLMHashData(mac, 6); -} - -static NSDictionary *RLMAnalyticsPayload() { - NSBundle *appBundle = NSBundle.mainBundle; - NSString *hashedBundleID = appBundle.bundleIdentifier; - - // Main bundle isn't always the one of interest (e.g. when running tests - // it's xctest rather than the app's bundle), so look for one with a bundle ID - if (!hashedBundleID) { - for (NSBundle *bundle in NSBundle.allBundles) { - if ((hashedBundleID = bundle.bundleIdentifier)) { - appBundle = bundle; - break; - } - } - } - - // If we found a bundle ID anywhere, hash it as it could contain sensitive - // information (e.g. the name of an unnanounced product) - if (hashedBundleID) { - NSData *data = [hashedBundleID dataUsingEncoding:NSUTF8StringEncoding]; - hashedBundleID = RLMHashData(data.bytes, data.length); - } - - NSString *osVersionString = [[NSProcessInfo processInfo] operatingSystemVersionString]; - Class swiftObjectUtilClass = NSClassFromString(@"RealmSwiftObjectUtil"); - BOOL isSwift = swiftObjectUtilClass != nil; - NSString *swiftVersion = isSwift ? [swiftObjectUtilClass swiftVersion] : @"N/A"; - - static NSString *kUnknownString = @"unknown"; - NSString *hashedMACAddress = RLMMACAddress() ?: kUnknownString; - - return @{ - @"event": @"Run", - @"properties": @{ - // MixPanel properties - @"token": @"ce0fac19508f6c8f20066d345d360fd0", - - // Anonymous identifiers to deduplicate events - @"distinct_id": hashedMACAddress, - @"Anonymized MAC Address": hashedMACAddress, - @"Anonymized Bundle ID": hashedBundleID ?: kUnknownString, - - // Which version of Realm is being used - @"Binding": @"cocoa", - @"Language": isSwift ? @"swift" : @"objc", - @"Realm Version": REALM_COCOA_VERSION, - @"Sync Version": @(REALM_SYNC_VER_STRING), -#if TARGET_OS_WATCH - @"Target OS Type": @"watchos", -#elif TARGET_OS_TV - @"Target OS Type": @"tvos", -#elif TARGET_OS_IPHONE - @"Target OS Type": @"ios", -#else - @"Target OS Type": @"osx", -#endif - @"Swift Version": swiftVersion, - // Current OS version the app is targetting - @"Target OS Version": osVersionString, - // Minimum OS version the app is targetting - @"Target OS Minimum Version": appBundle.infoDictionary[@"MinimumOSVersion"] ?: kUnknownString, - - // Host OS version being built on - @"Host OS Type": @"osx", - @"Host OS Version": RLMOSVersion() ?: kUnknownString, - } - }; -} - -void RLMSendAnalytics() { - if (getenv("REALM_DISABLE_ANALYTICS") || !RLMIsDebuggerAttached() || RLMIsRunningInPlayground()) { - return; - } - - - NSData *payload = [NSJSONSerialization dataWithJSONObject:RLMAnalyticsPayload() options:0 error:nil]; - NSString *url = [NSString stringWithFormat:@"https://api.mixpanel.com/track/?data=%@&ip=1", [payload base64EncodedStringWithOptions:0]]; - - // No error handling or anything because logging errors annoyed people for no - // real benefit, and it's not clear what else we could do - [[NSURLSession.sharedSession dataTaskWithURL:[NSURL URLWithString:url]] resume]; -} - -#else - -void RLMSendAnalytics() {} - -#endif diff --git a/Pods/Realm/Realm/RLMArray.mm b/Pods/Realm/Realm/RLMArray.mm deleted file mode 100644 index 5f08d341..00000000 --- a/Pods/Realm/Realm/RLMArray.mm +++ /dev/null @@ -1,469 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMArray_Private.hpp" - -#import "RLMObject_Private.h" -#import "RLMObjectStore.h" -#import "RLMObjectSchema.h" -#import "RLMQueryUtil.hpp" -#import "RLMSwiftSupport.h" -#import "RLMThreadSafeReference_Private.hpp" -#import "RLMUtil.hpp" - -#import - -// See -countByEnumeratingWithState:objects:count -@interface RLMArrayHolder : NSObject { -@public - std::unique_ptr items; -} -@end -@implementation RLMArrayHolder -@end - -@interface RLMArray () -@end - -@implementation RLMArray { -@public - // Backing array when this instance is unmanaged - NSMutableArray *_backingArray; -} - -template -static void changeArray(__unsafe_unretained RLMArray *const ar, - NSKeyValueChange kind, dispatch_block_t f, IndexSetFactory&& is) { - if (!ar->_backingArray) { - ar->_backingArray = [NSMutableArray new]; - } - - if (RLMObjectBase *parent = ar->_parentObject) { - NSIndexSet *indexes = is(); - [parent willChange:kind valuesAtIndexes:indexes forKey:ar->_key]; - f(); - [parent didChange:kind valuesAtIndexes:indexes forKey:ar->_key]; - } - else { - f(); - } -} - -static void changeArray(__unsafe_unretained RLMArray *const ar, NSKeyValueChange kind, NSUInteger index, dispatch_block_t f) { - changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndex:index]; }); -} - -static void changeArray(__unsafe_unretained RLMArray *const ar, NSKeyValueChange kind, NSRange range, dispatch_block_t f) { - changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndexesInRange:range]; }); -} - -static void changeArray(__unsafe_unretained RLMArray *const ar, NSKeyValueChange kind, NSIndexSet *is, dispatch_block_t f) { - changeArray(ar, kind, f, [=] { return is; }); -} - -- (instancetype)initWithObjectClassName:(__unsafe_unretained NSString *const)objectClassName { - self = [super init]; - if (self) { - _objectClassName = objectClassName; - } - return self; -} - -- (RLMRealm *)realm { - return nil; -} - -// -// Generic implementations for all RLMArray variants -// - -- (id)firstObject { - if (self.count) { - return [self objectAtIndex:0]; - } - return nil; -} - -- (id)lastObject { - NSUInteger count = self.count; - if (count) { - return [self objectAtIndex:count-1]; - } - return nil; -} - -- (void)addObjects:(id)objects { - for (id obj in objects) { - [self addObject:obj]; - } -} - -- (void)addObject:(RLMObject *)object { - [self insertObject:object atIndex:self.count]; -} - -- (void)removeLastObject { - NSUInteger count = self.count; - if (count) { - [self removeObjectAtIndex:count-1]; - } -} - -- (id)objectAtIndexedSubscript:(NSUInteger)index { - return [self objectAtIndex:index]; -} - -- (void)setObject:(id)newValue atIndexedSubscript:(NSUInteger)index { - [self replaceObjectAtIndex:index withObject:newValue]; -} - -// -// Unmanaged RLMArray implementation -// - -static void RLMValidateMatchingObjectType(RLMArray *array, RLMObject *object) { - if (!object) { - @throw RLMException(@"Object must not be nil"); - } - if (!object->_objectSchema) { - @throw RLMException(@"Object cannot be inserted unless the schema is initialized. " - "This can happen if you try to insert objects into a RLMArray / List from a default value or from an overriden unmanaged initializer (`init()`)."); - } - if (![array->_objectClassName isEqualToString:object->_objectSchema.className]) { - @throw RLMException(@"Object type '%@' does not match RLMArray type '%@'.", - object->_objectSchema.className, array->_objectClassName); - } -} - -static void RLMValidateArrayBounds(__unsafe_unretained RLMArray *const ar, - NSUInteger index, bool allowOnePastEnd=false) { - NSUInteger max = ar->_backingArray.count + allowOnePastEnd; - if (index >= max) { - @throw RLMException(@"Index %llu is out of bounds (must be less than %llu).", - (unsigned long long)index, (unsigned long long)max); - } -} - -- (id)objectAtIndex:(NSUInteger)index { - RLMValidateArrayBounds(self, index); - if (!_backingArray) { - _backingArray = [NSMutableArray new]; - } - return [_backingArray objectAtIndex:index]; -} - -- (NSUInteger)count { - return _backingArray.count; -} - -- (BOOL)isInvalidated { - return NO; -} - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(__unused __unsafe_unretained id [])buffer count:(__unused NSUInteger)len { - if (state->state != 0) { - return 0; - } - - // We need to enumerate a copy of the backing array so that it doesn't - // reflect changes made during enumeration. This copy has to be autoreleased - // (since there's nowhere for us to store a strong reference), and uses - // RLMArrayHolder rather than an NSArray because NSArray doesn't guarantee - // that it'll use a single contiguous block of memory, and if it doesn't - // we'd need to forward multiple calls to this method to the same NSArray, - // which would require holding a reference to it somewhere. - __autoreleasing RLMArrayHolder *copy = [[RLMArrayHolder alloc] init]; - copy->items = std::make_unique(self.count); - - NSUInteger i = 0; - for (id object in _backingArray) { - copy->items[i++] = object; - } - - state->itemsPtr = (__unsafe_unretained id *)(void *)copy->items.get(); - // needs to point to something valid, but the whole point of this is so - // that it can't be changed - state->mutationsPtr = state->extra; - state->state = i; - - return i; -} - -- (void)addObjectsFromArray:(NSArray *)array { - for (id obj in array) { - RLMValidateMatchingObjectType(self, obj); - } - changeArray(self, NSKeyValueChangeInsertion, NSMakeRange(_backingArray.count, array.count), ^{ - [_backingArray addObjectsFromArray:array]; - }); -} - -- (void)insertObject:(RLMObject *)anObject atIndex:(NSUInteger)index { - RLMValidateMatchingObjectType(self, anObject); - RLMValidateArrayBounds(self, index, true); - changeArray(self, NSKeyValueChangeInsertion, index, ^{ - [_backingArray insertObject:anObject atIndex:index]; - }); -} - -- (void)insertObjects:(id)objects atIndexes:(NSIndexSet *)indexes { - changeArray(self, NSKeyValueChangeInsertion, indexes, ^{ - NSUInteger currentIndex = [indexes firstIndex]; - for (RLMObject *obj in objects) { - RLMValidateMatchingObjectType(self, obj); - [_backingArray insertObject:obj atIndex:currentIndex]; - currentIndex = [indexes indexGreaterThanIndex:currentIndex]; - } - }); -} - -- (void)removeObjectAtIndex:(NSUInteger)index { - RLMValidateArrayBounds(self, index); - changeArray(self, NSKeyValueChangeRemoval, index, ^{ - [_backingArray removeObjectAtIndex:index]; - }); -} - -- (void)removeObjectsAtIndexes:(NSIndexSet *)indexes { - changeArray(self, NSKeyValueChangeRemoval, indexes, ^{ - [_backingArray removeObjectsAtIndexes:indexes]; - }); -} - -- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject { - RLMValidateMatchingObjectType(self, anObject); - RLMValidateArrayBounds(self, index); - changeArray(self, NSKeyValueChangeReplacement, index, ^{ - [_backingArray replaceObjectAtIndex:index withObject:anObject]; - }); -} - -- (void)moveObjectAtIndex:(NSUInteger)sourceIndex toIndex:(NSUInteger)destinationIndex { - RLMValidateArrayBounds(self, sourceIndex); - RLMValidateArrayBounds(self, destinationIndex); - RLMObjectBase *original = _backingArray[sourceIndex]; - - auto start = std::min(sourceIndex, destinationIndex); - auto len = std::max(sourceIndex, destinationIndex) - start + 1; - changeArray(self, NSKeyValueChangeReplacement, {start, len}, ^{ - [_backingArray removeObjectAtIndex:sourceIndex]; - [_backingArray insertObject:original atIndex:destinationIndex]; - }); -} - -- (void)exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2 { - RLMValidateArrayBounds(self, index1); - RLMValidateArrayBounds(self, index2); - - changeArray(self, NSKeyValueChangeReplacement, ^{ - [_backingArray exchangeObjectAtIndex:index1 withObjectAtIndex:index2]; - }, [=] { - NSMutableIndexSet *set = [[NSMutableIndexSet alloc] initWithIndex:index1]; - [set addIndex:index2]; - return set; - }); -} - -- (NSUInteger)indexOfObject:(RLMObject *)object { - RLMValidateMatchingObjectType(self, object); - NSUInteger index = 0; - for (RLMObject *cmp in _backingArray) { - if (RLMObjectBaseAreEqual(object, cmp)) { - return index; - } - index++; - } - return NSNotFound; -} - -- (void)removeAllObjects { - changeArray(self, NSKeyValueChangeRemoval, NSMakeRange(0, _backingArray.count), ^{ - [_backingArray removeAllObjects]; - }); -} - -- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ... -{ - va_list args; - va_start(args, predicateFormat); - RLMResults *results = [self objectsWhere:predicateFormat args:args]; - va_end(args); - return results; -} - -- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args -{ - return [self objectsWithPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]]; -} - -- (id)valueForKeyPath:(NSString *)keyPath { - if (!_backingArray) { - return [super valueForKeyPath:keyPath]; - } - // Although delegating to valueForKeyPath: here would allow to support - // nested key paths as well, limiting functionality gives consistency - // between unmanaged and managed arrays. - if ([keyPath characterAtIndex:0] == '@') { - NSRange operatorRange = [keyPath rangeOfString:@"." options:NSLiteralSearch]; - if (operatorRange.location != NSNotFound) { - NSString *operatorKeyPath = [keyPath substringFromIndex:operatorRange.location + 1]; - if ([operatorKeyPath rangeOfString:@"."].location != NSNotFound) { - @throw RLMException(@"Nested key paths are not supported yet for KVC collection operators."); - } - } - } - return [_backingArray valueForKeyPath:keyPath]; -} - -- (id)valueForKey:(NSString *)key { - if ([key isEqualToString:RLMInvalidatedKey]) { - return @NO; // Unmanaged arrays are never invalidated - } - if (!_backingArray) { - return @[]; - } - return [_backingArray valueForKey:key]; -} - -- (void)setValue:(id)value forKey:(NSString *)key { - [_backingArray setValue:value forKey:key]; -} - -- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate { - if (!_backingArray) { - return NSNotFound; - } - return [_backingArray indexOfObjectPassingTest:^BOOL(id obj, NSUInteger, BOOL *) { - return [predicate evaluateWithObject:obj]; - }]; -} - -- (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes { - if (!_backingArray) { - _backingArray = [NSMutableArray new]; - } - return [_backingArray objectsAtIndexes:indexes]; -} - -- (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context { - RLMValidateArrayObservationKey(keyPath, self); - [super addObserver:observer forKeyPath:keyPath options:options context:context]; -} - -// -// Methods unsupported on unmanaged RLMArray instances -// - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-parameter" - -- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate -{ - @throw RLMException(@"This method may only be called on RLMArray instances retrieved from an RLMRealm"); -} - -- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending -{ - return [self sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:keyPath ascending:ascending]]]; -} - -- (RLMResults *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascending -{ - return [self sortedResultsUsingKeyPath:property ascending:ascending]; -} - -- (RLMResults *)sortedResultsUsingDescriptors:(NSArray *)properties -{ - @throw RLMException(@"This method may only be called on RLMArray instances retrieved from an RLMRealm"); -} - -// The compiler complains about the method's argument type not matching due to -// it not having the generic type attached, but it doesn't seem to be possible -// to actually include the generic type -// http://www.openradar.me/radar?id=6135653276319744 -#pragma clang diagnostic ignored "-Wmismatched-parameter-types" -- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block { - @throw RLMException(@"This method may only be called on RLMArray instances retrieved from an RLMRealm"); -} -#pragma clang diagnostic pop - -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ... -{ - va_list args; - va_start(args, predicateFormat); - NSUInteger index = [self indexOfObjectWhere:predicateFormat args:args]; - va_end(args); - return index; -} - -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args -{ - return [self indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:predicateFormat - arguments:args]]; -} - -#pragma mark - Superclass Overrides - -- (NSString *)description { - return [self descriptionWithMaxDepth:RLMDescriptionMaxDepth]; -} - -- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth { - return RLMDescriptionWithMaxDepth(@"RLMArray", self, depth); -} - -#pragma mark - Thread Confined Protocol Conformance - -- (std::unique_ptr)makeThreadSafeReference { - REALM_TERMINATE("Unexpected handover of unmanaged `RLMArray`"); -} - -- (id)objectiveCMetadata { - REALM_TERMINATE("Unexpected handover of unmanaged `RLMArray`"); -} - -+ (instancetype)objectWithThreadSafeReference:(__unused std::unique_ptr)reference - metadata:(__unused id)metadata - realm:(__unused RLMRealm *)realm { - REALM_TERMINATE("Unexpected handover of unmanaged `RLMArray`"); -} - -@end - -@implementation RLMSortDescriptor - -+ (instancetype)sortDescriptorWithKeyPath:(NSString *)keyPath ascending:(BOOL)ascending { - RLMSortDescriptor *desc = [[RLMSortDescriptor alloc] init]; - desc->_keyPath = keyPath; - desc->_ascending = ascending; - return desc; -} - -+ (instancetype)sortDescriptorWithProperty:(NSString *)propertyName ascending:(BOOL)ascending { - return [RLMSortDescriptor sortDescriptorWithKeyPath:propertyName ascending:ascending]; -} - -- (instancetype)reversedSortDescriptor { - return [self.class sortDescriptorWithKeyPath:_keyPath ascending:!_ascending]; -} - -- (NSString *)property { - return _keyPath; -} - -@end diff --git a/Pods/Realm/Realm/RLMArrayLinkView.mm b/Pods/Realm/Realm/RLMArrayLinkView.mm deleted file mode 100644 index d9e06965..00000000 --- a/Pods/Realm/Realm/RLMArrayLinkView.mm +++ /dev/null @@ -1,485 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMArray_Private.hpp" - -#import "RLMObjectSchema_Private.hpp" -#import "RLMObjectStore.h" -#import "RLMObject_Private.hpp" -#import "RLMObservation.hpp" -#import "RLMProperty_Private.h" -#import "RLMQueryUtil.hpp" -#import "RLMRealm_Private.hpp" -#import "RLMSchema.h" -#import "RLMThreadSafeReference_Private.hpp" -#import "RLMUtil.hpp" - -#import "list.hpp" -#import "results.hpp" - -#import -#import - -@interface RLMArrayLinkViewHandoverMetadata : NSObject -@property (nonatomic) NSString *parentClassName; -@property (nonatomic) NSString *key; -@end - -@implementation RLMArrayLinkViewHandoverMetadata -@end - -@interface RLMArrayLinkView () -@end - -// -// RLMArray implementation -// -@implementation RLMArrayLinkView { -@public - realm::List _backingList; - RLMRealm *_realm; - RLMClassInfo *_objectInfo; - RLMClassInfo *_ownerInfo; - std::unique_ptr _observationInfo; -} - -- (RLMArrayLinkView *)initWithList:(realm::List)list - realm:(__unsafe_unretained RLMRealm *const)realm - parentInfo:(RLMClassInfo *)parentInfo - property:(__unsafe_unretained RLMProperty *const)property { - self = [self initWithObjectClassName:property.objectClassName]; - if (self) { - _realm = realm; - REALM_ASSERT(list.get_realm() == realm->_realm); - _backingList = std::move(list); - _objectInfo = &parentInfo->linkTargetType(property.index); - _ownerInfo = parentInfo; - _key = property.name; - } - return self; -} - -- (RLMArrayLinkView *)initWithParent:(__unsafe_unretained RLMObjectBase *const)parentObject - property:(__unsafe_unretained RLMProperty *const)property { - __unsafe_unretained RLMRealm *const realm = parentObject->_realm; - realm::List list(realm->_realm, parentObject->_row.get_linklist(parentObject->_info->tableColumn(property))); - return [self initWithList:std::move(list) - realm:realm - parentInfo:parentObject->_info - property:property]; -} - -void RLMValidateArrayObservationKey(__unsafe_unretained NSString *const keyPath, - __unsafe_unretained RLMArray *const array) { - if (![keyPath isEqualToString:RLMInvalidatedKey]) { - @throw RLMException(@"[<%@ %p> addObserver:forKeyPath:options:context:] is not supported. Key path: %@", - [array class], array, keyPath); - } -} - -void RLMEnsureArrayObservationInfo(std::unique_ptr& info, - __unsafe_unretained NSString *const keyPath, - __unsafe_unretained RLMArray *const array, - __unsafe_unretained id const observed) { - RLMValidateArrayObservationKey(keyPath, array); - if (!info && array.class == [RLMArrayLinkView class]) { - RLMArrayLinkView *lv = static_cast(array); - info = std::make_unique(*lv->_ownerInfo, - lv->_backingList.get_origin_row_index(), - observed); - } -} - -// -// validation helpers -// -[[gnu::noinline]] -[[noreturn]] -static void throwError() { - try { - throw; - } - catch (realm::InvalidTransactionException const&) { - @throw RLMException(@"Cannot modify managed RLMArray outside of a write transaction"); - } - catch (realm::IncorrectThreadException const&) { - @throw RLMException(@"Realm accessed from incorrect thread"); - } - catch (realm::List::InvalidatedException const&) { - @throw RLMException(@"RLMArray has been invalidated or the containing object has been deleted"); - } - catch (realm::List::OutOfBoundsIndexException const& e) { - @throw RLMException(@"Index %zu is out of bounds (must be less than %zu)", - e.requested, e.valid_count); - } -} - -template -static auto translateErrors(Function&& f) { - try { - return f(); - } - catch (...) { - throwError(); - } -} - -static void validateObjectToAdd(__unsafe_unretained RLMArrayLinkView *const ar, - __unsafe_unretained RLMObject *const obj) { - if (!obj) { - @throw RLMException(@"Cannot add `nil` to RLMArray<%@>", ar->_objectClassName); - } - - NSString *objectClassName = obj->_objectSchema.className; - if (![objectClassName isEqualToString:ar->_objectClassName]) { - @throw RLMException(@"Cannot add object of type '%@' to RLMArray<%@>", - objectClassName, ar->_objectClassName); - } - - if (obj->_realm != ar.realm) { - [ar.realm addObject:obj]; - } - else if (obj->_realm && !obj->_row.is_attached()) { - @throw RLMException(@"Object has been deleted or invalidated."); - } -} - -template -static void changeArray(__unsafe_unretained RLMArrayLinkView *const ar, - NSKeyValueChange kind, dispatch_block_t f, IndexSetFactory&& is) { - translateErrors([&] { ar->_backingList.verify_in_transaction(); }); - RLMObservationInfo *info = RLMGetObservationInfo(ar->_observationInfo.get(), - ar->_backingList.get_origin_row_index(), - *ar->_ownerInfo); - if (info) { - NSIndexSet *indexes = is(); - info->willChange(ar->_key, kind, indexes); - try { - f(); - } - catch (...) { - info->didChange(ar->_key, kind, indexes); - throwError(); - } - info->didChange(ar->_key, kind, indexes); - } - else { - translateErrors([&] { f(); }); - } -} - -static void changeArray(__unsafe_unretained RLMArrayLinkView *const ar, NSKeyValueChange kind, NSUInteger index, dispatch_block_t f) { - changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndex:index]; }); -} - -static void changeArray(__unsafe_unretained RLMArrayLinkView *const ar, NSKeyValueChange kind, NSRange range, dispatch_block_t f) { - changeArray(ar, kind, f, [=] { return [NSIndexSet indexSetWithIndexesInRange:range]; }); -} - -static void changeArray(__unsafe_unretained RLMArrayLinkView *const ar, NSKeyValueChange kind, NSIndexSet *is, dispatch_block_t f) { - changeArray(ar, kind, f, [=] { return is; }); -} - -// -// public method implementations -// -- (RLMRealm *)realm { - return _realm; -} - -- (NSUInteger)count { - return translateErrors([&] { return _backingList.size(); }); -} - -- (BOOL)isInvalidated { - return translateErrors([&] { return !_backingList.is_valid(); }); -} - -- (RLMClassInfo *)objectInfo { - return _objectInfo; -} - -- (BOOL)isEqual:(id)object { - if (RLMArrayLinkView *linkView = RLMDynamicCast(object)) { - return linkView->_backingList == _backingList; - } - return NO; -} - -- (NSUInteger)hash { - return std::hash()(_backingList); -} - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state - objects:(__unused __unsafe_unretained id [])buffer - count:(NSUInteger)len { - __autoreleasing RLMFastEnumerator *enumerator; - if (state->state == 0) { - translateErrors([&] { _backingList.verify_attached(); }); - - enumerator = [[RLMFastEnumerator alloc] initWithCollection:self objectSchema:*_objectInfo]; - state->extra[0] = (long)enumerator; - state->extra[1] = self.count; - } - else { - enumerator = (__bridge id)(void *)state->extra[0]; - } - - return [enumerator countByEnumeratingWithState:state count:len]; -} - -- (id)objectAtIndex:(NSUInteger)index { - return RLMCreateObjectAccessor(_realm, *_objectInfo, - translateErrors([&] { return _backingList.get(index).get_index(); })); -} - -static void RLMInsertObject(RLMArrayLinkView *ar, RLMObject *object, NSUInteger index) { - if (index == NSUIntegerMax) { - index = translateErrors([&] { return ar->_backingList.size(); }); - } - - validateObjectToAdd(ar, object); - changeArray(ar, NSKeyValueChangeInsertion, index, ^{ - ar->_backingList.insert(index, object->_row.get_index()); - }); -} - -- (void)addObject:(RLMObject *)object { - RLMInsertObject(self, object, NSUIntegerMax); -} - -- (void)insertObject:(RLMObject *)object atIndex:(NSUInteger)index { - RLMInsertObject(self, object, index); -} - -- (void)insertObjects:(id)objects atIndexes:(NSIndexSet *)indexes { - changeArray(self, NSKeyValueChangeInsertion, indexes, ^{ - NSUInteger index = [indexes firstIndex]; - for (RLMObject *obj in objects) { - validateObjectToAdd(self, obj); - _backingList.insert(index, obj->_row.get_index()); - index = [indexes indexGreaterThanIndex:index]; - } - }); -} - - -- (void)removeObjectAtIndex:(NSUInteger)index { - changeArray(self, NSKeyValueChangeRemoval, index, ^{ - _backingList.remove(index); - }); -} - -- (void)removeObjectsAtIndexes:(NSIndexSet *)indexes { - changeArray(self, NSKeyValueChangeRemoval, indexes, ^{ - [indexes enumerateIndexesWithOptions:NSEnumerationReverse usingBlock:^(NSUInteger idx, BOOL *) { - _backingList.remove(idx); - }]; - }); -} - -- (void)addObjectsFromArray:(NSArray *)array { - changeArray(self, NSKeyValueChangeInsertion, NSMakeRange(self.count, array.count), ^{ - for (RLMObject *obj in array) { - validateObjectToAdd(self, obj); - _backingList.add(obj->_row.get_index()); - } - }); -} - -- (void)removeAllObjects { - changeArray(self, NSKeyValueChangeRemoval, NSMakeRange(0, self.count), ^{ - _backingList.remove_all(); - }); -} - -- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(RLMObject *)object { - validateObjectToAdd(self, object); - changeArray(self, NSKeyValueChangeReplacement, index, ^{ - _backingList.set(index, object->_row.get_index()); - }); -} - -- (void)moveObjectAtIndex:(NSUInteger)sourceIndex toIndex:(NSUInteger)destinationIndex { - auto start = std::min(sourceIndex, destinationIndex); - auto len = std::max(sourceIndex, destinationIndex) - start + 1; - changeArray(self, NSKeyValueChangeReplacement, {start, len}, ^{ - _backingList.move(sourceIndex, destinationIndex); - }); -} - -- (void)exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2 { - changeArray(self, NSKeyValueChangeReplacement, ^{ - _backingList.swap(index1, index2); - }, [=] { - NSMutableIndexSet *set = [[NSMutableIndexSet alloc] initWithIndex:index1]; - [set addIndex:index2]; - return set; - }); -} - -- (NSUInteger)indexOfObject:(RLMObject *)object { - if (object.invalidated) { - @throw RLMException(@"Object has been deleted or invalidated"); - } - - // check that object types align - if (![_objectClassName isEqualToString:object->_objectSchema.className]) { - @throw RLMException(@"Object of type (%@) does not match RLMArray type (%@)", - object->_objectSchema.className, _objectClassName); - } - - return translateErrors([&] { return RLMConvertNotFound(_backingList.find(object->_row)); }); -} - -- (id)valueForKeyPath:(NSString *)keyPath { - if ([keyPath hasPrefix:@"@"]) { - // Delegate KVC collection operators to RLMResults - auto query = translateErrors([&] { return _backingList.get_query(); }); - RLMResults *results = [RLMResults resultsWithObjectInfo:*_objectInfo - results:realm::Results(_realm->_realm, std::move(query))]; - return [results valueForKeyPath:keyPath]; - } - return [super valueForKeyPath:keyPath]; -} - -- (id)valueForKey:(NSString *)key { - // Ideally we'd use "@invalidated" for this so that "invalidated" would use - // normal array KVC semantics, but observing @things works very oddly (when - // it's part of a key path, it's triggered automatically when array index - // changes occur, and can't be sent explicitly, but works normally when it's - // the entire key path), and an RLMArrayLinkView *can't* have objects where - // invalidated is true, so we're not losing much. - if ([key isEqualToString:RLMInvalidatedKey]) { - return @(!_backingList.is_valid()); - } - - translateErrors([&] { _backingList.verify_attached(); }); - return RLMCollectionValueForKey(self, key); -} - -- (void)setValue:(id)value forKey:(NSString *)key { - translateErrors([&] { _backingList.verify_in_transaction(); }); - RLMCollectionSetValueForKey(self, key, value); -} - -- (void)deleteObjectsFromRealm { - // delete all target rows from the realm - RLMTrackDeletions(_realm, ^{ - translateErrors([&] { _backingList.delete_all(); }); - }); -} - -- (RLMResults *)sortedResultsUsingDescriptors:(NSArray *)properties { - if (properties.count == 0) { - auto results = translateErrors([&] { return _backingList.filter({}); }); - return [RLMResults resultsWithObjectInfo:*_objectInfo results:std::move(results)]; - } - - auto order = RLMSortDescriptorFromDescriptors(*_objectInfo, properties); - auto results = translateErrors([&] { return _backingList.sort(std::move(order)); }); - return [RLMResults resultsWithObjectInfo:*_objectInfo results:std::move(results)]; -} - -- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate { - auto query = RLMPredicateToQuery(predicate, _objectInfo->rlmObjectSchema, _realm.schema, _realm.group); - auto results = translateErrors([&] { return _backingList.filter(std::move(query)); }); - return [RLMResults resultsWithObjectInfo:*_objectInfo results:std::move(results)]; -} - -- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate { - auto query = translateErrors([&] { return _backingList.get_query(); }); - query.and_query(RLMPredicateToQuery(predicate, _objectInfo->rlmObjectSchema, _realm.schema, _realm.group)); -#if REALM_VER_MAJOR >= 2 - auto indexInTable = query.find(); - if (indexInTable == realm::not_found) { - return NSNotFound; - } - auto row = query.get_table()->get(indexInTable); - return _backingList.find(row); -#else - return RLMConvertNotFound(query.find()); -#endif -} - -- (NSArray *)objectsAtIndexes:(__unused NSIndexSet *)indexes { - // FIXME: this is called by KVO when array changes are made. It's not clear - // why, and returning nil seems to work fine. - return nil; -} - -- (void)addObserver:(id)observer - forKeyPath:(NSString *)keyPath - options:(NSKeyValueObservingOptions)options - context:(void *)context { - RLMEnsureArrayObservationInfo(_observationInfo, keyPath, self, self); - [super addObserver:observer forKeyPath:keyPath options:options context:context]; -} - -- (NSUInteger)indexInSource:(NSUInteger)index { - return _backingList.get_unchecked(index); -} - -- (realm::TableView)tableView { - return translateErrors([&] { return _backingList.get_query(); }).find_all(); -} - -// The compiler complains about the method's argument type not matching due to -// it not having the generic type attached, but it doesn't seem to be possible -// to actually include the generic type -// http://www.openradar.me/radar?id=6135653276319744 -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wmismatched-parameter-types" -- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *, RLMCollectionChange *, NSError *))block { - [_realm verifyNotificationsAreSupported]; - return RLMAddNotificationBlock(self, _backingList, block); -} -#pragma clang diagnostic pop - -#pragma mark - Thread Confined Protocol Conformance - -- (std::unique_ptr)makeThreadSafeReference { - realm::ThreadSafeReference list_reference = _realm->_realm->obtain_thread_safe_reference(_backingList); - return std::make_unique>(std::move(list_reference)); -} - -- (RLMArrayLinkViewHandoverMetadata *)objectiveCMetadata { - RLMArrayLinkViewHandoverMetadata *metadata = [[RLMArrayLinkViewHandoverMetadata alloc] init]; - metadata.parentClassName = _ownerInfo->rlmObjectSchema.className; - metadata.key = _key; - return metadata; -} - -+ (instancetype)objectWithThreadSafeReference:(std::unique_ptr)reference - metadata:(RLMArrayLinkViewHandoverMetadata *)metadata - realm:(RLMRealm *)realm { - REALM_ASSERT_DEBUG(dynamic_cast *>(reference.get())); - auto list_reference = static_cast *>(reference.get()); - - realm::List list = realm->_realm->resolve_thread_safe_reference(std::move(*list_reference)); - if (!list.is_valid()) { - return nil; - } - RLMClassInfo *parentInfo = &realm->_info[metadata.parentClassName]; - return [[RLMArrayLinkView alloc] initWithList:std::move(list) - realm:realm - parentInfo:parentInfo - property:parentInfo->rlmObjectSchema[metadata.key]]; -} - -@end diff --git a/Pods/Realm/Realm/RLMAuthResponseModel.m b/Pods/Realm/Realm/RLMAuthResponseModel.m deleted file mode 100644 index 2eb5b7c9..00000000 --- a/Pods/Realm/Realm/RLMAuthResponseModel.m +++ /dev/null @@ -1,57 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMAuthResponseModel.h" - -#import "RLMTokenModels.h" -#import "RLMSyncUtil_Private.h" - -static const NSString *const kRLMSyncAccessTokenKey = @"access_token"; -static const NSString *const kRLMSyncRefreshTokenKey = @"refresh_token"; - -@interface RLMAuthResponseModel () - -@property (nonatomic, readwrite) RLMTokenModel *accessToken; -@property (nonatomic, readwrite) RLMTokenModel *refreshToken; - -@end - -@implementation RLMAuthResponseModel - -- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary - requireAccessToken:(BOOL)requireAccessToken - requireRefreshToken:(BOOL)requireRefreshToken { - if (self = [super init]) { - // Get the access token. - if (requireAccessToken) { - RLM_SYNC_PARSE_MODEL_OR_ABORT(jsonDictionary, kRLMSyncAccessTokenKey, RLMTokenModel, accessToken); - } else { - RLM_SYNC_PARSE_OPTIONAL_MODEL(jsonDictionary, kRLMSyncAccessTokenKey, RLMTokenModel, accessToken); - } - // Get the refresh token. - if (requireRefreshToken) { - RLM_SYNC_PARSE_MODEL_OR_ABORT(jsonDictionary, kRLMSyncRefreshTokenKey, RLMTokenModel, refreshToken); - } else { - RLM_SYNC_PARSE_OPTIONAL_MODEL(jsonDictionary, kRLMSyncRefreshTokenKey, RLMTokenModel, refreshToken); - } - return self; - } - return nil; -} - -@end diff --git a/Pods/Realm/Realm/RLMClassInfo.mm b/Pods/Realm/Realm/RLMClassInfo.mm deleted file mode 100644 index b0ff82bd..00000000 --- a/Pods/Realm/Realm/RLMClassInfo.mm +++ /dev/null @@ -1,107 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMClassInfo.hpp" - -#import "RLMRealm_Private.hpp" -#import "RLMObjectSchema_Private.h" -#import "RLMSchema.h" -#import "RLMProperty_Private.h" -#import "RLMQueryUtil.hpp" -#import "RLMUtil.hpp" - -#import "object_schema.hpp" -#import "object_store.hpp" -#import "schema.hpp" - -#import - -using namespace realm; - -RLMClassInfo::RLMClassInfo(RLMRealm *realm, RLMObjectSchema *rlmObjectSchema, - const realm::ObjectSchema *objectSchema) -: realm(realm), rlmObjectSchema(rlmObjectSchema), objectSchema(objectSchema) { } - -realm::Table *RLMClassInfo::table() const { - if (!m_table) { - m_table = ObjectStore::table_for_object_type(realm.group, objectSchema->name).get(); - } - return m_table; -} - -RLMProperty *RLMClassInfo::propertyForTableColumn(NSUInteger col) const noexcept { - auto const& props = objectSchema->persisted_properties; - for (size_t i = 0; i < props.size(); ++i) { - if (props[i].table_column == col) { - return rlmObjectSchema.properties[i]; - } - } - return nil; -} - -RLMProperty *RLMClassInfo::propertyForPrimaryKey() const noexcept { - return rlmObjectSchema.primaryKeyProperty; -} - -NSUInteger RLMClassInfo::tableColumn(NSString *propertyName) const { - return tableColumn(RLMValidatedProperty(rlmObjectSchema, propertyName)); -} - -NSUInteger RLMClassInfo::tableColumn(RLMProperty *property) const { - return objectSchema->persisted_properties[property.index].table_column; -} - -RLMClassInfo &RLMClassInfo::linkTargetType(size_t index) { - if (index < m_linkTargets.size() && m_linkTargets[index]) { - return *m_linkTargets[index]; - } - if (m_linkTargets.size() <= index) { - m_linkTargets.resize(index + 1); - } - m_linkTargets[index] = &realm->_info[rlmObjectSchema.properties[index].objectClassName]; - return *m_linkTargets[index]; -} - -RLMSchemaInfo::impl::iterator RLMSchemaInfo::begin() noexcept { return m_objects.begin(); } -RLMSchemaInfo::impl::iterator RLMSchemaInfo::end() noexcept { return m_objects.end(); } -RLMSchemaInfo::impl::const_iterator RLMSchemaInfo::begin() const noexcept { return m_objects.begin(); } -RLMSchemaInfo::impl::const_iterator RLMSchemaInfo::end() const noexcept { return m_objects.end(); } - -RLMClassInfo& RLMSchemaInfo::operator[](NSString *name) { - auto it = m_objects.find(name); - if (it == m_objects.end()) { - @throw RLMException(@"Object type '%@' is not managed by the Realm. " - @"If using a custom `objectClasses` / `objectTypes` array in your configuration, " - @"add `%@` to the list of `objectClasses` / `objectTypes`.", - name, name); - } - return *&it->second; -} - -RLMSchemaInfo::RLMSchemaInfo(RLMRealm *realm, RLMSchema *rlmSchema, realm::Schema const& schema) { - REALM_ASSERT(rlmSchema.objectSchema.count == schema.size()); - REALM_ASSERT(m_objects.empty()); - - m_objects.reserve(schema.size()); - for (RLMObjectSchema *rlmObjectSchema in rlmSchema.objectSchema) { - m_objects.emplace(std::piecewise_construct, - std::forward_as_tuple(rlmObjectSchema.className), - std::forward_as_tuple(realm, rlmObjectSchema, - &*schema.find(rlmObjectSchema.objectName.UTF8String))); - } -} diff --git a/Pods/Realm/Realm/RLMCollection.mm b/Pods/Realm/Realm/RLMCollection.mm deleted file mode 100644 index b039d999..00000000 --- a/Pods/Realm/Realm/RLMCollection.mm +++ /dev/null @@ -1,355 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMCollection_Private.hpp" - -#import "RLMArray_Private.h" -#import "RLMObjectSchema_Private.hpp" -#import "RLMObjectStore.h" -#import "RLMObject_Private.hpp" - -#import "collection_notifications.hpp" -#import "list.hpp" -#import "results.hpp" - -#import - -static const int RLMEnumerationBufferSize = 16; - -@implementation RLMFastEnumerator { - // The buffer supplied by fast enumeration does not retain the objects given - // to it, but because we create objects on-demand and don't want them - // autoreleased (a table can have more rows than the device has memory for - // accessor objects) we need a thing to retain them. - id _strongBuffer[RLMEnumerationBufferSize]; - - RLMRealm *_realm; - RLMClassInfo *_info; - - // Collection being enumerated. Only one of these two will be valid: when - // possible we enumerate the collection directly, but when in a write - // transaction we instead create a frozen TableView and enumerate that - // instead so that mutating the collection during enumeration works. - id _collection; - realm::TableView _tableView; -} - -- (instancetype)initWithCollection:(id)collection objectSchema:(RLMClassInfo&)info { - self = [super init]; - if (self) { - _realm = collection.realm; - _info = &info; - - if (_realm.inWriteTransaction) { - _tableView = [collection tableView]; - } - else { - _collection = collection; - [_realm registerEnumerator:self]; - } - } - return self; -} - -- (void)dealloc { - if (_collection) { - [_realm unregisterEnumerator:self]; - } -} - -- (void)detach { - _tableView = [_collection tableView]; - _collection = nil; -} - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state - count:(NSUInteger)len { - [_realm verifyThread]; - if (!_tableView.is_attached() && !_collection) { - @throw RLMException(@"Collection is no longer valid"); - } - // The fast enumeration buffer size is currently a hardcoded number in the - // compiler so this can't actually happen, but just in case it changes in - // the future... - if (len > RLMEnumerationBufferSize) { - len = RLMEnumerationBufferSize; - } - - NSUInteger batchCount = 0, count = state->extra[1]; - - Class accessorClass = _info->rlmObjectSchema.accessorClass; - for (NSUInteger index = state->state; index < count && batchCount < len; ++index) { - RLMObject *accessor = RLMCreateManagedAccessor(accessorClass, _realm, _info); - if (_collection) { - accessor->_row = (*_info->table())[[_collection indexInSource:index]]; - } - else if (_tableView.is_row_attached(index)) { - accessor->_row = (*_info->table())[_tableView.get_source_ndx(index)]; - } - RLMInitializeSwiftAccessorGenerics(accessor); - _strongBuffer[batchCount] = accessor; - batchCount++; - } - - for (NSUInteger i = batchCount; i < len; ++i) { - _strongBuffer[i] = nil; - } - - if (batchCount == 0) { - // Release our data if we're done, as we're autoreleased and so may - // stick around for a while - _collection = nil; - if (_tableView.is_attached()) { - _tableView = {}; - } - else { - [_realm unregisterEnumerator:self]; - } - } - - state->itemsPtr = (__unsafe_unretained id *)(void *)_strongBuffer; - state->state += batchCount; - state->mutationsPtr = state->extra+1; - - return batchCount; -} -@end - - -NSArray *RLMCollectionValueForKey(id collection, NSString *key) { - size_t count = collection.count; - if (count == 0) { - return @[]; - } - - RLMRealm *realm = collection.realm; - RLMClassInfo *info = collection.objectInfo; - - NSMutableArray *results = [NSMutableArray arrayWithCapacity:count]; - if ([key isEqualToString:@"self"]) { - for (size_t i = 0; i < count; i++) { - size_t rowIndex = [collection indexInSource:i]; - [results addObject:RLMCreateObjectAccessor(realm, *info, rowIndex) ?: NSNull.null]; - } - return results; - } - - RLMObject *accessor = RLMCreateManagedAccessor(info->rlmObjectSchema.accessorClass, realm, info); - realm::Table *table = info->table(); - for (size_t i = 0; i < count; i++) { - size_t rowIndex = [collection indexInSource:i]; - accessor->_row = (*table)[rowIndex]; - RLMInitializeSwiftAccessorGenerics(accessor); - [results addObject:[accessor valueForKey:key] ?: NSNull.null]; - } - - return results; -} - -void RLMCollectionSetValueForKey(id collection, NSString *key, id value) { - realm::TableView tv = [collection tableView]; - if (tv.size() == 0) { - return; - } - - RLMRealm *realm = collection.realm; - RLMClassInfo *info = collection.objectInfo; - RLMObject *accessor = RLMCreateManagedAccessor(info->rlmObjectSchema.accessorClass, realm, info); - for (size_t i = 0; i < tv.size(); i++) { - accessor->_row = tv[i]; - RLMInitializeSwiftAccessorGenerics(accessor); - [accessor setValue:value forKey:key]; - } -} - -NSString *RLMDescriptionWithMaxDepth(NSString *name, - id collection, - NSUInteger depth) { - if (depth == 0) { - return @""; - } - - const NSUInteger maxObjects = 100; - auto str = [NSMutableString stringWithFormat:@"%@ <%p> (\n", name, (void *)collection]; - size_t index = 0, skipped = 0; - for (id obj in collection) { - NSString *sub; - if ([obj respondsToSelector:@selector(descriptionWithMaxDepth:)]) { - sub = [obj descriptionWithMaxDepth:depth - 1]; - } - else { - sub = [obj description]; - } - - // Indent child objects - NSString *objDescription = [sub stringByReplacingOccurrencesOfString:@"\n" - withString:@"\n\t"]; - [str appendFormat:@"\t[%zu] %@,\n", index++, objDescription]; - if (index >= maxObjects) { - skipped = collection.count - maxObjects; - break; - } - } - - // Remove last comma and newline characters - if (collection.count > 0) { - [str deleteCharactersInRange:NSMakeRange(str.length-2, 2)]; - } - if (skipped) { - [str appendFormat:@"\n\t... %zu objects skipped.", skipped]; - } - [str appendFormat:@"\n)"]; - return str; -} - -@implementation RLMCancellationToken { - realm::NotificationToken _token; - __unsafe_unretained RLMRealm *_realm; -} -- (instancetype)initWithToken:(realm::NotificationToken)token realm:(RLMRealm *)realm { - self = [super init]; - if (self) { - _token = std::move(token); - _realm = realm; - } - return self; -} - -- (RLMRealm *)realm { - return _realm; -} - -- (void)suppressNextNotification { - _token.suppress_next(); -} - -- (void)stop { - _token = {}; -} - -@end - -@implementation RLMCollectionChange { - realm::CollectionChangeSet _indices; -} - -- (instancetype)initWithChanges:(realm::CollectionChangeSet)indices { - self = [super init]; - if (self) { - _indices = std::move(indices); - } - return self; -} - -static NSArray *toArray(realm::IndexSet const& set) { - NSMutableArray *ret = [NSMutableArray new]; - for (auto index : set.as_indexes()) { - [ret addObject:@(index)]; - } - return ret; -} - -- (NSArray *)insertions { - return toArray(_indices.insertions); -} - -- (NSArray *)deletions { - return toArray(_indices.deletions); -} - -- (NSArray *)modifications { - return toArray(_indices.modifications); -} - -static NSArray *toIndexPathArray(realm::IndexSet const& set, NSUInteger section) { - NSMutableArray *ret = [NSMutableArray new]; - NSUInteger path[2] = {section, 0}; - for (auto index : set.as_indexes()) { - path[1] = index; - [ret addObject:[NSIndexPath indexPathWithIndexes:path length:2]]; - } - return ret; -} - -- (NSArray *)deletionsInSection:(NSUInteger)section { - return toIndexPathArray(_indices.deletions, section); -} - -- (NSArray *)insertionsInSection:(NSUInteger)section { - return toIndexPathArray(_indices.insertions, section); - -} - -- (NSArray *)modificationsInSection:(NSUInteger)section { - return toIndexPathArray(_indices.modifications, section); - -} -@end - -template -RLMNotificationToken *RLMAddNotificationBlock(id objcCollection, - Collection& collection, - void (^block)(id, RLMCollectionChange *, NSError *), - bool suppressInitialChange) { - struct IsValid { - static bool call(realm::List const& list) { - return list.is_valid(); - } - static bool call(realm::Results const&) { - return true; - } - }; - - auto skip = suppressInitialChange ? std::make_shared(true) : nullptr; - auto cb = [=, &collection](realm::CollectionChangeSet const& changes, - std::exception_ptr err) { - if (err) { - try { - rethrow_exception(err); - } - catch (...) { - NSError *error = nil; - RLMRealmTranslateException(&error); - block(nil, nil, error); - return; - } - } - - if (!IsValid::call(collection)) { - return; - } - - if (skip && *skip) { - *skip = false; - block(objcCollection, nil, nil); - } - else if (changes.empty()) { - block(objcCollection, nil, nil); - } - else { - block(objcCollection, [[RLMCollectionChange alloc] initWithChanges:changes], nil); - } - }; - - return [[RLMCancellationToken alloc] initWithToken:collection.add_notification_callback(cb) - realm:(RLMRealm *)[objcCollection realm]]; -} - -// Explicitly instantiate the templated function for the two types we'll use it on -template RLMNotificationToken *RLMAddNotificationBlock(id, realm::List&, void (^)(id, RLMCollectionChange *, NSError *), bool); -template RLMNotificationToken *RLMAddNotificationBlock(id, realm::Results&, void (^)(id, RLMCollectionChange *, NSError *), bool); diff --git a/Pods/Realm/Realm/RLMConstants.m b/Pods/Realm/Realm/RLMConstants.m deleted file mode 100644 index 71361274..00000000 --- a/Pods/Realm/Realm/RLMConstants.m +++ /dev/null @@ -1,34 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -RLMNotification const RLMRealmRefreshRequiredNotification = @"RLMRealmRefreshRequiredNotification"; -RLMNotification const RLMRealmDidChangeNotification = @"RLMRealmDidChangeNotification"; - -NSString * const RLMErrorDomain = @"io.realm"; - -NSString * const RLMUnknownSystemErrorDomain = @"io.realm.unknown"; - -NSString * const RLMExceptionName = @"RLMException"; - -NSString * const RLMRealmVersionKey = @"RLMRealmVersion"; - -NSString * const RLMRealmCoreVersionKey = @"RLMRealmCoreVersion"; - -NSString * const RLMInvalidatedKey = @"invalidated"; diff --git a/Pods/Realm/Realm/RLMListBase.mm b/Pods/Realm/Realm/RLMListBase.mm deleted file mode 100644 index 78cf91a5..00000000 --- a/Pods/Realm/Realm/RLMListBase.mm +++ /dev/null @@ -1,60 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMListBase.h" - -#import "RLMArray_Private.hpp" -#import "RLMObservation.hpp" - -@interface RLMArray (KVO) -- (NSArray *)objectsAtIndexes:(__unused NSIndexSet *)indexes; -@end - -@implementation RLMListBase { - std::unique_ptr _observationInfo; -} - -- (instancetype)initWithArray:(RLMArray *)array { - self = [super init]; - if (self) { - __rlmArray = array; - } - return self; -} - -- (id)valueForKey:(NSString *)key { - return [__rlmArray valueForKey:key]; -} - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id __unsafe_unretained [])buffer count:(NSUInteger)len { - return [__rlmArray countByEnumeratingWithState:state objects:buffer count:len]; -} - -- (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes { - return [__rlmArray objectsAtIndexes:indexes]; -} - -- (void)addObserver:(id)observer - forKeyPath:(NSString *)keyPath - options:(NSKeyValueObservingOptions)options - context:(void *)context { - RLMEnsureArrayObservationInfo(_observationInfo, keyPath, __rlmArray, self); - [super addObserver:observer forKeyPath:keyPath options:options context:context]; -} - -@end diff --git a/Pods/Realm/Realm/RLMMigration.mm b/Pods/Realm/Realm/RLMMigration.mm deleted file mode 100644 index 6d8da010..00000000 --- a/Pods/Realm/Realm/RLMMigration.mm +++ /dev/null @@ -1,162 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMMigration_Private.h" - -#import "RLMAccessor.h" -#import "RLMObject_Private.h" -#import "RLMObjectSchema_Private.hpp" -#import "RLMObjectStore.h" -#import "RLMProperty_Private.h" -#import "RLMRealm_Dynamic.h" -#import "RLMRealm_Private.hpp" -#import "RLMResults_Private.h" -#import "RLMSchema_Private.hpp" -#import "RLMUtil.hpp" - -#import "object_store.hpp" -#import "shared_realm.hpp" -#import "schema.hpp" - -#import - -using namespace realm; - -// The source realm for a migration has to use a SharedGroup to be able to share -// the file with the destination realm, but we don't want to let the user call -// beginWriteTransaction on it as that would make no sense. -@interface RLMMigrationRealm : RLMRealm -@end - -@implementation RLMMigrationRealm -- (BOOL)readonly { - return YES; -} - -- (void)beginWriteTransaction { - @throw RLMException(@"Cannot modify the source Realm in a migration"); -} -@end - -@implementation RLMMigration { - realm::Schema *_schema; -} - -- (instancetype)initWithRealm:(RLMRealm *)realm oldRealm:(RLMRealm *)oldRealm schema:(realm::Schema &)schema { - self = [super init]; - if (self) { - _realm = realm; - _oldRealm = oldRealm; - _schema = &schema; - object_setClass(_oldRealm, RLMMigrationRealm.class); - } - return self; -} - -- (RLMSchema *)oldSchema { - return self.oldRealm.schema; -} - -- (RLMSchema *)newSchema { - return self.realm.schema; -} - -- (void)enumerateObjects:(NSString *)className block:(RLMObjectMigrationBlock)block { - // get all objects - RLMResults *objects = [_realm.schema schemaForClassName:className] ? [_realm allObjects:className] : nil; - RLMResults *oldObjects = [_oldRealm.schema schemaForClassName:className] ? [_oldRealm allObjects:className] : nil; - - if (objects && oldObjects) { - for (long i = oldObjects.count - 1; i >= 0; i--) { - @autoreleasepool { - block(oldObjects[i], objects[i]); - } - } - } - else if (objects) { - for (long i = objects.count - 1; i >= 0; i--) { - @autoreleasepool { - block(nil, objects[i]); - } - } - } - else if (oldObjects) { - for (long i = oldObjects.count - 1; i >= 0; i--) { - @autoreleasepool { - block(oldObjects[i], nil); - } - } - } -} - -- (void)execute:(RLMMigrationBlock)block { - @autoreleasepool { - // disable all primary keys for migration and use DynamicObject for all types - for (RLMObjectSchema *objectSchema in _realm.schema.objectSchema) { - objectSchema.accessorClass = RLMDynamicObject.class; - objectSchema.primaryKeyProperty.isPrimary = NO; - } - for (RLMObjectSchema *objectSchema in _oldRealm.schema.objectSchema) { - objectSchema.accessorClass = RLMDynamicObject.class; - } - - block(self, _oldRealm->_realm->schema_version()); - - _oldRealm = nil; - _realm = nil; - } -} - -- (RLMObject *)createObject:(NSString *)className withValue:(id)value { - return [_realm createObject:className withValue:value]; -} - -- (RLMObject *)createObject:(NSString *)className withObject:(id)object { - return [self createObject:className withValue:object]; -} - -- (void)deleteObject:(RLMObject *)object { - [_realm deleteObject:object]; -} - -- (BOOL)deleteDataForClassName:(NSString *)name { - if (!name) { - return false; - } - - TableRef table = ObjectStore::table_for_object_type(_realm.group, name.UTF8String); - if (!table) { - return false; - } - - if ([_realm.schema schemaForClassName:name]) { - table->clear(); - } - else { - realm::ObjectStore::delete_data_for_object(_realm.group, name.UTF8String); - } - - return true; -} - -- (void)renamePropertyForClass:(NSString *)className oldName:(NSString *)oldName newName:(NSString *)newName { - const char *objectType = className.UTF8String; - realm::ObjectStore::rename_property(_realm.group, *_schema, objectType, oldName.UTF8String, newName.UTF8String); -} - -@end diff --git a/Pods/Realm/Realm/RLMNetworkClient.m b/Pods/Realm/Realm/RLMNetworkClient.m deleted file mode 100644 index ca8a1560..00000000 --- a/Pods/Realm/Realm/RLMNetworkClient.m +++ /dev/null @@ -1,229 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMNetworkClient.h" - -#import "RLMRealmConfiguration.h" -#import "RLMSyncErrorResponseModel.h" -#import "RLMSyncUtil_Private.h" - -typedef void(^RLMServerURLSessionCompletionBlock)(NSData *, NSURLResponse *, NSError *); - -static NSUInteger const kHTTPCodeRange = 100; - -typedef enum : NSUInteger { - Informational = 1, // 1XX - Success = 2, // 2XX - Redirection = 3, // 3XX - ClientError = 4, // 4XX - ServerError = 5, // 5XX -} RLMServerHTTPErrorCodeType; - -static NSRange RLM_rangeForErrorType(RLMServerHTTPErrorCodeType type) { - return NSMakeRange(type*100, kHTTPCodeRange); -} - -@implementation RLMNetworkClient - -+ (NSURLSession *)session { - return [NSURLSession sharedSession]; -} - -+ (NSURL *)urlForServer:(NSURL *)serverURL endpoint:(RLMServerEndpoint)endpoint { - NSString *pathComponent = nil; - switch (endpoint) { - case RLMServerEndpointAuth: - pathComponent = @"auth"; - break; - case RLMServerEndpointLogout: - // TODO: fix this - pathComponent = @"logout"; - NSAssert(NO, @"logout endpoint isn't implemented yet, don't use it"); - break; - case RLMServerEndpointAddCredentials: - // TODO: fix this - pathComponent = @"addCredentials"; - NSAssert(NO, @"add credentials endpoint isn't implemented yet, don't use it"); - break; - case RLMServerEndpointRemoveCredentials: - // TODO: fix this - pathComponent = @"removeCredentials"; - NSAssert(NO, @"remove credentials endpoint isn't implemented yet, don't use it"); - break; - } - NSAssert(pathComponent != nil, @"Unrecognized value for RLMServerEndpoint enum"); - return [serverURL URLByAppendingPathComponent:pathComponent]; -} - -+ (void)postRequestToEndpoint:(RLMServerEndpoint)endpoint - server:(NSURL *)serverURL - JSON:(NSDictionary *)jsonDictionary - completion:(RLMSyncCompletionBlock)completionBlock { - static NSTimeInterval const defaultTimeout = 60; - [self postRequestToEndpoint:endpoint - server:serverURL - JSON:jsonDictionary - timeout:defaultTimeout - completion:completionBlock]; -} - -// FIXME: should completion argument also pass back the NSURLResponse and/or the raw data? -+ (void)postRequestToEndpoint:(RLMServerEndpoint)endpoint - server:(NSURL *)serverURL - JSON:(NSDictionary *)jsonDictionary - timeout:(NSTimeInterval)timeout - completion:(RLMSyncCompletionBlock)completionBlock { - - NSError *localError = nil; - - // Attempt to convert the JSON - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonDictionary - options:(NSJSONWritingOptions)0 - error:&localError]; - if (!jsonData) { - completionBlock(localError, nil); - return; - } - - // Create the request - NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[self urlForServer:serverURL endpoint:endpoint]]; - request.HTTPBody = jsonData; - request.HTTPMethod = @"POST"; - request.timeoutInterval = MAX(timeout, 10); - [request addValue:@"application/json;charset=utf-8" forHTTPHeaderField:@"Content-Type"]; - [request addValue:@"application/json" forHTTPHeaderField:@"Accept"]; - - RLMServerURLSessionCompletionBlock handler = ^(NSData *data, - NSURLResponse *response, - NSError *error) { - if (error != nil) { - // Network error - completionBlock(error, nil); - return; - } - - NSError *localError = nil; - - if (![self validateResponse:response data:data error:&localError]) { - // Response error - completionBlock(localError, nil); - return; - } - - // Parse out the JSON - id json = [NSJSONSerialization JSONObjectWithData:data - options:(NSJSONReadingOptions)0 - error:&localError]; - if (!json || localError) { - // JSON parsing error - completionBlock(localError, nil); - } else if (![json isKindOfClass:[NSDictionary class]]) { - // JSON response malformed - localError = [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorBadResponse - userInfo:@{kRLMSyncErrorJSONKey: json}]; - completionBlock(localError, nil); - } else { - // JSON parsed successfully - completionBlock(nil, (NSDictionary *)json); - } - }; - - // Add the request to a task and start it - NSURLSessionTask *task = [self.session dataTaskWithRequest:request - completionHandler:handler]; - [task resume]; -} - -+ (BOOL)validateResponse:(NSURLResponse *)response data:(NSData *)data error:(NSError * __autoreleasing *)error { - __autoreleasing NSError *localError = nil; - if (!error) { - error = &localError; - } - - if (![response isKindOfClass:[NSHTTPURLResponse class]]) { - // FIXME: Provide error message - *error = [NSError errorWithDomain:RLMSyncErrorDomain code:RLMSyncErrorBadResponse userInfo:nil]; - return NO; - } - - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; - BOOL badResponse = (NSLocationInRange(httpResponse.statusCode, RLM_rangeForErrorType(ClientError)) - || NSLocationInRange(httpResponse.statusCode, RLM_rangeForErrorType(ServerError))); - if (badResponse) { - NSError *responseError = [self errorFromResponseData:data]; - if (responseError && responseError.userInfo[kRLMSyncErrorStatusCodeKey]) { - switch (responseError.code) { - case RLMSyncAuthErrorInvalidCredential: - case RLMSyncAuthErrorUserDoesNotExist: - case RLMSyncAuthErrorUserAlreadyExists: - // Authentication error - *error = responseError; - break; - - default: - // HTTP status error with some additional infor from the server - *error = [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorHTTPStatusCodeError - userInfo:responseError.userInfo]; - break; - } - } else { - // Fallback to HTTP status error without any additional info - *error = [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorHTTPStatusCodeError - userInfo:@{kRLMSyncErrorStatusCodeKey: @(httpResponse.statusCode)}]; - } - - return NO; - } - - if (!data) { - // FIXME: provide error message - *error = [NSError errorWithDomain:RLMSyncErrorDomain code:RLMSyncErrorBadResponse userInfo:nil]; - return NO; - } - - return YES; -} - -+ (NSError *)errorFromResponseData:(NSData *)data { - if (data.length == 0) { - return nil; - } - - id json = [NSJSONSerialization JSONObjectWithData:data - options:(NSJSONReadingOptions)0 - error:nil]; - if (!json || ![json isKindOfClass:[NSDictionary class]]) { - return nil; - } - - RLMSyncErrorResponseModel *responseModel = [[RLMSyncErrorResponseModel alloc] initWithDictionary:json]; - if (!responseModel) { - return nil; - } - - NSMutableDictionary *mutableUserInfo = [NSMutableDictionary dictionaryWithObject:@(responseModel.status) forKey:kRLMSyncErrorStatusCodeKey]; - [mutableUserInfo setValue:responseModel.title forKey:NSLocalizedDescriptionKey]; - [mutableUserInfo setValue:responseModel.hint forKey:NSLocalizedRecoverySuggestionErrorKey]; - - return [NSError errorWithDomain:RLMSyncErrorDomain code:responseModel.code userInfo:mutableUserInfo]; -} - -@end diff --git a/Pods/Realm/Realm/RLMObject.mm b/Pods/Realm/Realm/RLMObject.mm deleted file mode 100644 index c4878d7f..00000000 --- a/Pods/Realm/Realm/RLMObject.mm +++ /dev/null @@ -1,379 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMObject_Private.hpp" - -#import "RLMAccessor.h" -#import "RLMArray.h" -#import "RLMCollection_Private.hpp" -#import "RLMObjectSchema_Private.hpp" -#import "RLMObjectStore.h" -#import "RLMProperty.h" -#import "RLMQueryUtil.hpp" -#import "RLMRealm_Private.hpp" -#import "RLMSchema_Private.h" - -#import "collection_notifications.hpp" -#import "object.hpp" - -@interface RLMPropertyChange () -@property (nonatomic, readwrite, strong) NSString *name; -@property (nonatomic, readwrite, strong, nullable) id previousValue; -@property (nonatomic, readwrite, strong, nullable) id value; -@end - -// We declare things in RLMObject which are actually implemented in RLMObjectBase -// for documentation's sake, which leads to -Wunimplemented-method warnings. -// Other alternatives to this would be to disable -Wunimplemented-method for this -// file (but then we could miss legitimately missing things), or declaring the -// inherited things in a category (but they currently aren't nicely grouped for -// that). -@implementation RLMObject - -// synthesized in RLMObjectBase -@dynamic invalidated, realm, objectSchema; - -#pragma mark - Designated Initializers - -- (instancetype)init { - return [super init]; -} - -- (instancetype)initWithValue:(id)value schema:(RLMSchema *)schema { - return [super initWithValue:value schema:schema]; -} - -- (instancetype)initWithRealm:(__unsafe_unretained RLMRealm *const)realm schema:(RLMObjectSchema *)schema { - return [super initWithRealm:realm schema:schema]; -} - -#pragma mark - Convenience Initializers - -- (instancetype)initWithValue:(id)value { - [self.class sharedSchema]; // ensure this class' objectSchema is loaded in the partialSharedSchema - RLMSchema *schema = RLMSchema.partialSharedSchema; - return [super initWithValue:value schema:schema]; -} - -#pragma mark - Class-based Object Creation - -+ (instancetype)createInDefaultRealmWithValue:(id)value { - return (RLMObject *)RLMCreateObjectInRealmWithValue([RLMRealm defaultRealm], [self className], value, false); -} - -+ (instancetype)createInRealm:(RLMRealm *)realm withValue:(id)value { - return (RLMObject *)RLMCreateObjectInRealmWithValue(realm, [self className], value, false); -} - -+ (instancetype)createOrUpdateInDefaultRealmWithValue:(id)value { - return [self createOrUpdateInRealm:[RLMRealm defaultRealm] withValue:value]; -} - -+ (instancetype)createOrUpdateInRealm:(RLMRealm *)realm withValue:(id)value { - // verify primary key - RLMObjectSchema *schema = [self sharedSchema]; - if (!schema.primaryKeyProperty) { - NSString *reason = [NSString stringWithFormat:@"'%@' does not have a primary key and can not be updated", schema.className]; - @throw [NSException exceptionWithName:@"RLMExecption" reason:reason userInfo:nil]; - } - return (RLMObject *)RLMCreateObjectInRealmWithValue(realm, [self className], value, true); -} - -#pragma mark - Subscripting - -- (id)objectForKeyedSubscript:(NSString *)key { - return RLMObjectBaseObjectForKeyedSubscript(self, key); -} - -- (void)setObject:(id)obj forKeyedSubscript:(NSString *)key { - RLMObjectBaseSetObjectForKeyedSubscript(self, key, obj); -} - -#pragma mark - Getting & Querying - -+ (RLMResults *)allObjects { - return RLMGetObjects(RLMRealm.defaultRealm, self.className, nil); -} - -+ (RLMResults *)allObjectsInRealm:(RLMRealm *)realm { - return RLMGetObjects(realm, self.className, nil); -} - -+ (RLMResults *)objectsWhere:(NSString *)predicateFormat, ... { - va_list args; - va_start(args, predicateFormat); - RLMResults *results = [self objectsWhere:predicateFormat args:args]; - va_end(args); - return results; -} - -+ (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args { - return [self objectsWithPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]]; -} - -+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat, ... { - va_list args; - va_start(args, predicateFormat); - RLMResults *results = [self objectsInRealm:realm where:predicateFormat args:args]; - va_end(args); - return results; -} - -+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat args:(va_list)args { - return [self objectsInRealm:realm withPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]]; -} - -+ (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate { - return RLMGetObjects(RLMRealm.defaultRealm, self.className, predicate); -} - -+ (RLMResults *)objectsInRealm:(RLMRealm *)realm withPredicate:(NSPredicate *)predicate { - return RLMGetObjects(realm, self.className, predicate); -} - -+ (instancetype)objectForPrimaryKey:(id)primaryKey { - return RLMGetObject(RLMRealm.defaultRealm, self.className, primaryKey); -} - -+ (instancetype)objectInRealm:(RLMRealm *)realm forPrimaryKey:(id)primaryKey { - return RLMGetObject(realm, self.className, primaryKey); -} - -#pragma mark - Other Instance Methods - -- (BOOL)isEqualToObject:(RLMObject *)object { - return [object isKindOfClass:RLMObject.class] && RLMObjectBaseAreEqual(self, object); -} - -- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block { - return RLMObjectAddNotificationBlock(self, ^(NSArray *propertyNames, - NSArray *oldValues, NSArray *newValues, NSError *error) { - if (error) { - block(false, nil, error); - } - else if (!propertyNames) { - block(true, nil, nil); - } - else { - auto properties = [NSMutableArray arrayWithCapacity:propertyNames.count]; - for (NSUInteger i = 0, count = propertyNames.count; i < count; ++i) { - auto prop = [RLMPropertyChange new]; - prop.name = propertyNames[i]; - prop.previousValue = RLMCoerceToNil(oldValues[i]); - prop.value = RLMCoerceToNil(newValues[i]); - [properties addObject:prop]; - } - block(false, properties, nil); - } - }); -} - -+ (NSString *)className { - return [super className]; -} - -#pragma mark - Default values for schema definition - -+ (NSArray *)indexedProperties { - return @[]; -} - -+ (NSDictionary *)linkingObjectsProperties { - return @{}; -} - -+ (NSDictionary *)defaultPropertyValues { - return nil; -} - -+ (NSString *)primaryKey { - return nil; -} - -+ (NSArray *)ignoredProperties { - return nil; -} - -+ (NSArray *)requiredProperties { - return @[]; -} - -@end - -@implementation RLMDynamicObject - -+ (BOOL)shouldIncludeInDefaultSchema { - return NO; -} - -- (id)valueForUndefinedKey:(NSString *)key { - return RLMDynamicGetByName(self, key, false); -} - -- (void)setValue:(id)value forUndefinedKey:(NSString *)key { - RLMDynamicValidatedSet(self, key, value); -} - -@end - -@implementation RLMWeakObjectHandle { - realm::Row _row; - RLMClassInfo *_info; - Class _objectClass; -} - -- (instancetype)initWithObject:(RLMObjectBase *)object { - if (!(self = [super init])) { - return nil; - } - - _row = object->_row; - _info = object->_info; - _objectClass = object.class; - - return self; -} - -- (RLMObjectBase *)object { - RLMObjectBase *object = RLMCreateManagedAccessor(_objectClass, _info->realm, _info); - object->_row = std::move(_row); - return object; -} - -- (id)copyWithZone:(__unused NSZone *)zone { - RLMWeakObjectHandle *copy = [[RLMWeakObjectHandle alloc] init]; - copy->_row = _row; - copy->_info = _info; - copy->_objectClass = _objectClass; - return copy; -} - -@end - -@interface RLMObjectNotificationToken : RLMCancellationToken -@end -@implementation RLMObjectNotificationToken { -@public - realm::Object _object; -} -@end - -RLMNotificationToken *RLMObjectAddNotificationBlock(RLMObjectBase *obj, RLMObjectNotificationCallback block) { - if (!obj->_realm) { - @throw RLMException(@"Only objects which are managed by a Realm support change notifications"); - } - [obj->_realm verifyNotificationsAreSupported]; - - struct { - void (^block)(NSArray *, NSArray *, NSArray *, NSError *); - RLMObjectBase *object; - - NSArray *propertyNames = nil; - NSArray *oldValues = nil; - bool deleted = false; - - void populateProperties(realm::CollectionChangeSet const& c) { - if (propertyNames) { - return; - } - if (!c.deletions.empty()) { - deleted = true; - return; - } - if (c.columns.empty()) { - return; - } - - auto properties = [NSMutableArray new]; - for (size_t i = 0; i < c.columns.size(); ++i) { - if (c.columns[i].empty()) { - continue; - } - if (auto prop = object->_info->propertyForTableColumn(i)) { - [properties addObject:prop.name]; - } - } - if (properties.count) { - propertyNames = properties; - } - } - - NSArray *readValues(realm::CollectionChangeSet const& c) { - if (c.empty()) { - return nil; - } - populateProperties(c); - if (!propertyNames) { - return nil; - } - - auto values = [NSMutableArray arrayWithCapacity:propertyNames.count]; - for (NSString *name in propertyNames) { - id value = [object valueForKey:name]; - if (!value || [value isKindOfClass:[RLMArray class]]) { - [values addObject:NSNull.null]; - } - else { - [values addObject:value]; - } - } - return values; - } - - void before(realm::CollectionChangeSet const& c) { - @autoreleasepool { - oldValues = readValues(c); - } - } - - void after(realm::CollectionChangeSet const& c) { - @autoreleasepool { - auto newValues = readValues(c); - if (deleted) { - block(nil, nil, nil, nil); - } - else if (newValues) { - block(propertyNames, oldValues, newValues, nil); - } - propertyNames = nil; - oldValues = nil; - } - } - - void error(std::exception_ptr err) { - @autoreleasepool { - try { - rethrow_exception(err); - } - catch (...) { - NSError *error = nil; - RLMRealmTranslateException(&error); - block(nil, nil, nil, error); - } - } - } - } callback{block, obj}; - - realm::Object object(obj->_realm->_realm, *obj->_info->objectSchema, obj->_row); - auto token = [[RLMObjectNotificationToken alloc] initWithToken:object.add_notification_block(callback) realm:obj->_realm]; - token->_object = std::move(object); - return token; -} - -@implementation RLMPropertyChange -@end diff --git a/Pods/Realm/Realm/RLMObjectBase.mm b/Pods/Realm/Realm/RLMObjectBase.mm deleted file mode 100644 index e90f3940..00000000 --- a/Pods/Realm/Realm/RLMObjectBase.mm +++ /dev/null @@ -1,487 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMObject_Private.hpp" - -#import "RLMAccessor.h" -#import "RLMArray_Private.hpp" -#import "RLMListBase.h" -#import "RLMObjectSchema_Private.hpp" -#import "RLMObjectStore.h" -#import "RLMObservation.hpp" -#import "RLMOptionalBase.h" -#import "RLMProperty_Private.h" -#import "RLMRealm_Private.hpp" -#import "RLMSchema_Private.h" -#import "RLMSwiftSupport.h" -#import "RLMThreadSafeReference_Private.hpp" -#import "RLMUtil.hpp" - -#import "object.hpp" - -using namespace realm; - -const NSUInteger RLMDescriptionMaxDepth = 5; - -static bool maybeInitObjectSchemaForUnmanaged(RLMObjectBase *obj) { - obj->_objectSchema = [obj.class sharedSchema]; - if (!obj->_objectSchema) { - return false; - } - - // set default values - if (!obj->_objectSchema.isSwiftClass) { - NSDictionary *dict = RLMDefaultValuesForObjectSchema(obj->_objectSchema); - for (NSString *key in dict) { - [obj setValue:dict[key] forKey:key]; - } - } - - // set unmanaged accessor class - object_setClass(obj, obj->_objectSchema.unmanagedClass); - return true; -} - -@interface RLMObjectBase () -@end - -@implementation RLMObjectBase -// unmanaged init -- (instancetype)init { - if ((self = [super init])) { - maybeInitObjectSchemaForUnmanaged(self); - } - return self; -} - -- (void)dealloc { - // This can't be a unique_ptr because associated objects are removed - // *after* c++ members are destroyed and dealloc is called, and we need it - // to be in a validish state when that happens - delete _observationInfo; - _observationInfo = nullptr; -} - -static id validatedObjectForProperty(id obj, RLMProperty *prop, RLMSchema *schema) { - if (RLMIsObjectValidForProperty(obj, prop)) { - return obj; - } - - // check for object or array of properties - if (prop.type == RLMPropertyTypeObject) { - // for object create and try to initialize with obj - RLMObjectSchema *objSchema = schema[prop.objectClassName]; - return [[objSchema.objectClass alloc] initWithValue:obj schema:schema]; - } - else if (prop.type == RLMPropertyTypeArray && [obj conformsToProtocol:@protocol(NSFastEnumeration)]) { - // for arrays, create objects for each element and return new array - RLMObjectSchema *objSchema = schema[prop.objectClassName]; - RLMArray *objects = [[RLMArray alloc] initWithObjectClassName:objSchema.className]; - for (id el in obj) { - [objects addObject:[[objSchema.objectClass alloc] initWithValue:el schema:schema]]; - } - return objects; - } - - // if not convertible to prop throw - @throw RLMException(@"Invalid value '%@' for property '%@'", obj, prop.name); -} - -- (instancetype)initWithValue:(id)value schema:(RLMSchema *)schema { - if (!(self = [super init])) { - return self; - } - - if (!maybeInitObjectSchemaForUnmanaged(self)) { - // Don't populate fields from the passed-in object if we're called - // during schema init - return self; - } - - NSArray *properties = _objectSchema.properties; - if (NSArray *array = RLMDynamicCast(value)) { - if (array.count != properties.count) { - @throw RLMException(@"Invalid array input. Number of array elements does not match number of properties."); - } - for (NSUInteger i = 0; i < array.count; i++) { - id propertyValue = validatedObjectForProperty(array[i], properties[i], schema); - [self setValue:RLMCoerceToNil(propertyValue) forKeyPath:[properties[i] name]]; - } - } - else if (value) { - // assume our object is an NSDictionary or an object with kvc properties - NSDictionary *defaultValues = nil; - for (RLMProperty *prop in properties) { - id obj = RLMValidatedValueForProperty(value, prop.name, _objectSchema.className); - - // get default for nil object - if (!obj) { - if (!defaultValues) { - defaultValues = RLMDefaultValuesForObjectSchema(_objectSchema); - } - obj = defaultValues[prop.name]; - } - - // don't set unspecified properties - if (!obj) { - continue; - } - - obj = validatedObjectForProperty(obj, prop, schema); - [self setValue:RLMCoerceToNil(obj) forKeyPath:prop.name]; - } - } else { - @throw RLMException(@"Must provide a non-nil value."); - } - - return self; -} - -id RLMCreateManagedAccessor(Class cls, __unsafe_unretained RLMRealm *realm, RLMClassInfo *info) { - RLMObjectBase *obj = [[cls alloc] initWithRealm:realm schema:info->rlmObjectSchema]; - obj->_info = info; - return obj; -} - -- (instancetype)initWithRealm:(__unsafe_unretained RLMRealm *const)realm - schema:(RLMObjectSchema *)schema { - self = [super init]; - if (self) { - _realm = realm; - _objectSchema = schema; - } - return self; -} - -- (id)valueForKey:(NSString *)key { - if (_observationInfo) { - return _observationInfo->valueForKey(key); - } - return [super valueForKey:key]; -} - -// Generic Swift properties can't be dynamic, so KVO doesn't work for them by default -- (id)valueForUndefinedKey:(NSString *)key { - if (Ivar ivar = _objectSchema[key].swiftIvar) { - return RLMCoerceToNil(object_getIvar(self, ivar)); - } - return [super valueForUndefinedKey:key]; -} - -- (void)setValue:(id)value forUndefinedKey:(NSString *)key { - RLMProperty *property = _objectSchema[key]; - if (Ivar ivar = property.swiftIvar) { - if (property.type == RLMPropertyTypeArray && [value conformsToProtocol:@protocol(NSFastEnumeration)]) { - RLMArray *array = [object_getIvar(self, ivar) _rlmArray]; - [array removeAllObjects]; - [array addObjects:value]; - } - else if (property.optional) { - RLMOptionalBase *optional = object_getIvar(self, ivar); - optional.underlyingValue = value; - } - return; - } - [super setValue:value forUndefinedKey:key]; -} - -// overridden at runtime per-class for performance -+ (NSString *)className { - NSString *className = NSStringFromClass(self); - if ([RLMSwiftSupport isSwiftClassName:className]) { - className = [RLMSwiftSupport demangleClassName:className]; - } - return className; -} - -// overridden at runtime per-class for performance -+ (RLMObjectSchema *)sharedSchema { - return [RLMSchema sharedSchemaForClass:self.class]; -} - -+ (Class)objectUtilClass:(BOOL)isSwift { - return RLMObjectUtilClass(isSwift); -} - -- (NSString *)description -{ - if (self.isInvalidated) { - return @"[invalid object]"; - } - - return [self descriptionWithMaxDepth:RLMDescriptionMaxDepth]; -} - -- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth { - if (depth == 0) { - return @""; - } - - NSString *baseClassName = _objectSchema.className; - NSMutableString *mString = [NSMutableString stringWithFormat:@"%@ {\n", baseClassName]; - - for (RLMProperty *property in _objectSchema.properties) { - id object = RLMObjectBaseObjectForKeyedSubscript(self, property.name); - NSString *sub; - if ([object respondsToSelector:@selector(descriptionWithMaxDepth:)]) { - sub = [object descriptionWithMaxDepth:depth - 1]; - } - else if (property.type == RLMPropertyTypeData) { - static NSUInteger maxPrintedDataLength = 24; - NSData *data = object; - NSUInteger length = data.length; - if (length > maxPrintedDataLength) { - data = [NSData dataWithBytes:data.bytes length:maxPrintedDataLength]; - } - NSString *dataDescription = [data description]; - sub = [NSString stringWithFormat:@"<%@ — %lu total bytes>", [dataDescription substringWithRange:NSMakeRange(1, dataDescription.length - 2)], (unsigned long)length]; - } - else { - sub = [object description]; - } - [mString appendFormat:@"\t%@ = %@;\n", property.name, [sub stringByReplacingOccurrencesOfString:@"\n" withString:@"\n\t"]]; - } - [mString appendString:@"}"]; - - return [NSString stringWithString:mString]; -} - -- (RLMRealm *)realm { - return _realm; -} - -- (RLMObjectSchema *)objectSchema { - return _objectSchema; -} - -- (BOOL)isInvalidated { - // if not unmanaged and our accessor has been detached, we have been deleted - return self.class == _objectSchema.accessorClass && !_row.is_attached(); -} - -- (BOOL)isEqual:(id)object { - if (RLMObjectBase *other = RLMDynamicCast(object)) { - if (_objectSchema.primaryKeyProperty) { - return RLMObjectBaseAreEqual(self, other); - } - } - return [super isEqual:object]; -} - -- (NSUInteger)hash { - if (_objectSchema.primaryKeyProperty) { - id primaryProperty = [self valueForKey:_objectSchema.primaryKeyProperty.name]; - - // modify the hash of our primary key value to avoid potential (although unlikely) collisions - return [primaryProperty hash] ^ 1; - } - else { - return [super hash]; - } -} - -+ (BOOL)shouldIncludeInDefaultSchema { - return RLMIsObjectSubclass(self); -} - -+ (NSString *)_realmObjectName { - return nil; -} - -- (id)mutableArrayValueForKey:(NSString *)key { - id obj = [self valueForKey:key]; - if ([obj isKindOfClass:[RLMArray class]]) { - return obj; - } - return [super mutableArrayValueForKey:key]; -} - -- (void)addObserver:(id)observer - forKeyPath:(NSString *)keyPath - options:(NSKeyValueObservingOptions)options - context:(void *)context { - if (!_observationInfo) { - _observationInfo = new RLMObservationInfo(self); - } - _observationInfo->recordObserver(_row, _info, _objectSchema, keyPath); - - [super addObserver:observer forKeyPath:keyPath options:options context:context]; -} - -- (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath { - [super removeObserver:observer forKeyPath:keyPath]; - if (_observationInfo) - _observationInfo->removeObserver(); -} - -+ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key { - const char *className = class_getName(self); - const char accessorClassPrefix[] = "RLMAccessor_"; - if (!strncmp(className, accessorClassPrefix, sizeof(accessorClassPrefix) - 1)) { - if (self.sharedSchema[key]) { - return NO; - } - } - - return [super automaticallyNotifiesObserversForKey:key]; -} - -#pragma mark - Thread Confined Protocol Conformance - -- (std::unique_ptr)makeThreadSafeReference { - Object object(_realm->_realm, *_info->objectSchema, _row); - realm::ThreadSafeReference reference = _realm->_realm->obtain_thread_safe_reference(std::move(object)); - return std::make_unique>(std::move(reference)); -} - -- (id)objectiveCMetadata { - return nil; -} - -+ (instancetype)objectWithThreadSafeReference:(std::unique_ptr)reference - metadata:(__unused id)metadata - realm:(RLMRealm *)realm { - REALM_ASSERT_DEBUG(dynamic_cast *>(reference.get())); - auto object_reference = static_cast *>(reference.get()); - - Object object = realm->_realm->resolve_thread_safe_reference(std::move(*object_reference)); - if (!object.is_valid()) { - return nil; - } - NSString *objectClassName = @(object.get_object_schema().name.c_str()); - - return RLMCreateObjectAccessor(realm, realm->_info[objectClassName], object.row().get_index()); -} - -@end - -RLMRealm *RLMObjectBaseRealm(__unsafe_unretained RLMObjectBase *object) { - return object ? object->_realm : nil; -} - -RLMObjectSchema *RLMObjectBaseObjectSchema(__unsafe_unretained RLMObjectBase *object) { - return object ? object->_objectSchema : nil; -} - -id RLMObjectBaseObjectForKeyedSubscript(RLMObjectBase *object, NSString *key) { - if (!object) { - return nil; - } - - if (object->_realm) { - return RLMDynamicGetByName(object, key, false); - } - else { - return [object valueForKey:key]; - } -} - -void RLMObjectBaseSetObjectForKeyedSubscript(RLMObjectBase *object, NSString *key, id obj) { - if (!object) { - return; - } - - if (object->_realm) { - RLMDynamicValidatedSet(object, key, obj); - } - else { - [object setValue:obj forKey:key]; - } -} - - -BOOL RLMObjectBaseAreEqual(RLMObjectBase *o1, RLMObjectBase *o2) { - // if not the correct types throw - if ((o1 && ![o1 isKindOfClass:RLMObjectBase.class]) || (o2 && ![o2 isKindOfClass:RLMObjectBase.class])) { - @throw RLMException(@"Can only compare objects of class RLMObjectBase"); - } - // if identical object (or both are nil) - if (o1 == o2) { - return YES; - } - // if one is nil - if (o1 == nil || o2 == nil) { - return NO; - } - // if not in realm or differing realms - if (o1->_realm == nil || o1->_realm != o2->_realm) { - return NO; - } - // if either are detached - if (!o1->_row.is_attached() || !o2->_row.is_attached()) { - return NO; - } - // if table and index are the same - return o1->_row.get_table() == o2->_row.get_table() - && o1->_row.get_index() == o2->_row.get_index(); -} - -id RLMValidatedValueForProperty(id object, NSString *key, NSString *className) { - @try { - return [object valueForKey:key]; - } - @catch (NSException *e) { - if ([e.name isEqualToString:NSUndefinedKeyException]) { - @throw RLMException(@"Invalid value '%@' to initialize object of type '%@': missing key '%@'", - object, className, key); - } - @throw; - } -} - -Class RLMObjectUtilClass(BOOL isSwift) { - static Class objectUtilObjc = [RLMObjectUtil class]; - static Class objectUtilSwift = NSClassFromString(@"RealmSwiftObjectUtil"); - return isSwift && objectUtilSwift ? objectUtilSwift : objectUtilObjc; -} - -@implementation RLMObjectUtil - -+ (NSArray *)ignoredPropertiesForClass:(Class)cls { - return [cls ignoredProperties]; -} - -+ (NSArray *)indexedPropertiesForClass:(Class)cls { - return [cls indexedProperties]; -} - -+ (NSDictionary *)linkingObjectsPropertiesForClass:(Class)cls { - return [cls linkingObjectsProperties]; -} - -+ (NSDictionary *)linkingObjectProperties:(__unused id)object { - return nil; -} - -+ (NSArray *)getGenericListPropertyNames:(__unused id)obj { - return nil; -} - -+ (NSDictionary *)getLinkingObjectsProperties:(__unused id)obj { - return nil; -} - -+ (NSDictionary *)getOptionalProperties:(__unused id)obj { - return nil; -} - -+ (NSArray *)requiredPropertiesForClass:(Class)cls { - return [cls requiredProperties]; -} - -@end diff --git a/Pods/Realm/Realm/RLMObjectSchema.mm b/Pods/Realm/Realm/RLMObjectSchema.mm deleted file mode 100644 index fb195750..00000000 --- a/Pods/Realm/Realm/RLMObjectSchema.mm +++ /dev/null @@ -1,444 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMObjectSchema_Private.hpp" - -#import "RLMArray.h" -#import "RLMListBase.h" -#import "RLMObject_Private.h" -#import "RLMProperty_Private.hpp" -#import "RLMRealm_Dynamic.h" -#import "RLMRealm_Private.hpp" -#import "RLMSchema_Private.h" -#import "RLMSwiftSupport.h" -#import "RLMUtil.hpp" - -#import "object_store.hpp" - -using namespace realm; - -// private properties -@interface RLMObjectSchema () -@property (nonatomic, readwrite) NSDictionary *allPropertiesByName; -@property (nonatomic, readwrite) NSString *className; -@end - -@implementation RLMObjectSchema { - NSArray *_swiftGenericProperties; -} - -- (instancetype)initWithClassName:(NSString *)objectClassName objectClass:(Class)objectClass properties:(NSArray *)properties { - self = [super init]; - self.className = objectClassName; - self.properties = properties; - self.objectClass = objectClass; - self.accessorClass = objectClass; - self.unmanagedClass = objectClass; - return self; -} - -// return properties by name -- (RLMProperty *)objectForKeyedSubscript:(__unsafe_unretained NSString *const)key { - return _allPropertiesByName[key]; -} - -// create property map when setting property array -- (void)setProperties:(NSArray *)properties { - _properties = properties; - [self _propertiesDidChange]; -} - -- (void)setComputedProperties:(NSArray *)computedProperties { - _computedProperties = computedProperties; - [self _propertiesDidChange]; -} - -- (void)_propertiesDidChange { - NSMutableDictionary *map = [NSMutableDictionary dictionaryWithCapacity:_properties.count + _computedProperties.count]; - NSUInteger index = 0; - for (RLMProperty *prop in _properties) { - prop.index = index++; - map[prop.name] = prop; - if (prop.isPrimary) { - self.primaryKeyProperty = prop; - } - } - for (RLMProperty *prop in _computedProperties) { - map[prop.name] = prop; - } - _allPropertiesByName = map; -} - - -- (void)setPrimaryKeyProperty:(RLMProperty *)primaryKeyProperty { - _primaryKeyProperty.isPrimary = NO; - primaryKeyProperty.isPrimary = YES; - _primaryKeyProperty = primaryKeyProperty; -} - -+ (instancetype)schemaForObjectClass:(Class)objectClass { - RLMObjectSchema *schema = [RLMObjectSchema new]; - - // determine classname from objectclass as className method has not yet been updated - NSString *className = NSStringFromClass(objectClass); - bool isSwift = [RLMSwiftSupport isSwiftClassName:className]; - if (isSwift) { - className = [RLMSwiftSupport demangleClassName:className]; - } - schema.className = className; - schema.objectClass = objectClass; - schema.accessorClass = objectClass; - schema.isSwiftClass = isSwift; - - // create array of RLMProperties, inserting properties of superclasses first - Class cls = objectClass; - Class superClass = class_getSuperclass(cls); - NSArray *allProperties = @[]; - while (superClass && superClass != RLMObjectBase.class) { - allProperties = [[RLMObjectSchema propertiesForClass:cls isSwift:isSwift] arrayByAddingObjectsFromArray:allProperties]; - cls = superClass; - superClass = class_getSuperclass(superClass); - } - NSArray *persistedProperties = [allProperties filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(RLMProperty *property, NSDictionary *) { - return !RLMPropertyTypeIsComputed(property.type); - }]]; - schema.properties = persistedProperties; - - NSArray *computedProperties = [allProperties filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(RLMProperty *property, NSDictionary *) { - return RLMPropertyTypeIsComputed(property.type); - }]]; - schema.computedProperties = computedProperties; - - // verify that we didn't add any properties twice due to inheritance - if (allProperties.count != [NSSet setWithArray:[allProperties valueForKey:@"name"]].count) { - NSCountedSet *countedPropertyNames = [NSCountedSet setWithArray:[allProperties valueForKey:@"name"]]; - NSSet *duplicatePropertyNames = [countedPropertyNames filteredSetUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id object, NSDictionary *) { - return [countedPropertyNames countForObject:object] > 1; - }]]; - - if (duplicatePropertyNames.count == 1) { - @throw RLMException(@"Property '%@' is declared multiple times in the class hierarchy of '%@'", duplicatePropertyNames.allObjects.firstObject, className); - } else { - @throw RLMException(@"Object '%@' has properties that are declared multiple times in its class hierarchy: '%@'", className, [duplicatePropertyNames.allObjects componentsJoinedByString:@"', '"]); - } - } - - if (NSString *primaryKey = [objectClass primaryKey]) { - for (RLMProperty *prop in schema.properties) { - if ([primaryKey isEqualToString:prop.name]) { - prop.indexed = YES; - schema.primaryKeyProperty = prop; - break; - } - } - - if (!schema.primaryKeyProperty) { - @throw RLMException(@"Primary key property '%@' does not exist on object '%@'", primaryKey, className); - } - if (schema.primaryKeyProperty.type != RLMPropertyTypeInt && schema.primaryKeyProperty.type != RLMPropertyTypeString) { - @throw RLMException(@"Only 'string' and 'int' properties can be designated the primary key"); - } - } - - for (RLMProperty *prop in schema.properties) { - if (prop.optional && !RLMPropertyTypeIsNullable(prop.type)) { - @throw RLMException(@"Only 'string', 'binary', and 'object' properties can be made optional, and property '%@' is of type '%@'.", - prop.name, RLMTypeToString(prop.type)); - } - } - - return schema; -} - -+ (nullable NSString *)baseNameForLazySwiftProperty:(NSString *)propertyName { - // A Swift lazy var shows up as two separate children on the reflection tree: one named 'x', and another that is - // optional and is named 'x.storage'. Note that '.' is illegal in either a Swift or Objective-C property name. - NSString *const storageSuffix = @".storage"; - if ([propertyName hasSuffix:storageSuffix]) { - return [propertyName substringToIndex:propertyName.length - storageSuffix.length]; - } - return nil; -} - -+ (NSArray *)propertiesForClass:(Class)objectClass isSwift:(bool)isSwiftClass { - Class objectUtil = [objectClass objectUtilClass:isSwiftClass]; - NSArray *ignoredProperties = [objectUtil ignoredPropertiesForClass:objectClass]; - NSDictionary *linkingObjectsProperties = [objectUtil linkingObjectsPropertiesForClass:objectClass]; - - // For Swift classes we need an instance of the object when parsing properties - id swiftObjectInstance = isSwiftClass ? [[objectClass alloc] init] : nil; - - unsigned int count; - objc_property_t *props = class_copyPropertyList(objectClass, &count); - NSMutableArray *propArray = [NSMutableArray arrayWithCapacity:count]; - NSSet *indexed = [[NSSet alloc] initWithArray:[objectUtil indexedPropertiesForClass:objectClass]]; - for (unsigned int i = 0; i < count; i++) { - NSString *propertyName = @(property_getName(props[i])); - if ([ignoredProperties containsObject:propertyName]) { - continue; - } - - RLMProperty *prop = nil; - if (isSwiftClass) { - prop = [[RLMProperty alloc] initSwiftPropertyWithName:propertyName - indexed:[indexed containsObject:propertyName] - linkPropertyDescriptor:linkingObjectsProperties[propertyName] - property:props[i] - instance:swiftObjectInstance]; - } - else { - prop = [[RLMProperty alloc] initWithName:propertyName - indexed:[indexed containsObject:propertyName] - linkPropertyDescriptor:linkingObjectsProperties[propertyName] - property:props[i]]; - } - - if (prop) { - [propArray addObject:prop]; - } - } - free(props); - - if (isSwiftClass) { - // List<> properties don't show up as objective-C properties due to - // being generic, so use Swift reflection to get a list of them, and - // then access their ivars directly - for (NSString *propName in [objectUtil getGenericListPropertyNames:swiftObjectInstance]) { - Ivar ivar = class_getInstanceVariable(objectClass, propName.UTF8String); - id value = object_getIvar(swiftObjectInstance, ivar); - NSString *className = [value _rlmArray].objectClassName; - NSUInteger existing = [propArray indexOfObjectPassingTest:^BOOL(RLMProperty *obj, __unused NSUInteger idx, __unused BOOL *stop) { - return [obj.name isEqualToString:propName]; - }]; - if (existing != NSNotFound) { - [propArray removeObjectAtIndex:existing]; - } - [propArray addObject:[[RLMProperty alloc] initSwiftListPropertyWithName:propName - ivar:ivar - objectClassName:className]]; - } - - // Ditto for LinkingObjects<> properties. - NSDictionary *linkingObjectsProperties = [objectUtil getLinkingObjectsProperties:swiftObjectInstance]; - for (NSString *propName in linkingObjectsProperties) { - NSDictionary *info = linkingObjectsProperties[propName]; - Ivar ivar = class_getInstanceVariable(objectClass, propName.UTF8String); - - NSUInteger existing = [propArray indexOfObjectPassingTest:^BOOL(RLMProperty *obj, __unused NSUInteger idx, __unused BOOL *stop) { - return [obj.name isEqualToString:propName]; - }]; - if (existing != NSNotFound) { - [propArray removeObjectAtIndex:existing]; - } - - [propArray addObject:[[RLMProperty alloc] initSwiftLinkingObjectsPropertyWithName:propName - ivar:ivar - objectClassName:info[@"class"] - linkOriginPropertyName:info[@"property"]]]; - } - } - - if (auto optionalProperties = [objectUtil getOptionalProperties:swiftObjectInstance]) { - for (RLMProperty *property in propArray) { - property.optional = false; - } - [optionalProperties enumerateKeysAndObjectsUsingBlock:^(NSString *propertyName, NSNumber *propertyType, __unused BOOL *stop) { - if ([ignoredProperties containsObject:propertyName]) { - return; - } - NSUInteger existing = [propArray indexOfObjectPassingTest:^BOOL(RLMProperty *obj, __unused NSUInteger idx, __unused BOOL *stop) { - return [obj.name isEqualToString:propertyName]; - }]; - RLMProperty *property; - if (existing != NSNotFound) { - property = propArray[existing]; - property.optional = true; - } - if (auto type = RLMCoerceToNil(propertyType)) { - if (existing == NSNotFound) { - // Check to see if this optional property is an underlying storage property for a Swift lazy var. - // Managed lazy vars are't allowed. - // NOTE: Revisit this once property behaviors are implemented in Swift. - if (NSString *lazyPropertyBaseName = [self baseNameForLazySwiftProperty:propertyName]) { - if ([ignoredProperties containsObject:lazyPropertyBaseName]) { - // This property is the storage property for a ignored lazy Swift property. Just continue. - return; - } else { - @throw RLMException(@"Lazy managed property '%@' is not allowed on a Realm Swift object class. Either add the property to the ignored properties list or make it non-lazy.", lazyPropertyBaseName); - } - } - // The current property isn't a storage property for a lazy Swift property. - property = [[RLMProperty alloc] initSwiftOptionalPropertyWithName:propertyName - indexed:[indexed containsObject:propertyName] - ivar:class_getInstanceVariable(objectClass, propertyName.UTF8String) - propertyType:RLMPropertyType(type.intValue)]; - [propArray addObject:property]; - } - else { - property.type = RLMPropertyType(type.intValue); - } - } - }]; - } - if (auto requiredProperties = [objectUtil requiredPropertiesForClass:objectClass]) { - for (RLMProperty *property in propArray) { - bool required = [requiredProperties containsObject:property.name]; - if (required && property.type == RLMPropertyTypeObject) { - @throw RLMException(@"Object properties cannot be made required, " - "but '+[%@ requiredProperties]' included '%@'", objectClass, property.name); - } - property.optional &= !required; - } - } - - for (RLMProperty *property in propArray) { - if (!property.optional && property.type == RLMPropertyTypeObject) { // remove if/when core supports required link columns - @throw RLMException(@"The `%@.%@` property must be marked as being optional.", [objectClass className], property.name); - } - } - - return propArray; -} - -- (id)copyWithZone:(NSZone *)zone { - RLMObjectSchema *schema = [[RLMObjectSchema allocWithZone:zone] init]; - schema->_objectClass = _objectClass; - schema->_className = _className; - schema->_objectClass = _objectClass; - schema->_accessorClass = _objectClass; - schema->_unmanagedClass = _unmanagedClass; - schema->_isSwiftClass = _isSwiftClass; - - // call property setter to reset map and primary key - schema.properties = [[NSArray allocWithZone:zone] initWithArray:_properties copyItems:YES]; - schema.computedProperties = [[NSArray allocWithZone:zone] initWithArray:_computedProperties copyItems:YES]; - - return schema; -} - -- (BOOL)isEqualToObjectSchema:(RLMObjectSchema *)objectSchema { - if (objectSchema.properties.count != _properties.count) { - return NO; - } - - if (![_properties isEqualToArray:objectSchema.properties]) { - return NO; - } - if (![_computedProperties isEqualToArray:objectSchema.computedProperties]) { - return NO; - } - - return YES; -} - -- (NSString *)description { - NSMutableString *propertiesString = [NSMutableString string]; - for (RLMProperty *property in self.properties) { - [propertiesString appendFormat:@"\t%@\n", [property.description stringByReplacingOccurrencesOfString:@"\n" withString:@"\n\t"]]; - } - for (RLMProperty *property in self.computedProperties) { - [propertiesString appendFormat:@"\t%@\n", [property.description stringByReplacingOccurrencesOfString:@"\n" withString:@"\n\t"]]; - } - return [NSString stringWithFormat:@"%@ {\n%@}", self.className, propertiesString]; -} - -- (NSString *)objectName { - return [self.objectClass _realmObjectName] ?: _className; -} - -- (realm::ObjectSchema)objectStoreCopy { - ObjectSchema objectSchema; - objectSchema.name = self.objectName.UTF8String; - objectSchema.primary_key = _primaryKeyProperty ? _primaryKeyProperty.name.UTF8String : ""; - for (RLMProperty *prop in _properties) { - Property p = [prop objectStoreCopy]; - p.is_primary = (prop == _primaryKeyProperty); - objectSchema.persisted_properties.push_back(std::move(p)); - } - for (RLMProperty *prop in _computedProperties) { - objectSchema.computed_properties.push_back([prop objectStoreCopy]); - } - return objectSchema; -} - -+ (instancetype)objectSchemaForObjectStoreSchema:(realm::ObjectSchema const&)objectSchema { - RLMObjectSchema *schema = [RLMObjectSchema new]; - schema.className = @(objectSchema.name.c_str()); - - // create array of RLMProperties - NSMutableArray *properties = [NSMutableArray arrayWithCapacity:objectSchema.persisted_properties.size()]; - for (const Property &prop : objectSchema.persisted_properties) { - RLMProperty *property = [RLMProperty propertyForObjectStoreProperty:prop]; - property.isPrimary = (prop.name == objectSchema.primary_key); - [properties addObject:property]; - } - schema.properties = properties; - - NSMutableArray *computedProperties = [NSMutableArray arrayWithCapacity:objectSchema.computed_properties.size()]; - for (const Property &prop : objectSchema.computed_properties) { - [computedProperties addObject:[RLMProperty propertyForObjectStoreProperty:prop]]; - } - schema.computedProperties = computedProperties; - - // get primary key from realm metadata - if (objectSchema.primary_key.length()) { - NSString *primaryKeyString = [NSString stringWithUTF8String:objectSchema.primary_key.c_str()]; - schema.primaryKeyProperty = schema[primaryKeyString]; - if (!schema.primaryKeyProperty) { - @throw RLMException(@"No property matching primary key '%@'", primaryKeyString); - } - } - - // for dynamic schema use vanilla RLMDynamicObject accessor classes - schema.objectClass = RLMObject.class; - schema.accessorClass = RLMDynamicObject.class; - schema.unmanagedClass = RLMObject.class; - - return schema; -} - -- (NSArray *)swiftGenericProperties { - if (_swiftGenericProperties) { - return _swiftGenericProperties; - } - - // This check isn't semantically required, but avoiding accessing the local - // static helps perf in the obj-c case - if (!_isSwiftClass) { - return _swiftGenericProperties = @[]; - } - - // Check if it's a swift class using the obj-c API - static Class s_swiftObjectClass = NSClassFromString(@"RealmSwiftObject"); - if (![_accessorClass isSubclassOfClass:s_swiftObjectClass]) { - return _swiftGenericProperties = @[]; - } - - NSMutableArray *genericProperties = [NSMutableArray new]; - for (RLMProperty *prop in _properties) { - if (prop->_swiftIvar) { - [genericProperties addObject:prop]; - } - } - // Currently all computed properties are Swift generics - [genericProperties addObjectsFromArray:_computedProperties]; - - return _swiftGenericProperties = genericProperties; -} - -@end diff --git a/Pods/Realm/Realm/RLMObjectStore.mm b/Pods/Realm/Realm/RLMObjectStore.mm deleted file mode 100644 index 144748ca..00000000 --- a/Pods/Realm/Realm/RLMObjectStore.mm +++ /dev/null @@ -1,550 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMObjectStore.h" - -#import "RLMAccessor.h" -#import "RLMArray_Private.hpp" -#import "RLMListBase.h" -#import "RLMObservation.hpp" -#import "RLMObject_Private.hpp" -#import "RLMObjectSchema_Private.hpp" -#import "RLMOptionalBase.h" -#import "RLMProperty_Private.h" -#import "RLMQueryUtil.hpp" -#import "RLMRealm_Private.hpp" -#import "RLMSchema_Private.h" -#import "RLMSwiftSupport.h" -#import "RLMUtil.hpp" - -#import "object_store.hpp" -#import "results.hpp" -#import "shared_realm.hpp" - -#import - -using namespace realm; - -void RLMRealmCreateAccessors(RLMSchema *schema) { - for (RLMObjectSchema *objectSchema in schema.objectSchema) { - if (objectSchema.accessorClass != objectSchema.objectClass) { - continue; - } - - static unsigned long long count = 0; - NSString *prefix = [NSString stringWithFormat:@"RLMAccessor_%llu_", count++]; - objectSchema.accessorClass = RLMAccessorClassForObjectClass(objectSchema.objectClass, objectSchema, prefix); - } -} - -static inline void RLMVerifyRealmRead(__unsafe_unretained RLMRealm *const realm) { - if (!realm) { - @throw RLMException(@"Realm must not be nil"); - } - [realm verifyThread]; -} - -static inline void RLMVerifyInWriteTransaction(__unsafe_unretained RLMRealm *const realm) { - RLMVerifyRealmRead(realm); - // if realm is not writable throw - if (!realm.inWriteTransaction) { - @throw RLMException(@"Can only add, remove, or create objects in a Realm in a write transaction - call beginWriteTransaction on an RLMRealm instance first."); - } -} - -void RLMInitializeSwiftAccessorGenerics(__unsafe_unretained RLMObjectBase *const object) { - if (!object || !object->_row || !object->_objectSchema->_isSwiftClass) { - return; - } - if (![object isKindOfClass:object->_objectSchema.objectClass]) { - // It can be a different class if it's a dynamic object, and those don't - // require any init here (and would crash since they don't have the ivars) - return; - } - - for (RLMProperty *prop in object->_objectSchema.swiftGenericProperties) { - if (prop->_type == RLMPropertyTypeArray) { - RLMArray *array = [[RLMArrayLinkView alloc] initWithParent:object property:prop]; - [object_getIvar(object, prop.swiftIvar) set_rlmArray:array]; - } - else if (prop.type == RLMPropertyTypeLinkingObjects) { - id linkingObjects = object_getIvar(object, prop.swiftIvar); - [linkingObjects setObject:(id)[[RLMWeakObjectHandle alloc] initWithObject:object]]; - [linkingObjects setProperty:prop]; - } - else { - RLMOptionalBase *optional = object_getIvar(object, prop.swiftIvar); - optional.property = prop; - optional.object = object; - } - } -} - -static void validateValueForProperty(__unsafe_unretained id const obj, - __unsafe_unretained RLMProperty *const prop) { - switch (prop.type) { - case RLMPropertyTypeString: - case RLMPropertyTypeBool: - case RLMPropertyTypeDate: - case RLMPropertyTypeInt: - case RLMPropertyTypeFloat: - case RLMPropertyTypeDouble: - case RLMPropertyTypeData: - if (!RLMIsObjectValidForProperty(obj, prop)) { - @throw RLMException(@"Invalid value '%@' for property '%@'", obj, prop.name); - } - break; - case RLMPropertyTypeObject: - break; - case RLMPropertyTypeArray: { - if (obj != nil && obj != NSNull.null) { - if (![obj conformsToProtocol:@protocol(NSFastEnumeration)]) { - @throw RLMException(@"Array property value (%@) is not enumerable.", obj); - } - } - break; - } - case RLMPropertyTypeAny: - case RLMPropertyTypeLinkingObjects: - @throw RLMException(@"Invalid value '%@' for property '%@'", obj, prop.name); - } -} - -static NSUInteger createRowForObject(RLMClassInfo const& info) { - try { - return info.table()->add_empty_row(); - } - catch (std::exception const& e) { - @throw RLMException(e); - } -} - -/* If a row exists with the specified primary key value, return its index. Otherwise, return `realm::not_found`. - * - * Precondition: `info` must refer to a class which has a primary key property - * Precondition: `primaryValue` is a validated property value that has been coerced to `nil` - */ -static NSUInteger getRowForObjectWithPrimaryKey(RLMClassInfo const& info, id primaryValue) { - REALM_ASSERT_DEBUG(info.propertyForPrimaryKey()); - - RLMProperty *const primaryProperty = info.propertyForPrimaryKey(); - const NSUInteger primaryPropertyColumn = info.tableColumn(primaryProperty); - - switch (primaryProperty.type) { - case RLMPropertyTypeString: - return info.table()->find_first_string(primaryPropertyColumn, RLMStringDataWithNSString(primaryValue)); - - case RLMPropertyTypeInt: - if (primaryValue) { - return info.table()->find_first_int(primaryPropertyColumn, [primaryValue longLongValue]); - } else { - return info.table()->find_first_null(primaryPropertyColumn); - } - - default: - REALM_UNREACHABLE(); - } -} - -/* Create a row with the specified primary key value and return its index. - * - * Precondition: `info` must refer to a class which has a valid primary key property - * Precondition: a write transaction is in progress - * Precondition: no row already exists with the specified `primaryValue` for this model - */ -static NSUInteger createRowForObjectWithPrimaryKey(RLMClassInfo const& info, id primaryValue) { - REALM_ASSERT_DEBUG(info.propertyForPrimaryKey()); - REALM_ASSERT_DEBUG(info.realm.inWriteTransaction); - REALM_ASSERT_DEBUG(getRowForObjectWithPrimaryKey(info, primaryValue) == realm::not_found); - - RLMProperty *const primaryProperty = info.propertyForPrimaryKey(); - const NSUInteger primaryColumnIndex = info.tableColumn(primaryProperty); - - // create row - const NSUInteger rowIndex = createRowForObject(info); - Row row = info.table()->get(rowIndex); - - // set value for primary key - validateValueForProperty(primaryValue, primaryProperty); - primaryValue = RLMCoerceToNil(primaryValue); - - try { - switch (primaryProperty.type) { - case RLMPropertyTypeString: - REALM_ASSERT_DEBUG(!primaryValue || [primaryValue isKindOfClass:NSString.class]); - row.set_string_unique(primaryColumnIndex, RLMStringDataWithNSString(primaryValue)); - break; - - case RLMPropertyTypeInt: - if (primaryValue) { - REALM_ASSERT_DEBUG([primaryValue isKindOfClass:NSNumber.class]); - row.set_int_unique(primaryColumnIndex, [primaryValue longLongValue]); - } else { - row.set_null(primaryColumnIndex); // FIXME: Use `set_null_unique` once Core supports it - } - break; - - default: - REALM_UNREACHABLE(); - } - } - catch (std::exception const& e) { - @throw RLMException(e); - } - return rowIndex; -} - -/* If a row exists with the specified primary key value, returns its index. Otherwise, creates a new row with the - * specified primary key value and returns its index. The out parameter `foundExisting` will be set to indicate - * whether or not a new row was created. - * - * Precondition: `info` must refer to a class which has a valid primary key property - * Precondition: a write transaction is in progress - */ -static NSUInteger createOrGetRowForObjectWithPrimaryKey(RLMClassInfo const& info, id primaryValue, - bool* foundExisting = nullptr) { - REALM_ASSERT_DEBUG(info.propertyForPrimaryKey()); - REALM_ASSERT_DEBUG(info.realm.inWriteTransaction); - - const NSUInteger existingRow = getRowForObjectWithPrimaryKey(info, primaryValue); - if (existingRow == realm::not_found) { - *foundExisting = false; - return createRowForObjectWithPrimaryKey(info, primaryValue); - } else { - *foundExisting = true; - return existingRow; - } -} - -/* If the class has a primary key, calls `valueForProperty` with that key and creates or gets the row with - * this primary key value. Otherwise if the class has no primary key, creates a new row. The out parameter - * `foundExisting` will be set to indicate whether or not a new row was created. - * - * Precondition: a write transaction is in progress - */ -template -static NSUInteger createOrGetRowForObject(RLMClassInfo const& info, F valueForProperty, - bool createOrUpdate, bool* foundExisting) { - // try to get existing row if this class has a primary key - if (RLMProperty *primaryProperty = info.propertyForPrimaryKey()) { - // get primary value - const id primaryValue = valueForProperty(primaryProperty); - - // search for existing object based on primary key type, creating a new row if one does not exist - NSUInteger rowIndex = createOrGetRowForObjectWithPrimaryKey(info, RLMCoerceToNil(primaryValue), foundExisting); - - // ensure that `createOrUpdate` is set if we found an existing row - if (*foundExisting && !createOrUpdate) { - @throw RLMException(@"Can't create object with existing primary key value '%@'.", primaryValue); - } - return rowIndex; - } - // if no existing, create row - else { - *foundExisting = false; - return createRowForObject(info); - } -} - -void RLMAddObjectToRealm(__unsafe_unretained RLMObjectBase *const object, - __unsafe_unretained RLMRealm *const realm, - bool createOrUpdate) { - RLMVerifyInWriteTransaction(realm); - - // verify that object is unmanaged - if (object.invalidated) { - @throw RLMException(@"Adding a deleted or invalidated object to a Realm is not permitted"); - } - if (object->_realm) { - if (object->_realm == realm) { - // no-op - return; - } - // for differing realms users must explicitly create the object in the second realm - @throw RLMException(@"Object is already managed by another Realm"); - } - if (object->_observationInfo && object->_observationInfo->hasObservers()) { - @throw RLMException(@"Cannot add an object with observers to a Realm"); - } - - // set the realm and schema - NSString *objectClassName = object->_objectSchema.className; - auto& info = realm->_info[objectClassName]; - object->_info = &info; - object->_objectSchema = info.rlmObjectSchema; - object->_realm = realm; - - // get or create row - bool foundExisting; - auto primaryGetter = [=](__unsafe_unretained RLMProperty *const p) { return [object valueForKey:p.name]; }; - object->_row = (*info.table())[createOrGetRowForObject(info, primaryGetter, createOrUpdate, &foundExisting)]; - - RLMCreationOptions creationOptions = RLMCreationOptionsPromoteUnmanaged; - if (createOrUpdate) { - creationOptions |= RLMCreationOptionsCreateOrUpdate; - } - - // populate all properties - for (RLMProperty *prop in info.rlmObjectSchema.properties) { - // skip primary key when updating since it doesn't change - if (prop.isPrimary) - continue; - - // get object from ivar using key value coding - id value = nil; - if (prop.swiftIvar) { - if (prop.type == RLMPropertyTypeArray) { - value = static_cast(object_getIvar(object, prop.swiftIvar))._rlmArray; - } - else { // optional - value = static_cast(object_getIvar(object, prop.swiftIvar)).underlyingValue; - } - } - else if ([object respondsToSelector:prop.getterSel]) { - value = [object valueForKey:prop.getterName]; - } - - if (!value && !prop.optional) { - @throw RLMException(@"No value or default value specified for property '%@' in '%@'", - prop.name, info.rlmObjectSchema.className); - } - - // set the ivars for object and array properties to nil as otherwise the - // accessors retain objects that are no longer accessible via the properties - // this is mainly an issue when the object graph being added has cycles, - // as it's not obvious that the user has to set the *ivars* to nil to - // avoid leaking memory - if (prop.type == RLMPropertyTypeObject || prop.type == RLMPropertyTypeArray) { - if (!prop.swiftIvar) { - ((void(*)(id, SEL, id))objc_msgSend)(object, prop.setterSel, nil); - } - } - - // set in table with out validation - RLMDynamicSet(object, prop, RLMCoerceToNil(value), creationOptions); - } - - // set to proper accessor class - object_setClass(object, info.rlmObjectSchema.accessorClass); - - RLMInitializeSwiftAccessorGenerics(object); -} - -RLMObjectBase *RLMCreateObjectInRealmWithValue(RLMRealm *realm, NSString *className, id value, bool createOrUpdate = false) { - if (createOrUpdate && RLMIsObjectSubclass([value class])) { - RLMObjectBase *obj = value; - if ([obj->_objectSchema.className isEqualToString:className] && obj->_realm == realm) { - // This is a no-op if value is an RLMObject of the same type already backed by the target realm. - return value; - } - } - - // verify writable - RLMVerifyInWriteTransaction(realm); - - // create the object - auto& info = realm->_info[className]; - RLMObjectBase *object = RLMCreateManagedAccessor(info.rlmObjectSchema.accessorClass, realm, &info); - - RLMCreationOptions creationOptions = createOrUpdate ? RLMCreationOptionsCreateOrUpdate : RLMCreationOptionsNone; - - // create row, and populate - if (NSArray *array = RLMDynamicCast(value)) { - // get or create our accessor - bool foundExisting; - NSArray *props = info.rlmObjectSchema.properties; - auto primaryGetter = [=](__unsafe_unretained RLMProperty *const p) { - return array[[props indexOfObject:p]]; - }; - object->_row = (*info.table())[createOrGetRowForObject(info, primaryGetter, createOrUpdate, &foundExisting)]; - - // populate - for (NSUInteger i = 0; i < array.count; i++) { - RLMProperty *prop = props[i]; - - // skip primary key when updating since it doesn't change - if (prop.isPrimary) - continue; - - id val = array[i]; - validateValueForProperty(val, prop); - RLMDynamicSet(object, prop, RLMCoerceToNil(val), creationOptions); - } - } - else { - __block bool foundExisting = false; - __block NSDictionary *defaultValues = nil; - __block bool usedDefault = false; - auto getValue = ^(RLMProperty *prop) { - id propValue = RLMValidatedValueForProperty(value, prop.name, info.rlmObjectSchema.className); - usedDefault = !propValue && !foundExisting; - if (usedDefault) { - if (!defaultValues) { - defaultValues = RLMDefaultValuesForObjectSchema(info.rlmObjectSchema); - } - propValue = defaultValues[prop.name]; - if (!propValue && (prop.type == RLMPropertyTypeObject || prop.type == RLMPropertyTypeArray)) { - propValue = NSNull.null; - } - } - return propValue; - }; - // get or create our accessor - object->_row = (*info.table())[createOrGetRowForObject(info, getValue, createOrUpdate, &foundExisting)]; - - // populate - for (RLMProperty *prop in info.rlmObjectSchema.properties) { - // skip primary key when updating since it doesn't change - if (prop.isPrimary) - continue; - - if (id propValue = getValue(prop)) { - validateValueForProperty(propValue, prop); - // add SetDefault to creationoptions - RLMCreationOptions propertyCreationOptions = creationOptions; - if (usedDefault) { - propertyCreationOptions |= RLMCreationOptionsSetDefault; - } - RLMDynamicSet(object, prop, RLMCoerceToNil(propValue), propertyCreationOptions); - } - else if (!foundExisting && !prop.optional) { - @throw RLMException(@"Property '%@' of object of type '%@' cannot be nil.", prop.name, info.rlmObjectSchema.className); - } - } - } - - RLMInitializeSwiftAccessorGenerics(object); - return object; -} - -void RLMDeleteObjectFromRealm(__unsafe_unretained RLMObjectBase *const object, - __unsafe_unretained RLMRealm *const realm) { - if (realm != object->_realm) { - @throw RLMException(@"Can only delete an object from the Realm it belongs to."); - } - - RLMVerifyInWriteTransaction(object->_realm); - - // move last row to row we are deleting - if (object->_row.is_attached()) { - RLMTrackDeletions(realm, ^{ - object->_row.get_table()->move_last_over(object->_row.get_index()); - }); - } - - // set realm to nil - object->_realm = nil; -} - -void RLMDeleteAllObjectsFromRealm(RLMRealm *realm) { - RLMVerifyInWriteTransaction(realm); - - // clear table for each object schema - for (auto& info : realm->_info) { - RLMClearTable(info.second); - } -} - -RLMResults *RLMGetObjects(RLMRealm *realm, NSString *objectClassName, NSPredicate *predicate) { - RLMVerifyRealmRead(realm); - - // create view from table and predicate - RLMClassInfo& info = realm->_info[objectClassName]; - if (!info.table()) { - // read-only realms may be missing tables since we can't add any - // missing ones on init - return [RLMResults resultsWithObjectInfo:info results:{}]; - } - - if (predicate) { - realm::Query query = RLMPredicateToQuery(predicate, info.rlmObjectSchema, realm.schema, realm.group); - return [RLMResults resultsWithObjectInfo:info - results:realm::Results(realm->_realm, std::move(query))]; - } - - return [RLMResults resultsWithObjectInfo:info - results:realm::Results(realm->_realm, *info.table())]; -} - -id RLMGetObject(RLMRealm *realm, NSString *objectClassName, id key) { - RLMVerifyRealmRead(realm); - - RLMClassInfo& info = realm->_info[objectClassName]; - auto primaryProperty = info.objectSchema->primary_key_property(); - if (!primaryProperty) { - @throw RLMException(@"%@ does not have a primary key", objectClassName); - } - - auto table = info.table(); - if (!table) { - // read-only realms may be missing tables since we can't add any - // missing ones on init - return nil; - } - - key = RLMCoerceToNil(key); - if (!key && !primaryProperty->is_nullable) { - @throw RLMException(@"Invalid null value for non-nullable primary key."); - } - - size_t row = realm::not_found; - switch (primaryProperty->type) { - case PropertyType::String: { - NSString *string = RLMDynamicCast(key); - if (!key || string) { - row = table->find_first_string(primaryProperty->table_column, RLMStringDataWithNSString(string)); - } else { - @throw RLMException(@"Invalid value '%@' of type '%@' for string primary key.", key, [key class]); - } - break; - } - case PropertyType::Int: - if (NSNumber *number = RLMDynamicCast(key)) { - row = table->find_first_int(primaryProperty->table_column, number.longLongValue); - } else if (!key) { - row = table->find_first_null(primaryProperty->table_column); - } else { - @throw RLMException(@"Invalid value '%@' of type '%@' for int primary key.", key, [key class]); - } - break; - default: - REALM_UNREACHABLE(); - } - - if (row == realm::not_found) { - return nil; - } - - return RLMCreateObjectAccessor(realm, info, row); -} - -RLMObjectBase *RLMCreateObjectAccessor(__unsafe_unretained RLMRealm *const realm, - RLMClassInfo& info, - NSUInteger index) { - return RLMCreateObjectAccessor(realm, info, (*info.table())[index]); -} - -// Create accessor and register with realm -RLMObjectBase *RLMCreateObjectAccessor(__unsafe_unretained RLMRealm *const realm, - RLMClassInfo& info, - realm::RowExpr row) { - RLMObjectBase *accessor = RLMCreateManagedAccessor(info.rlmObjectSchema.accessorClass, realm, &info); - accessor->_row = row; - RLMInitializeSwiftAccessorGenerics(accessor); - return accessor; -} diff --git a/Pods/Realm/Realm/RLMObservation.mm b/Pods/Realm/Realm/RLMObservation.mm deleted file mode 100644 index e6538b63..00000000 --- a/Pods/Realm/Realm/RLMObservation.mm +++ /dev/null @@ -1,500 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMObservation.hpp" - -#import "RLMAccessor.h" -#import "RLMArray_Private.hpp" -#import "RLMListBase.h" -#import "RLMObjectSchema_Private.hpp" -#import "RLMObject_Private.hpp" -#import "RLMProperty_Private.h" -#import "RLMRealm_Private.hpp" - -#import - -using namespace realm; - -namespace { - template - struct IteratorPair { - Iterator first; - Iterator second; - }; - template - Iterator begin(IteratorPair const& p) { - return p.first; - } - template - Iterator end(IteratorPair const& p) { - return p.second; - } - - template - auto reverse(Container const& c) { - return IteratorPair{c.rbegin(), c.rend()}; - } -} - -RLMObservationInfo::RLMObservationInfo(RLMClassInfo &objectSchema, std::size_t row, id object) -: object(object) -, objectSchema(&objectSchema) -{ - setRow(*objectSchema.table(), row); -} - -RLMObservationInfo::RLMObservationInfo(id object) -: object(object) -{ -} - -RLMObservationInfo::~RLMObservationInfo() { - if (prev) { - // Not the head of the linked list, so just detach from the list - REALM_ASSERT_DEBUG(prev->next == this); - prev->next = next; - if (next) { - REALM_ASSERT_DEBUG(next->prev == this); - next->prev = prev; - } - } - else if (objectSchema) { - // The head of the list, so remove self from the object schema's array - // of observation info, either replacing self with the next info or - // removing entirely if there is no next - auto end = objectSchema->observedObjects.end(); - auto it = find(objectSchema->observedObjects.begin(), end, this); - if (it != end) { - if (next) { - *it = next; - next->prev = nullptr; - } - else { - iter_swap(it, std::prev(end)); - objectSchema->observedObjects.pop_back(); - } - } - } - // Otherwise the observed object was unmanaged, so nothing to do - -#ifdef DEBUG - // ensure that incorrect cleanup fails noisily - object = (__bridge id)(void *)-1; - prev = (RLMObservationInfo *)-1; - next = (RLMObservationInfo *)-1; -#endif -} - -NSString *RLMObservationInfo::columnName(size_t col) const noexcept { - return objectSchema->propertyForTableColumn(col).name; -} - -void RLMObservationInfo::willChange(NSString *key, NSKeyValueChange kind, NSIndexSet *indexes) const { - if (indexes) { - forEach([=](__unsafe_unretained auto o) { - [o willChange:kind valuesAtIndexes:indexes forKey:key]; - }); - } - else { - forEach([=](__unsafe_unretained auto o) { - [o willChangeValueForKey:key]; - }); - } -} - -void RLMObservationInfo::didChange(NSString *key, NSKeyValueChange kind, NSIndexSet *indexes) const { - if (indexes) { - forEach([=](__unsafe_unretained auto o) { - [o didChange:kind valuesAtIndexes:indexes forKey:key]; - }); - } - else { - forEach([=](__unsafe_unretained auto o) { - [o didChangeValueForKey:key]; - }); - } -} - -void RLMObservationInfo::prepareForInvalidation() { - REALM_ASSERT_DEBUG(objectSchema); - REALM_ASSERT_DEBUG(!prev); - for (auto info = this; info; info = info->next) - info->invalidated = true; -} - -void RLMObservationInfo::setRow(realm::Table &table, size_t newRow) { - REALM_ASSERT_DEBUG(!row); - REALM_ASSERT_DEBUG(objectSchema); - row = table[newRow]; - for (auto info : objectSchema->observedObjects) { - if (info->row && info->row.get_index() == row.get_index()) { - prev = info; - next = info->next; - if (next) - next->prev = this; - info->next = this; - return; - } - } - objectSchema->observedObjects.push_back(this); -} - -void RLMObservationInfo::recordObserver(realm::Row& objectRow, RLMClassInfo *objectInfo, - __unsafe_unretained RLMObjectSchema *const objectSchema, - __unsafe_unretained NSString *const keyPath) { - ++observerCount; - if (row) { - return; - } - - // add ourselves to the list of observed objects if this is the first time - // an observer is being added to a managed object - if (objectRow) { - this->objectSchema = objectInfo; - setRow(*objectRow.get_table(), objectRow.get_index()); - return; - } - - // Arrays need a reference to their containing object to avoid having to - // go through the awful proxy object from mutableArrayValueForKey. - // For managed objects we do this when the object is added or created - // (and have to to support notifications from modifying an object which - // was never observed), but for Swift classes (both RealmSwift and - // RLMObject) we can't do it then because we don't know what the parent - // object is. - - NSUInteger sep = [keyPath rangeOfString:@"."].location; - NSString *key = sep == NSNotFound ? keyPath : [keyPath substringToIndex:sep]; - RLMProperty *prop = objectSchema[key]; - if (prop && prop.type == RLMPropertyTypeArray) { - id value = valueForKey(key); - RLMArray *array = [value isKindOfClass:[RLMListBase class]] ? [value _rlmArray] : value; - array->_key = key; - array->_parentObject = object; - } - else if (auto swiftIvar = prop.swiftIvar) { - if (auto optional = RLMDynamicCast(object_getIvar(object, swiftIvar))) { - optional.property = prop; - optional.object = object; - } - } -} - -void RLMObservationInfo::removeObserver() { - --observerCount; -} - -id RLMObservationInfo::valueForKey(NSString *key) { - if (invalidated) { - if ([key isEqualToString:RLMInvalidatedKey]) { - return @YES; - } - return cachedObjects[key]; - } - - if (key != lastKey) { - lastKey = key; - lastProp = objectSchema ? objectSchema->rlmObjectSchema[key] : nil; - } - - static auto superValueForKey = reinterpret_cast([NSObject methodForSelector:@selector(valueForKey:)]); - if (!lastProp) { - // Not a managed property, so use NSObject's implementation of valueForKey: - return RLMCoerceToNil(superValueForKey(object, @selector(valueForKey:), key)); - } - - auto getSuper = [&] { - return row ? RLMDynamicGet(object, lastProp) : RLMCoerceToNil(superValueForKey(object, @selector(valueForKey:), key)); - }; - - // We need to return the same object each time for observing over keypaths - // to work, so we store a cache of them here. We can't just cache them on - // the object as that leads to retain cycles. - if (lastProp.type == RLMPropertyTypeArray) { - RLMArray *value = cachedObjects[key]; - if (!value) { - value = getSuper(); - if (!cachedObjects) { - cachedObjects = [NSMutableDictionary new]; - } - cachedObjects[key] = value; - } - return value; - } - - if (lastProp.type == RLMPropertyTypeObject) { - size_t col = row.get_column_index(lastProp.name.UTF8String); - if (row.is_null_link(col)) { - [cachedObjects removeObjectForKey:key]; - return nil; - } - - RLMObjectBase *value = cachedObjects[key]; - if (value && value->_row.get_index() == row.get_link(col)) { - return value; - } - value = getSuper(); - if (!cachedObjects) { - cachedObjects = [NSMutableDictionary new]; - } - cachedObjects[key] = value; - return value; - } - - return getSuper(); -} - -RLMObservationInfo *RLMGetObservationInfo(RLMObservationInfo *info, size_t row, - RLMClassInfo& objectSchema) { - if (info) { - return info; - } - - for (RLMObservationInfo *info : objectSchema.observedObjects) { - if (info->isForRow(row)) { - return info; - } - } - - return nullptr; -} - -void RLMClearTable(RLMClassInfo &objectSchema) { - for (auto info : objectSchema.observedObjects) { - info->willChange(RLMInvalidatedKey); - } - - RLMTrackDeletions(objectSchema.realm, ^{ - objectSchema.table()->clear(); - - for (auto info : objectSchema.observedObjects) { - info->prepareForInvalidation(); - } - }); - - for (auto info : reverse(objectSchema.observedObjects)) { - info->didChange(RLMInvalidatedKey); - } - - objectSchema.observedObjects.clear(); -} - -void RLMTrackDeletions(__unsafe_unretained RLMRealm *const realm, dispatch_block_t block) { - std::vector *> observers; - - // Build up an array of observation info arrays which is indexed by table - // index (the object schemata may be in an entirely different order) - for (auto& info : realm->_info) { - if (info.second.observedObjects.empty()) { - continue; - } - size_t ndx = info.second.table()->get_index_in_group(); - if (ndx >= observers.size()) { - observers.resize(std::max(observers.size() * 2, ndx + 1)); - } - observers[ndx] = &info.second.observedObjects; - } - - // No need for change tracking if no objects are observed - if (observers.empty()) { - block(); - return; - } - - struct change { - RLMObservationInfo *info; - __unsafe_unretained NSString *property; - NSMutableIndexSet *indexes; - }; - - std::vector changes; - std::vector invalidated; - - // This callback is called by core with a list of row deletions and - // resulting link nullifications immediately before things are deleted and nullified - realm.group.set_cascade_notification_handler([&](realm::Group::CascadeNotification const& cs) { - for (auto const& link : cs.links) { - size_t table_ndx = link.origin_table->get_index_in_group(); - if (table_ndx >= observers.size() || !observers[table_ndx]) { - // The modified table has no observers - continue; - } - - for (auto observer : *observers[table_ndx]) { - if (!observer->isForRow(link.origin_row_ndx)) { - continue; - } - - NSString *name = observer->columnName(link.origin_col_ndx); - if (observer->getRow().get_table()->get_column_type(link.origin_col_ndx) != type_LinkList) { - changes.push_back({observer, name}); - continue; - } - - auto c = find_if(begin(changes), end(changes), [&](auto const& c) { - return c.info == observer && c.property == name; - }); - if (c == end(changes)) { - changes.push_back({observer, name, [NSMutableIndexSet new]}); - c = prev(end(changes)); - } - - // We know what row index is being removed from the LinkView, - // but what we actually want is the indexes in the LinkView that - // are going away - auto linkview = observer->getRow().get_linklist(link.origin_col_ndx); - size_t start = 0, index; - while ((index = linkview->find(link.old_target_row_ndx, start)) != realm::not_found) { - [c->indexes addIndex:index]; - start = index + 1; - } - } - } - - for (auto const& row : cs.rows) { - if (row.table_ndx >= observers.size() || !observers[row.table_ndx]) { - // The modified table has no observers - continue; - } - - for (auto observer : *observers[row.table_ndx]) { - if (observer->isForRow(row.row_ndx)) { - invalidated.push_back(observer); - break; - } - } - } - - // The relative order of these loops is very important - for (auto info : invalidated) { - info->willChange(RLMInvalidatedKey); - } - for (auto const& change : changes) { - change.info->willChange(change.property, NSKeyValueChangeRemoval, change.indexes); - } - for (auto info : invalidated) { - info->prepareForInvalidation(); - } - }); - - try { - block(); - } - catch (...) { - realm.group.set_cascade_notification_handler(nullptr); - throw; - } - - for (auto const& change : reverse(changes)) { - change.info->didChange(change.property, NSKeyValueChangeRemoval, change.indexes); - } - for (auto info : reverse(invalidated)) { - info->didChange(RLMInvalidatedKey); - } - - realm.group.set_cascade_notification_handler(nullptr); -} - -namespace { -template -void forEach(realm::BindingContext::ObserverState const& state, Func&& func) { - for (size_t i = 0, size = state.changes.size(); i < size; ++i) { - if (state.changes[i].kind != realm::BindingContext::ColumnInfo::Kind::None) { - func(i, state.changes[i], static_cast(state.info)); - } - } -} -} - -std::vector RLMGetObservedRows(RLMSchemaInfo const& schema) { - std::vector observers; - for (auto& table : schema) { - for (auto info : table.second.observedObjects) { - auto const& row = info->getRow(); - if (!row.is_attached()) - continue; - observers.push_back({ - row.get_table()->get_index_in_group(), - row.get_index(), - info}); - } - } - sort(begin(observers), end(observers)); - return observers; -} - -static NSKeyValueChange convert(realm::BindingContext::ColumnInfo::Kind kind) { - switch (kind) { - case realm::BindingContext::ColumnInfo::Kind::None: - case realm::BindingContext::ColumnInfo::Kind::SetAll: - return NSKeyValueChangeSetting; - case realm::BindingContext::ColumnInfo::Kind::Set: - return NSKeyValueChangeReplacement; - case realm::BindingContext::ColumnInfo::Kind::Insert: - return NSKeyValueChangeInsertion; - case realm::BindingContext::ColumnInfo::Kind::Remove: - return NSKeyValueChangeRemoval; - } -} - -static NSIndexSet *convert(realm::IndexSet const& in, NSMutableIndexSet *out) { - if (in.empty()) { - return nil; - } - - [out removeAllIndexes]; - for (auto range : in) { - [out addIndexesInRange:{range.first, range.second - range.first}]; - } - return out; -} - -void RLMWillChange(std::vector const& observed, - std::vector const& invalidated) { - for (auto info : invalidated) { - static_cast(info)->willChange(RLMInvalidatedKey); - } - if (!observed.empty()) { - NSMutableIndexSet *indexes = [NSMutableIndexSet new]; - for (auto const& o : observed) { - forEach(o, [&](size_t, auto const& change, RLMObservationInfo *info) { - info->willChange(info->columnName(change.initial_column_index), - convert(change.kind), convert(change.indices, indexes)); - }); - } - } - for (auto info : invalidated) { - static_cast(info)->prepareForInvalidation(); - } -} - -void RLMDidChange(std::vector const& observed, - std::vector const& invalidated) { - if (!observed.empty()) { - // Loop in reverse order to avoid O(N^2) behavior in Foundation - NSMutableIndexSet *indexes = [NSMutableIndexSet new]; - for (auto const& o : reverse(observed)) { - forEach(o, [&](size_t i, auto const& change, RLMObservationInfo *info) { - info->didChange(info->columnName(i), convert(change.kind), convert(change.indices, indexes)); - }); - } - } - for (auto const& info : reverse(invalidated)) { - static_cast(info)->didChange(RLMInvalidatedKey); - } -} diff --git a/Pods/Realm/Realm/RLMOptionalBase.mm b/Pods/Realm/Realm/RLMOptionalBase.mm deleted file mode 100644 index 8aad1c85..00000000 --- a/Pods/Realm/Realm/RLMOptionalBase.mm +++ /dev/null @@ -1,89 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMAccessor.h" -#import "RLMOptionalBase.h" -#import "RLMObject_Private.h" -#import "RLMObjectStore.h" -#import "RLMProperty_Private.h" -#import "RLMUtil.hpp" - -#import - -@interface RLMOptionalBase () -@property (nonatomic) id unmanagedValue; -@end - -@implementation RLMOptionalBase - -- (instancetype)init { - return self; -} - -- (id)underlyingValue { - if ((_object && _object->_realm) || _object.isInvalidated) { - return RLMDynamicGet(_object, _property); - } - else { - return _unmanagedValue; - } -} - -- (void)setUnderlyingValue:(id)underlyingValue { - if ((_object && _object->_realm) || _object.isInvalidated) { - if (_property.isPrimary) { - @throw RLMException(@"Primary key can't be changed after an object is inserted."); - } - RLMDynamicSet(_object, _property, underlyingValue, RLMCreationOptionsNone); - } - else { - NSString *propertyName = _property.name; - [_object willChangeValueForKey:propertyName]; - _unmanagedValue = underlyingValue; - [_object didChangeValueForKey:propertyName]; - } -} - -- (BOOL)isKindOfClass:(Class)aClass { - return [self.underlyingValue isKindOfClass:aClass] || RLMIsKindOfClass(object_getClass(self), aClass); -} - -- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel { - return [self.underlyingValue methodSignatureForSelector:sel]; -} - -- (void)forwardInvocation:(NSInvocation *)invocation { - [invocation invokeWithTarget:self.underlyingValue]; -} - -- (id)forwardingTargetForSelector:(__unused SEL)sel { - return self.underlyingValue; -} - -- (BOOL)respondsToSelector:(SEL)aSelector { - if (id val = self.underlyingValue) { - return [val respondsToSelector:aSelector]; - } - return NO; -} - -- (void)doesNotRecognizeSelector:(SEL)aSelector { - [self.underlyingValue doesNotRecognizeSelector:aSelector]; -} - -@end diff --git a/Pods/Realm/Realm/RLMPredicateUtil.mm b/Pods/Realm/Realm/RLMPredicateUtil.mm deleted file mode 100644 index 247850b1..00000000 --- a/Pods/Realm/Realm/RLMPredicateUtil.mm +++ /dev/null @@ -1,124 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import "RLMPredicateUtil.hpp" - -#include - -// NSConditionalExpressionType is new in OS X 10.11 and iOS 9.0 -#if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -#define CONDITIONAL_EXPRESSION_DECLARED (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) -#elif defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -#define CONDITIONAL_EXPRESSION_DECLARED (__IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) -#else -#define CONDITIONAL_EXPRESSION_DECLARED 0 -#endif - -#if !CONDITIONAL_EXPRESSION_DECLARED - -#define NSConditionalExpressionType 20 - -@interface NSExpression (NewIn1011And90) -+ (NSExpression *)expressionForConditional:(NSPredicate *)predicate trueExpression:(NSExpression *)trueExpression falseExpression:(NSExpression *)falseExpression; -- (NSExpression *)trueExpression; -- (NSExpression *)falseExpression; -@end - -#endif - -namespace { - -struct PredicateExpressionTransformer { - PredicateExpressionTransformer(ExpressionVisitor visitor) : m_visitor(visitor) { } - - NSExpression *visit(NSExpression *expression) const; - NSPredicate *visit(NSPredicate *predicate) const; - - ExpressionVisitor m_visitor; -}; - -NSExpression *PredicateExpressionTransformer::visit(NSExpression *expression) const { - expression = m_visitor(expression); - - switch (expression.expressionType) { - case NSFunctionExpressionType: { - NSMutableArray *arguments = [NSMutableArray array]; - for (NSExpression *argument in expression.arguments) { - [arguments addObject:visit(argument)]; - } - if (expression.operand) { - return [NSExpression expressionForFunction:visit(expression.operand) selectorName:expression.function arguments:arguments]; - } else { - return [NSExpression expressionForFunction:expression.function arguments:arguments]; - } - } - - case NSUnionSetExpressionType: - return [NSExpression expressionForUnionSet:visit(expression.leftExpression) with:visit(expression.rightExpression)]; - case NSIntersectSetExpressionType: - return [NSExpression expressionForIntersectSet:visit(expression.leftExpression) with:visit(expression.rightExpression)]; - case NSMinusSetExpressionType: - return [NSExpression expressionForMinusSet:visit(expression.leftExpression) with:visit(expression.rightExpression)]; - - case NSSubqueryExpressionType: { - NSExpression *collection = expression.collection; - // NSExpression.collection is declared as id, but appears to always hold an NSExpression for subqueries. - REALM_ASSERT([collection isKindOfClass:[NSExpression class]]); - return [NSExpression expressionForSubquery:visit(collection) usingIteratorVariable:expression.variable predicate:visit(expression.predicate)]; - } - - case NSAggregateExpressionType: { - NSMutableArray *subexpressions = [NSMutableArray array]; - for (NSExpression *subexpression in expression.collection) { - [subexpressions addObject:visit(subexpression)]; - } - return [NSExpression expressionForAggregate:subexpressions]; - } - - case NSConditionalExpressionType: - return [NSExpression expressionForConditional:visit(expression.predicate) trueExpression:visit(expression.trueExpression) falseExpression:visit(expression.falseExpression)]; - - default: - // The remaining expression types do not contain nested expressions or predicates. - return expression; - } -} - -NSPredicate *PredicateExpressionTransformer::visit(NSPredicate *predicate) const { - if ([predicate isKindOfClass:[NSCompoundPredicate class]]) { - NSCompoundPredicate *compoundPredicate = (NSCompoundPredicate *)predicate; - NSMutableArray *subpredicates = [NSMutableArray array]; - for (NSPredicate *subpredicate in compoundPredicate.subpredicates) { - [subpredicates addObject:visit(subpredicate)]; - } - return [[NSCompoundPredicate alloc] initWithType:compoundPredicate.compoundPredicateType subpredicates:subpredicates]; - } - if ([predicate isKindOfClass:[NSComparisonPredicate class]]) { - NSComparisonPredicate *comparisonPredicate = (NSComparisonPredicate *)predicate; - NSExpression *leftExpression = visit(comparisonPredicate.leftExpression); - NSExpression *rightExpression = visit(comparisonPredicate.rightExpression); - return [NSComparisonPredicate predicateWithLeftExpression:leftExpression rightExpression:rightExpression modifier:comparisonPredicate.comparisonPredicateModifier type:comparisonPredicate.predicateOperatorType options:comparisonPredicate.options]; - } - return predicate; -} - -} // anonymous namespace - -NSPredicate *transformPredicate(NSPredicate *predicate, ExpressionVisitor visitor) { - PredicateExpressionTransformer transformer(visitor); - return transformer.visit(predicate); -} diff --git a/Pods/Realm/Realm/RLMProperty.mm b/Pods/Realm/Realm/RLMProperty.mm deleted file mode 100644 index 2ce75f4c..00000000 --- a/Pods/Realm/Realm/RLMProperty.mm +++ /dev/null @@ -1,569 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMProperty_Private.hpp" - -#import "RLMArray.h" -#import "RLMListBase.h" -#import "RLMObject.h" -#import "RLMObject_Private.h" -#import "RLMOptionalBase.h" -#import "RLMSchema_Private.h" -#import "RLMSwiftSupport.h" -#import "RLMUtil.hpp" - -BOOL RLMPropertyTypeIsNullable(RLMPropertyType propertyType) { - return propertyType != RLMPropertyTypeArray && propertyType != RLMPropertyTypeLinkingObjects; -} - -BOOL RLMPropertyTypeIsComputed(RLMPropertyType propertyType) { - return propertyType == RLMPropertyTypeLinkingObjects; -} - -static bool rawTypeIsComputedProperty(NSString *rawType) { - if ([rawType isEqualToString:@"@\"RLMLinkingObjects\""] || [rawType hasPrefix:@"@\"RLMLinkingObjects<"]) { - return true; - } - - return false; -} - -@implementation RLMProperty - -+ (instancetype)propertyForObjectStoreProperty:(const realm::Property &)prop { - return [[RLMProperty alloc] initWithName:@(prop.name.c_str()) - type:(RLMPropertyType)prop.type - objectClassName:prop.object_type.length() ? @(prop.object_type.c_str()) : nil - linkOriginPropertyName:prop.link_origin_property_name.length() ? @(prop.link_origin_property_name.c_str()) : nil - indexed:prop.is_indexed - optional:prop.is_nullable]; -} - -- (instancetype)initWithName:(NSString *)name - type:(RLMPropertyType)type - objectClassName:(NSString *)objectClassName - linkOriginPropertyName:(NSString *)linkOriginPropertyName - indexed:(BOOL)indexed - optional:(BOOL)optional { - self = [super init]; - if (self) { - _name = name; - _type = type; - _objectClassName = objectClassName; - _linkOriginPropertyName = linkOriginPropertyName; - _indexed = indexed; - _optional = optional; - [self setObjcCodeFromType]; - [self updateAccessors]; - } - - return self; -} - -- (void)setName:(NSString *)name { - _name = name; - [self updateAccessors]; -} - -- (void)updateAccessors { - // populate getter/setter names if generic - if (!_getterName) { - _getterName = _name; - } - if (!_setterName) { - // Objective-C setters only capitalize the first letter of the property name if it falls between 'a' and 'z' - int asciiCode = [_name characterAtIndex:0]; - BOOL shouldUppercase = asciiCode >= 'a' && asciiCode <= 'z'; - NSString *firstChar = [_name substringToIndex:1]; - firstChar = shouldUppercase ? firstChar.uppercaseString : firstChar; - _setterName = [NSString stringWithFormat:@"set%@%@:", firstChar, [_name substringFromIndex:1]]; - } - - _getterSel = NSSelectorFromString(_getterName); - _setterSel = NSSelectorFromString(_setterName); -} - --(void)setObjcCodeFromType { - if (_optional) { - _objcType = '@'; - return; - } - switch (_type) { - case RLMPropertyTypeInt: - _objcType = 'q'; - break; - case RLMPropertyTypeBool: - _objcType = 'c'; - break; - case RLMPropertyTypeDouble: - _objcType = 'd'; - break; - case RLMPropertyTypeFloat: - _objcType = 'f'; - break; - case RLMPropertyTypeAny: - case RLMPropertyTypeArray: - case RLMPropertyTypeData: - case RLMPropertyTypeDate: - case RLMPropertyTypeObject: - case RLMPropertyTypeString: - case RLMPropertyTypeLinkingObjects: - _objcType = '@'; - break; - } -} - -// determine RLMPropertyType from objc code - returns true if valid type was found/set -- (BOOL)setTypeFromRawType { - const char *code = _objcRawType.UTF8String; - _objcType = *code; // first char of type attr - - // map to RLMPropertyType - switch (self.objcType) { - case 's': // short - case 'i': // int - case 'l': // long - case 'q': // long long - _type = RLMPropertyTypeInt; - return YES; - case 'f': - _type = RLMPropertyTypeFloat; - return YES; - case 'd': - _type = RLMPropertyTypeDouble; - return YES; - case 'c': // BOOL is stored as char - since rlm has no char type this is ok - case 'B': - _type = RLMPropertyTypeBool; - return YES; - case '@': { - _optional = true; - static const char arrayPrefix[] = "@\"RLMArray<"; - static const int arrayPrefixLen = sizeof(arrayPrefix) - 1; - - static const char numberPrefix[] = "@\"NSNumber<"; - static const int numberPrefixLen = sizeof(numberPrefix) - 1; - - static const char linkingObjectsPrefix[] = "@\"RLMLinkingObjects"; - static const int linkingObjectsPrefixLen = sizeof(linkingObjectsPrefix) - 1; - - if (strcmp(code, "@\"NSString\"") == 0) { - _type = RLMPropertyTypeString; - } - else if (strcmp(code, "@\"NSDate\"") == 0) { - _type = RLMPropertyTypeDate; - } - else if (strcmp(code, "@\"NSData\"") == 0) { - _type = RLMPropertyTypeData; - } - else if (strncmp(code, arrayPrefix, arrayPrefixLen) == 0) { - _optional = false; - // get object class from type string - @"RLMArray" - _type = RLMPropertyTypeArray; - _objectClassName = [[NSString alloc] initWithBytes:code + arrayPrefixLen - length:strlen(code + arrayPrefixLen) - 2 // drop trailing >" - encoding:NSUTF8StringEncoding]; - - Class cls = [RLMSchema classForString:_objectClassName]; - if (!cls) { - @throw RLMException(@"Property '%@' is of type 'RLMArray<%@>' which is not a supported RLMArray object type. " - @"RLMArrays can only contain instances of RLMObject subclasses. " - @"See https://realm.io/docs/objc/latest/#to-many for more information.", _name, _objectClassName); - } - } - else if (strncmp(code, numberPrefix, numberPrefixLen) == 0) { - // get number type from type string - @"NSNumber" - NSString *numberType = [[NSString alloc] initWithBytes:code + numberPrefixLen - length:strlen(code + numberPrefixLen) - 2 // drop trailing >" - encoding:NSUTF8StringEncoding]; - - if ([numberType isEqualToString:@"RLMInt"]) { - _type = RLMPropertyTypeInt; - } - else if ([numberType isEqualToString:@"RLMFloat"]) { - _type = RLMPropertyTypeFloat; - } - else if ([numberType isEqualToString:@"RLMDouble"]) { - _type = RLMPropertyTypeDouble; - } - else if ([numberType isEqualToString:@"RLMBool"]) { - _type = RLMPropertyTypeBool; - } - else { - @throw RLMException(@"Property '%@' is of type 'NSNumber<%@>' which is not a supported NSNumber object type. " - @"NSNumbers can only be RLMInt, RLMFloat, RLMDouble, and RLMBool at the moment. " - @"See https://realm.io/docs/objc/latest for more information.", _name, numberType); - } - } - else if (strncmp(code, linkingObjectsPrefix, linkingObjectsPrefixLen) == 0 && - (code[linkingObjectsPrefixLen] == '"' || code[linkingObjectsPrefixLen] == '<')) { - _type = RLMPropertyTypeLinkingObjects; - _optional = false; - - if (!_objectClassName || !_linkOriginPropertyName) { - @throw RLMException(@"Property '%@' is of type RLMLinkingObjects but +linkingObjectsProperties did not specify the class " - "or property that is the origin of the link.", _name); - } - - // If the property was declared with a protocol indicating the contained type, validate that it matches - // the class from the dictionary returned by +linkingObjectsProperties. - if (code[linkingObjectsPrefixLen] == '<') { - NSString *classNameFromProtocol = [[NSString alloc] initWithBytes:code + linkingObjectsPrefixLen + 1 - length:strlen(code + linkingObjectsPrefixLen) - 3 // drop trailing >" - encoding:NSUTF8StringEncoding]; - if (![_objectClassName isEqualToString:classNameFromProtocol]) { - @throw RLMException(@"Property '%@' was declared with type RLMLinkingObjects<%@>, but a conflicting " - "class name of '%@' was returned by +linkingObjectsProperties.", _name, - classNameFromProtocol, _objectClassName); - } - } - } - else if (strcmp(code, "@\"NSNumber\"") == 0) { - @throw RLMException(@"Property '%@' requires a protocol defining the contained type - example: NSNumber.", _name); - } - else if (strcmp(code, "@\"RLMArray\"") == 0) { - @throw RLMException(@"Property '%@' requires a protocol defining the contained type - example: RLMArray.", _name); - } - else { - NSString *className; - Class cls = nil; - if (code[1] == '\0') { - className = @"id"; - } - else { - // for objects strip the quotes and @ - className = [_objcRawType substringWithRange:NSMakeRange(2, _objcRawType.length-3)]; - cls = [RLMSchema classForString:className]; - } - - if (!cls) { - @throw RLMException(@"Property '%@' is declared as '%@', which is not a supported RLMObject property type. " - @"All properties must be primitives, NSString, NSDate, NSData, NSNumber, RLMArray, RLMLinkingObjects, or subclasses of RLMObject. " - @"See https://realm.io/docs/objc/latest/api/Classes/RLMObject.html for more information.", _name, className); - } - - _type = RLMPropertyTypeObject; - _optional = true; - _objectClassName = [cls className] ?: className; - } - return YES; - } - default: - return NO; - } -} - -- (bool)parseObjcProperty:(objc_property_t)property { - unsigned int count; - objc_property_attribute_t *attrs = property_copyAttributeList(property, &count); - - bool isReadOnly = false; - for (size_t i = 0; i < count; ++i) { - switch (*attrs[i].name) { - case 'T': - _objcRawType = @(attrs[i].value); - break; - case 'R': - isReadOnly = true; - break; - case 'N': - // nonatomic - break; - case 'D': - // dynamic - break; - case 'G': - _getterName = @(attrs[i].value); - break; - case 'S': - _setterName = @(attrs[i].value); - break; - default: - break; - } - } - free(attrs); - - return isReadOnly; -} - -- (instancetype)initSwiftPropertyWithName:(NSString *)name - indexed:(BOOL)indexed - linkPropertyDescriptor:(RLMPropertyDescriptor *)linkPropertyDescriptor - property:(objc_property_t)property - instance:(RLMObject *)obj { - self = [super init]; - if (!self) { - return nil; - } - - _name = name; - _indexed = indexed; - - if (linkPropertyDescriptor) { - _objectClassName = [linkPropertyDescriptor.objectClass className]; - _linkOriginPropertyName = linkPropertyDescriptor.propertyName; - } - - if ([self parseObjcProperty:property]) { - return nil; - } - - id propertyValue = [obj valueForKey:_name]; - - // FIXME: temporarily workaround added since Objective-C generics used in Swift show up as `@` - // * broken starting in Swift 3.0 Xcode 8 b1 - // * tested to still be broken in Swift 3.0 Xcode 8 b6 - // * if the Realm Objective-C Swift tests pass with this removed, it's been fixed - // * once it has been fixed, remove this entire conditional block (contents included) entirely - // * Bug Report: SR-2031 https://bugs.swift.org/browse/SR-2031 - if ([_objcRawType isEqualToString:@"@"]) { - if (propertyValue) { - _objcRawType = [NSString stringWithFormat:@"@\"%@\"", [propertyValue class]]; - } else if (linkPropertyDescriptor) { - // we're going to naively assume that the user used the correct type since we can't check it - _objcRawType = @"@\"RLMLinkingObjects\""; - } - } - - // convert array types to objc variant - if ([_objcRawType isEqualToString:@"@\"RLMArray\""]) { - _objcRawType = [NSString stringWithFormat:@"@\"RLMArray<%@>\"", [propertyValue objectClassName]]; - } - else if ([_objcRawType isEqualToString:@"@\"NSNumber\""]) { - const char *numberType = [propertyValue objCType]; - if (!numberType) { - @throw RLMException(@"Can't persist NSNumber without default value: use a Swift-native number type or provide a default value."); - } - switch (*numberType) { - case 'i': - case 'l': - case 'q': - _objcRawType = @"@\"NSNumber\""; - break; - case 'f': - _objcRawType = @"@\"NSNumber\""; - break; - case 'd': - _objcRawType = @"@\"NSNumber\""; - break; - case 'B': - case 'c': - _objcRawType = @"@\"NSNumber\""; - break; - default: - @throw RLMException(@"Can't persist NSNumber of type '%s': only integers, floats, doubles, and bools are currently supported.", numberType); - } - } - - auto throwForPropertyName = ^(NSString *propertyName){ - @throw RLMException(@"Can't persist property '%@' with incompatible type. " - "Add to Object.ignoredProperties() class method to ignore.", - propertyName); - }; - - if (![self setTypeFromRawType]) { - throwForPropertyName(self.name); - } - - if (_objcType == 'c') { - // Check if it's a BOOL or Int8 by trying to set it to 2 and seeing if - // it actually sets it to 1. - [obj setValue:@2 forKey:name]; - NSNumber *value = [obj valueForKey:name]; - _type = value.intValue == 2 ? RLMPropertyTypeInt : RLMPropertyTypeBool; - } - - // update getter/setter names - [self updateAccessors]; - - return self; -} - -- (instancetype)initWithName:(NSString *)name - indexed:(BOOL)indexed - linkPropertyDescriptor:(RLMPropertyDescriptor *)linkPropertyDescriptor - property:(objc_property_t)property -{ - self = [super init]; - if (!self) { - return nil; - } - - _name = name; - _indexed = indexed; - - if (linkPropertyDescriptor) { - _objectClassName = [linkPropertyDescriptor.objectClass className]; - _linkOriginPropertyName = linkPropertyDescriptor.propertyName; - } - - bool isReadOnly = [self parseObjcProperty:property]; - bool isComputedProperty = rawTypeIsComputedProperty(_objcRawType); - if (isReadOnly && !isComputedProperty) { - return nil; - } - - if (![self setTypeFromRawType]) { - @throw RLMException(@"Can't persist property '%@' with incompatible type. " - "Add to ignoredPropertyNames: method to ignore.", self.name); - } - - if (!isReadOnly && isComputedProperty) { - @throw RLMException(@"Property '%@' must be declared as readonly as %@ properties cannot be written to.", - self.name, RLMTypeToString(_type)); - } - - // update getter/setter names - [self updateAccessors]; - - return self; -} - -- (instancetype)initSwiftListPropertyWithName:(NSString *)name - ivar:(Ivar)ivar - objectClassName:(NSString *)objectClassName { - self = [super init]; - if (!self) { - return nil; - } - - _name = name; - _type = RLMPropertyTypeArray; - _objectClassName = objectClassName; - _objcType = 't'; - _swiftIvar = ivar; - - // no obj-c property for generic lists, and thus no getter/setter names - - return self; -} - -- (instancetype)initSwiftOptionalPropertyWithName:(NSString *)name - indexed:(BOOL)indexed - ivar:(Ivar)ivar - propertyType:(RLMPropertyType)propertyType { - self = [super init]; - if (!self) { - return nil; - } - - _name = name; - _type = propertyType; - _indexed = indexed; - _objcType = '@'; - _swiftIvar = ivar; - _optional = true; - - // no obj-c property for generic optionals, and thus no getter/setter names - - return self; -} - -- (instancetype)initSwiftLinkingObjectsPropertyWithName:(NSString *)name - ivar:(Ivar)ivar - objectClassName:(NSString *)objectClassName - linkOriginPropertyName:(NSString *)linkOriginPropertyName { - self = [super init]; - if (!self) { - return nil; - } - - _name = name; - _type = RLMPropertyTypeLinkingObjects; - _objectClassName = objectClassName; - _linkOriginPropertyName = linkOriginPropertyName; - _objcType = '@'; - _swiftIvar = ivar; - - // no obj-c property for generic linking objects properties, and thus no getter/setter names - - return self; -} - -- (id)copyWithZone:(NSZone *)zone { - RLMProperty *prop = [[RLMProperty allocWithZone:zone] init]; - prop->_name = _name; - prop->_type = _type; - prop->_objcType = _objcType; - prop->_objectClassName = _objectClassName; - prop->_indexed = _indexed; - prop->_getterName = _getterName; - prop->_setterName = _setterName; - prop->_getterSel = _getterSel; - prop->_setterSel = _setterSel; - prop->_isPrimary = _isPrimary; - prop->_swiftIvar = _swiftIvar; - prop->_optional = _optional; - prop->_linkOriginPropertyName = _linkOriginPropertyName; - - return prop; -} - -- (RLMProperty *)copyWithNewName:(NSString *)name { - RLMProperty *prop = [self copy]; - prop.name = name; - return prop; -} - -- (BOOL)isEqual:(id)object { - if (![object isKindOfClass:[RLMProperty class]]) { - return NO; - } - - return [self isEqualToProperty:object]; -} - -- (BOOL)isEqualToProperty:(RLMProperty *)property { - return _type == property->_type - && _indexed == property->_indexed - && _isPrimary == property->_isPrimary - && _optional == property->_optional - && [_name isEqualToString:property->_name] - && (_objectClassName == property->_objectClassName || [_objectClassName isEqualToString:property->_objectClassName]) - && (_linkOriginPropertyName == property->_linkOriginPropertyName || [_linkOriginPropertyName isEqualToString:property->_linkOriginPropertyName]); -} - -- (NSString *)description { - return [NSString stringWithFormat:@"%@ {\n\ttype = %@;\n\tobjectClassName = %@;\n\tlinkOriginPropertyName = %@;\n\tindexed = %@;\n\tisPrimary = %@;\n\toptional = %@;\n}", self.name, RLMTypeToString(self.type), self.objectClassName, self.linkOriginPropertyName, self.indexed ? @"YES" : @"NO", self.isPrimary ? @"YES" : @"NO", self.optional ? @"YES" : @"NO"]; -} - -- (realm::Property)objectStoreCopy { - realm::Property p; - p.name = _name.UTF8String; - p.type = (realm::PropertyType)_type; - p.object_type = _objectClassName ? _objectClassName.UTF8String : ""; - p.is_indexed = _indexed; - p.is_nullable = _optional; - p.link_origin_property_name = _linkOriginPropertyName ? _linkOriginPropertyName.UTF8String : ""; - return p; -} - -@end - -@implementation RLMPropertyDescriptor - -+ (instancetype)descriptorWithClass:(Class)objectClass propertyName:(NSString *)propertyName -{ - RLMPropertyDescriptor *descriptor = [[RLMPropertyDescriptor alloc] init]; - descriptor->_objectClass = objectClass; - descriptor->_propertyName = propertyName; - return descriptor; -} - -@end diff --git a/Pods/Realm/Realm/RLMQueryUtil.mm b/Pods/Realm/Realm/RLMQueryUtil.mm deleted file mode 100644 index 9d6ebe65..00000000 --- a/Pods/Realm/Realm/RLMQueryUtil.mm +++ /dev/null @@ -1,1408 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMQueryUtil.hpp" - -#import "RLMArray.h" -#import "RLMObjectSchema_Private.h" -#import "RLMObject_Private.hpp" -#import "RLMPredicateUtil.hpp" -#import "RLMProperty.h" -#import "RLMSchema.h" -#import "RLMUtil.hpp" - -#import "object_store.hpp" -#import "results.hpp" - -#include - -using namespace realm; - -NSString * const RLMPropertiesComparisonTypeMismatchException = @"RLMPropertiesComparisonTypeMismatchException"; -NSString * const RLMUnsupportedTypesFoundInPropertyComparisonException = @"RLMUnsupportedTypesFoundInPropertyComparisonException"; - -NSString * const RLMPropertiesComparisonTypeMismatchReason = @"Property type mismatch between %@ and %@"; -NSString * const RLMUnsupportedTypesFoundInPropertyComparisonReason = @"Comparison between %@ and %@"; - -// small helper to create the many exceptions thrown when parsing predicates -static NSException *RLMPredicateException(NSString *name, NSString *format, ...) { - va_list args; - va_start(args, format); - NSString *reason = [[NSString alloc] initWithFormat:format arguments:args]; - va_end(args); - - return [NSException exceptionWithName:name reason:reason userInfo:nil]; -} - -// check a precondition and throw an exception if it is not met -// this should be used iff the condition being false indicates a bug in the caller -// of the function checking its preconditions -static void RLMPrecondition(bool condition, NSString *name, NSString *format, ...) { - if (__builtin_expect(condition, 1)) { - return; - } - - va_list args; - va_start(args, format); - NSString *reason = [[NSString alloc] initWithFormat:format arguments:args]; - va_end(args); - - @throw [NSException exceptionWithName:name reason:reason userInfo:nil]; -} - -// return the property for a validated column name -RLMProperty *RLMValidatedProperty(RLMObjectSchema *desc, NSString *columnName) { - RLMProperty *prop = desc[columnName]; - RLMPrecondition(prop, @"Invalid property name", - @"Property '%@' not found in object of type '%@'", columnName, desc.className); - return prop; -} - -namespace { -BOOL RLMPropertyTypeIsNumeric(RLMPropertyType propertyType) { - switch (propertyType) { - case RLMPropertyTypeInt: - case RLMPropertyTypeFloat: - case RLMPropertyTypeDouble: - return YES; - default: - return NO; - } -} - -// FIXME: TrueExpression and FalseExpression should be supported by core in some way - -struct TrueExpression : realm::Expression { - size_t find_first(size_t start, size_t end) const override - { - if (start != end) - return start; - - return realm::not_found; - } - void set_base_table(const Table*) override {} - const Table* get_base_table() const override { return nullptr; } - std::unique_ptr clone(QueryNodeHandoverPatches*) const override - { - return std::unique_ptr(new TrueExpression(*this)); - } -}; - -struct FalseExpression : realm::Expression { - size_t find_first(size_t, size_t) const override { return realm::not_found; } - void set_base_table(const Table*) override {} - const Table* get_base_table() const override { return nullptr; } - std::unique_ptr clone(QueryNodeHandoverPatches*) const override - { - return std::unique_ptr(new FalseExpression(*this)); - } -}; - -NSString *operatorName(NSPredicateOperatorType operatorType) -{ - switch (operatorType) { - case NSLessThanPredicateOperatorType: - return @"<"; - case NSLessThanOrEqualToPredicateOperatorType: - return @"<="; - case NSGreaterThanPredicateOperatorType: - return @">"; - case NSGreaterThanOrEqualToPredicateOperatorType: - return @">="; - case NSEqualToPredicateOperatorType: - return @"=="; - case NSNotEqualToPredicateOperatorType: - return @"!="; - case NSMatchesPredicateOperatorType: - return @"MATCHES"; - case NSLikePredicateOperatorType: - return @"LIKE"; - case NSBeginsWithPredicateOperatorType: - return @"BEGINSWITH"; - case NSEndsWithPredicateOperatorType: - return @"ENDSWITH"; - case NSInPredicateOperatorType: - return @"IN"; - case NSContainsPredicateOperatorType: - return @"CONTAINS"; - case NSBetweenPredicateOperatorType: - return @"BETWEEN"; - case NSCustomSelectorPredicateOperatorType: - return @"custom selector"; - } - - return [NSString stringWithFormat:@"unknown operator %lu", (unsigned long)operatorType]; -} - -Table& get_table(Group& group, RLMObjectSchema *objectSchema) -{ - return *ObjectStore::table_for_object_type(group, objectSchema.objectName.UTF8String); -} - -// A reference to a column within a query. Can be resolved to a Columns for use in query expressions. -class ColumnReference { -public: - ColumnReference(Query& query, Group& group, RLMSchema *schema, RLMProperty* property, const std::vector& links = {}) - : m_links(links), m_property(property), m_schema(schema), m_group(&group), m_query(&query), m_table(query.get_table().get()) - { - auto& table = walk_link_chain([](Table&, size_t, RLMPropertyType) { }); - m_index = table.get_column_index(m_property.name.UTF8String); - } - - template - auto resolve(SubQuery&&... subquery) const - { - static_assert(sizeof...(SubQuery) < 2, "resolve() takes at most one subquery"); - set_link_chain_on_table(); - if (type() != RLMPropertyTypeLinkingObjects) { - return m_table->template column(index(), std::forward(subquery)...); - } - else { - return resolve_backlink(std::forward(subquery)...); - } - } - - RLMProperty *property() const { return m_property; } - size_t index() const { return m_index; } - RLMPropertyType type() const { return property().type; } - Group& group() const { return *m_group; } - - RLMObjectSchema *link_target_object_schema() const - { - switch (type()) { - case RLMPropertyTypeObject: - case RLMPropertyTypeArray: - case RLMPropertyTypeLinkingObjects: - return m_schema[property().objectClassName]; - default: - REALM_ASSERT(false); - } - } - - bool has_links() const { return m_links.size(); } - - bool has_any_to_many_links() const { - return std::any_of(begin(m_links), end(m_links), [](RLMProperty *property) { - return property.type == RLMPropertyTypeArray || property.type == RLMPropertyTypeLinkingObjects; - }); - } - - ColumnReference last_link_column() const { - REALM_ASSERT(!m_links.empty()); - return {*m_query, *m_group, m_schema, m_links.back(), {m_links.begin(), m_links.end() - 1}}; - } - - ColumnReference column_ignoring_links(Query& query) const { - return {query, *m_group, m_schema, m_property}; - } - -private: - template - auto resolve_backlink(SubQuery&&... subquery) const - { - // We actually just want `if constexpr (std::is_same::value) { ... }`, - // so fake it by tag-dispatching on the conditional - return do_resolve_backlink(std::is_same(), std::forward(subquery)...); - } - - template - auto do_resolve_backlink(std::true_type, SubQuery&&... subquery) const - { - return with_link_origin(m_property, [&](Table& table, size_t col) { - return m_table->template column(table, col, std::forward(subquery)...); - }); - } - - template - Columns do_resolve_backlink(std::false_type, SubQuery&&...) const - { - // This can't actually happen as we only call resolve_backlink() if - // it's RLMPropertyTypeLinkingObjects - __builtin_unreachable(); - } - - template - Table& walk_link_chain(Func&& func) const - { - auto table = m_query->get_table().get(); - for (const auto& link : m_links) { - if (link.type != RLMPropertyTypeLinkingObjects) { - auto index = table->get_column_index(link.name.UTF8String); - func(*table, index, link.type); - table = table->get_link_target(index).get(); - } - else { - with_link_origin(link, [&](Table& link_origin_table, size_t link_origin_column) { - func(link_origin_table, link_origin_column, link.type); - table = &link_origin_table; - }); - } - } - return *table; - } - - template - auto with_link_origin(RLMProperty *prop, Func&& func) const - { - RLMObjectSchema *link_origin_schema = m_schema[prop.objectClassName]; - Table& link_origin_table = get_table(*m_group, link_origin_schema); - size_t link_origin_column = link_origin_table.get_column_index(prop.linkOriginPropertyName.UTF8String); - return func(link_origin_table, link_origin_column); - } - - void set_link_chain_on_table() const - { - walk_link_chain([&](Table& current_table, size_t column, RLMPropertyType type) { - if (type == RLMPropertyTypeLinkingObjects) { - m_table->backlink(current_table, column); - } - else { - m_table->link(column); - } - }); - } - - std::vector m_links; - RLMProperty *m_property; - RLMSchema *m_schema; - Group *m_group; - Query *m_query; - Table *m_table; - size_t m_index; -}; - -class CollectionOperation { -public: - enum Type { - Count, - Minimum, - Maximum, - Sum, - Average, - }; - - CollectionOperation(Type type, ColumnReference link_column, util::Optional column) - : m_type(type) - , m_link_column(std::move(link_column)) - , m_column(std::move(column)) - { - RLMPrecondition(m_link_column.type() == RLMPropertyTypeArray || m_link_column.type() == RLMPropertyTypeLinkingObjects, - @"Invalid predicate", @"Collection operation can only be applied to a property of type RLMArray."); - - switch (m_type) { - case Count: - RLMPrecondition(!m_column, @"Invalid predicate", @"Result of @count does not have any properties."); - break; - case Minimum: - case Maximum: - case Sum: - case Average: - RLMPrecondition(m_column && RLMPropertyTypeIsNumeric(m_column->type()), @"Invalid predicate", - @"%@ can only be applied to a numeric property.", name_for_type(m_type)); - break; - } - } - - CollectionOperation(NSString *operationName, ColumnReference link_column, util::Optional column = util::none) - : CollectionOperation(type_for_name(operationName), std::move(link_column), std::move(column)) - { - } - - Type type() const { return m_type; } - const ColumnReference& link_column() const { return m_link_column; } - const ColumnReference& column() const { return *m_column; } - - void validate_comparison(id value) const { - switch (m_type) { - case Count: - case Average: - RLMPrecondition([value isKindOfClass:[NSNumber class]], @"Invalid operand", - @"%@ can only be compared with a numeric value.", name_for_type(m_type)); - break; - case Minimum: - case Maximum: - case Sum: - RLMPrecondition(RLMIsObjectValidForProperty(value, m_column->property()), @"Invalid operand", - @"%@ on a property of type %@ cannot be compared with '%@'", - name_for_type(m_type), RLMTypeToString(m_column->type()), value); - break; - } - } - - void validate_comparison(const ColumnReference& column) const { - switch (m_type) { - case Count: - RLMPrecondition(RLMPropertyTypeIsNumeric(column.type()), @"Invalid operand", - @"%@ can only be compared with a numeric value.", name_for_type(m_type)); - break; - case Average: - case Minimum: - case Maximum: - case Sum: - RLMPrecondition(RLMPropertyTypeIsNumeric(column.type()), @"Invalid operand", - @"%@ on a property of type %@ cannot be compared with property of type '%@'", - name_for_type(m_type), RLMTypeToString(m_column->type()), RLMTypeToString(column.type())); - break; - } - } - -private: - static Type type_for_name(NSString *name) { - if ([name isEqualToString:@"@count"]) { - return Count; - } - if ([name isEqualToString:@"@min"]) { - return Minimum; - } - if ([name isEqualToString:@"@max"]) { - return Maximum; - } - if ([name isEqualToString:@"@sum"]) { - return Sum; - } - if ([name isEqualToString:@"@avg"]) { - return Average; - } - @throw RLMPredicateException(@"Invalid predicate", @"Unsupported collection operation '%@'", name); - } - - static NSString *name_for_type(Type type) { - switch (type) { - case Count: return @"@count"; - case Minimum: return @"@min"; - case Maximum: return @"@max"; - case Sum: return @"@sum"; - case Average: return @"@avg"; - } - } - - Type m_type; - ColumnReference m_link_column; - util::Optional m_column; -}; - -class QueryBuilder { -public: - QueryBuilder(Query& query, Group& group, RLMSchema *schema) - : m_query(query), m_group(group), m_schema(schema) { } - - void apply_predicate(NSPredicate *predicate, RLMObjectSchema *objectSchema); - - - void apply_collection_operator_expression(RLMObjectSchema *desc, NSString *keyPath, id value, NSComparisonPredicate *pred); - void apply_value_expression(RLMObjectSchema *desc, NSString *keyPath, id value, NSComparisonPredicate *pred); - void apply_column_expression(RLMObjectSchema *desc, NSString *leftKeyPath, NSString *rightKeyPath, NSComparisonPredicate *predicate); - void apply_subquery_count_expression(RLMObjectSchema *objectSchema, NSExpression *subqueryExpression, - NSPredicateOperatorType operatorType, NSExpression *right); - void apply_function_subquery_expression(RLMObjectSchema *objectSchema, NSExpression *functionExpression, - NSPredicateOperatorType operatorType, NSExpression *right); - void apply_function_expression(RLMObjectSchema *objectSchema, NSExpression *functionExpression, - NSPredicateOperatorType operatorType, NSExpression *right); - - - template - void add_numeric_constraint(RLMPropertyType datatype, - NSPredicateOperatorType operatorType, - A&& lhs, B&& rhs); - - template - void add_bool_constraint(NSPredicateOperatorType operatorType, A lhs, B rhs); - - template - void add_string_constraint(NSPredicateOperatorType operatorType, - NSComparisonPredicateOptions predicateOptions, - Columns &&column, - T value); - - void add_string_constraint(NSPredicateOperatorType operatorType, - NSComparisonPredicateOptions predicateOptions, - StringData value, - Columns&& column); - - template - void add_constraint(RLMPropertyType type, - NSPredicateOperatorType operatorType, - NSComparisonPredicateOptions predicateOptions, - L lhs, R rhs); - template - void do_add_constraint(RLMPropertyType type, NSPredicateOperatorType operatorType, - NSComparisonPredicateOptions predicateOptions, T... values); - void do_add_constraint(RLMPropertyType, NSPredicateOperatorType, NSComparisonPredicateOptions, id, realm::null); - - void add_between_constraint(const ColumnReference& column, id value); - - template - void add_binary_constraint(NSPredicateOperatorType operatorType, const ColumnReference& column, T value); - void add_binary_constraint(NSPredicateOperatorType operatorType, const ColumnReference& column, id value); - void add_binary_constraint(NSPredicateOperatorType operatorType, id value, const ColumnReference& column); - void add_binary_constraint(NSPredicateOperatorType, const ColumnReference&, const ColumnReference&); - - void add_link_constraint(NSPredicateOperatorType operatorType, const ColumnReference& column, RLMObject *obj); - void add_link_constraint(NSPredicateOperatorType operatorType, const ColumnReference& column, realm::null); - template - void add_link_constraint(NSPredicateOperatorType operatorType, T obj, const ColumnReference& column); - void add_link_constraint(NSPredicateOperatorType, const ColumnReference&, const ColumnReference&); - - template - void add_collection_operation_constraint(RLMPropertyType propertyType, NSPredicateOperatorType operatorType, T... values); - template - void add_collection_operation_constraint(NSPredicateOperatorType operatorType, - CollectionOperation collectionOperation, T... values); - - - CollectionOperation collection_operation_from_key_path(RLMObjectSchema *desc, NSString *keyPath); - ColumnReference column_reference_from_key_path(RLMObjectSchema *objectSchema, NSString *keyPath, bool isAggregate); - -private: - Query& m_query; - Group& m_group; - RLMSchema *m_schema; -}; - -// add a clause for numeric constraints based on operator type -template -void QueryBuilder::add_numeric_constraint(RLMPropertyType datatype, - NSPredicateOperatorType operatorType, - A&& lhs, B&& rhs) -{ - switch (operatorType) { - case NSLessThanPredicateOperatorType: - m_query.and_query(lhs < rhs); - break; - case NSLessThanOrEqualToPredicateOperatorType: - m_query.and_query(lhs <= rhs); - break; - case NSGreaterThanPredicateOperatorType: - m_query.and_query(lhs > rhs); - break; - case NSGreaterThanOrEqualToPredicateOperatorType: - m_query.and_query(lhs >= rhs); - break; - case NSEqualToPredicateOperatorType: - m_query.and_query(lhs == rhs); - break; - case NSNotEqualToPredicateOperatorType: - m_query.and_query(lhs != rhs); - break; - default: - @throw RLMPredicateException(@"Invalid operator type", - @"Operator '%@' not supported for type %@", operatorName(operatorType), RLMTypeToString(datatype)); - } -} - -template -void QueryBuilder::add_bool_constraint(NSPredicateOperatorType operatorType, A lhs, B rhs) { - switch (operatorType) { - case NSEqualToPredicateOperatorType: - m_query.and_query(lhs == rhs); - break; - case NSNotEqualToPredicateOperatorType: - m_query.and_query(lhs != rhs); - break; - default: - @throw RLMPredicateException(@"Invalid operator type", - @"Operator '%@' not supported for bool type", operatorName(operatorType)); - } -} - -template -void QueryBuilder::add_string_constraint(NSPredicateOperatorType operatorType, - NSComparisonPredicateOptions predicateOptions, - Columns &&column, - T value) { - bool caseSensitive = !(predicateOptions & NSCaseInsensitivePredicateOption); - bool diacriticInsensitive = (predicateOptions & NSDiacriticInsensitivePredicateOption); - RLMPrecondition(!diacriticInsensitive, @"Invalid predicate option", - @"NSDiacriticInsensitivePredicateOption not supported for string type"); - - switch (operatorType) { - case NSBeginsWithPredicateOperatorType: - m_query.and_query(column.begins_with(value, caseSensitive)); - break; - case NSEndsWithPredicateOperatorType: - m_query.and_query(column.ends_with(value, caseSensitive)); - break; - case NSContainsPredicateOperatorType: - m_query.and_query(column.contains(value, caseSensitive)); - break; - case NSEqualToPredicateOperatorType: - m_query.and_query(column.equal(value, caseSensitive)); - break; - case NSNotEqualToPredicateOperatorType: - m_query.and_query(column.not_equal(value, caseSensitive)); - break; - case NSLikePredicateOperatorType: - m_query.and_query(column.like(value, caseSensitive)); - break; - default: - @throw RLMPredicateException(@"Invalid operator type", - @"Operator '%@' not supported for string type", operatorName(operatorType)); - } -} - -void QueryBuilder::add_string_constraint(NSPredicateOperatorType operatorType, - NSComparisonPredicateOptions predicateOptions, - StringData value, - Columns&& column) { - switch (operatorType) { - case NSEqualToPredicateOperatorType: - case NSNotEqualToPredicateOperatorType: - add_string_constraint(operatorType, predicateOptions, std::move(column), value); - break; - default: - @throw RLMPredicateException(@"Invalid operator type", - @"Operator '%@' is not supported for string type with key path on right side of operator", - operatorName(operatorType)); - } -} - -id value_from_constant_expression_or_value(id value) { - if (NSExpression *exp = RLMDynamicCast(value)) { - RLMPrecondition(exp.expressionType == NSConstantValueExpressionType, - @"Invalid value", - @"Expressions within predicate aggregates must be constant values"); - return exp.constantValue; - } - return value; -} - -void validate_and_extract_between_range(id value, RLMProperty *prop, id *from, id *to) { - NSArray *array = RLMDynamicCast(value); - RLMPrecondition(array, @"Invalid value", @"object must be of type NSArray for BETWEEN operations"); - RLMPrecondition(array.count == 2, @"Invalid value", @"NSArray object must contain exactly two objects for BETWEEN operations"); - - *from = value_from_constant_expression_or_value(array.firstObject); - *to = value_from_constant_expression_or_value(array.lastObject); - RLMPrecondition(RLMIsObjectValidForProperty(*from, prop) && RLMIsObjectValidForProperty(*to, prop), - @"Invalid value", - @"NSArray objects must be of type %@ for BETWEEN operations", RLMTypeToString(prop.type)); -} - -void QueryBuilder::add_between_constraint(const ColumnReference& column, id value) { - if (column.has_any_to_many_links()) { - auto link_column = column.last_link_column(); - Query subquery = get_table(m_group, link_column.link_target_object_schema()).where(); - QueryBuilder(subquery, m_group, m_schema).add_between_constraint(column.column_ignoring_links(subquery), value); - - m_query.and_query(link_column.resolve(std::move(subquery)).count() > 0); - return; - } - - id from, to; - validate_and_extract_between_range(value, column.property(), &from, &to); - - RLMPropertyType type = column.type(); - - m_query.group(); - add_constraint(type, NSGreaterThanOrEqualToPredicateOperatorType, 0, column, from); - add_constraint(type, NSLessThanOrEqualToPredicateOperatorType, 0, column, to); - m_query.end_group(); -} - -template -void QueryBuilder::add_binary_constraint(NSPredicateOperatorType operatorType, - const ColumnReference& column, - T value) { - RLMPrecondition(!column.has_links(), @"Unsupported operator", @"NSData properties cannot be queried over an object link."); - - size_t index = column.index(); - switch (operatorType) { - case NSBeginsWithPredicateOperatorType: - m_query.begins_with(index, value); - break; - case NSEndsWithPredicateOperatorType: - m_query.ends_with(index, value); - break; - case NSContainsPredicateOperatorType: - m_query.contains(index, value); - break; - case NSEqualToPredicateOperatorType: - m_query.equal(index, value); - break; - case NSNotEqualToPredicateOperatorType: - m_query.not_equal(index, value); - break; - default: - @throw RLMPredicateException(@"Invalid operator type", - @"Operator '%@' not supported for binary type", operatorName(operatorType)); - } -} - -void QueryBuilder::add_binary_constraint(NSPredicateOperatorType operatorType, const ColumnReference& column, id value) { - add_binary_constraint(operatorType, column, RLMBinaryDataForNSData(value)); -} - -void QueryBuilder::add_binary_constraint(NSPredicateOperatorType operatorType, id value, const ColumnReference& column) { - switch (operatorType) { - case NSEqualToPredicateOperatorType: - case NSNotEqualToPredicateOperatorType: - add_binary_constraint(operatorType, column, value); - break; - default: - @throw RLMPredicateException(@"Invalid operator type", - @"Operator '%@' is not supported for binary type with key path on right side of operator", - operatorName(operatorType)); - } -} - -void QueryBuilder::add_binary_constraint(NSPredicateOperatorType, const ColumnReference&, const ColumnReference&) { - @throw RLMPredicateException(@"Invalid predicate", @"Comparisons between two NSData properties are not supported"); -} - -void QueryBuilder::add_link_constraint(NSPredicateOperatorType operatorType, - const ColumnReference& column, RLMObject *obj) { - RLMPrecondition(operatorType == NSEqualToPredicateOperatorType || operatorType == NSNotEqualToPredicateOperatorType, - @"Invalid operator type", @"Only 'Equal' and 'Not Equal' operators supported for object comparison"); - - if (operatorType == NSEqualToPredicateOperatorType) { - m_query.and_query(column.resolve() == obj->_row); - } - else { - m_query.and_query(column.resolve() != obj->_row); - } -} - -void QueryBuilder::add_link_constraint(NSPredicateOperatorType operatorType, - const ColumnReference& column, - realm::null) { - RLMPrecondition(!column.has_links(), @"Unsupported operator", @"Multi-level object equality link queries are not supported."); - RLMPrecondition(operatorType == NSEqualToPredicateOperatorType || operatorType == NSNotEqualToPredicateOperatorType, - @"Invalid operator type", @"Only 'Equal' and 'Not Equal' operators supported for object comparison"); - if (operatorType == NSNotEqualToPredicateOperatorType) { - m_query.Not(); - } - - m_query.and_query(column.resolve().is_null()); -} - -template -void QueryBuilder::add_link_constraint(NSPredicateOperatorType operatorType, T obj, const ColumnReference& column) { - // Link constraints only support the equal-to and not-equal-to operators. The order of operands - // is not important for those comparisons so we can delegate to the other implementation. - add_link_constraint(operatorType, column, obj); -} - -void QueryBuilder::add_link_constraint(NSPredicateOperatorType, const ColumnReference&, const ColumnReference&) { - // This is not actually reachable as this case is caught earlier, but this - // overload is needed for the code to compile - @throw RLMPredicateException(@"Invalid predicate", @"Comparisons between two RLMArray properties are not supported"); -} - - -// iterate over an array of subpredicates, using @func to build a query from each -// one and ORing them together -template -void process_or_group(Query &query, id array, Func&& func) { - RLMPrecondition([array conformsToProtocol:@protocol(NSFastEnumeration)], - @"Invalid value", @"IN clause requires an array of items"); - - query.group(); - - bool first = true; - for (id item in array) { - if (!first) { - query.Or(); - } - first = false; - - func(item); - } - - if (first) { - // Queries can't be empty, so if there's zero things in the OR group - // validation will fail. Work around this by adding an expression which - // will never find any rows in a table. - query.and_query(std::unique_ptr(new FalseExpression)); - } - - query.end_group(); -} - -template -RequestedType convert(id value); - -template <> -Timestamp convert(id value) { - return RLMTimestampForNSDate(value); -} - -template <> -bool convert(id value) { - return [value boolValue]; -} - -template <> -Double convert(id value) { - return [value doubleValue]; -} - -template <> -Float convert(id value) { - return [value floatValue]; -} - -template <> -Int convert(id value) { - return [value longLongValue]; -} - -template <> -String convert(id value) { - return RLMStringDataWithNSString(value); -} - -template -realm::null value_of_type(realm::null) { - return realm::null(); -} - -template -auto value_of_type(id value) { - return ::convert(value); -} - -template -auto value_of_type(const ColumnReference& column) { - return column.resolve(); -} - - -template -void QueryBuilder::do_add_constraint(RLMPropertyType type, NSPredicateOperatorType operatorType, - NSComparisonPredicateOptions predicateOptions, T... values) -{ - static_assert(sizeof...(T) == 2, "do_add_constraint accepts only two values as arguments"); - - switch (type) { - case RLMPropertyTypeBool: - add_bool_constraint(operatorType, value_of_type(values)...); - break; - case RLMPropertyTypeDate: - add_numeric_constraint(type, operatorType, value_of_type(values)...); - break; - case RLMPropertyTypeDouble: - add_numeric_constraint(type, operatorType, value_of_type(values)...); - break; - case RLMPropertyTypeFloat: - add_numeric_constraint(type, operatorType, value_of_type(values)...); - break; - case RLMPropertyTypeInt: - add_numeric_constraint(type, operatorType, value_of_type(values)...); - break; - case RLMPropertyTypeString: - add_string_constraint(operatorType, predicateOptions, value_of_type(values)...); - break; - case RLMPropertyTypeData: - add_binary_constraint(operatorType, values...); - break; - case RLMPropertyTypeObject: - case RLMPropertyTypeArray: - case RLMPropertyTypeLinkingObjects: - add_link_constraint(operatorType, values...); - break; - default: - @throw RLMPredicateException(@"Unsupported predicate value type", - @"Object type %@ not supported", RLMTypeToString(type)); - } -} - -void QueryBuilder::do_add_constraint(RLMPropertyType, NSPredicateOperatorType, NSComparisonPredicateOptions, id, realm::null) -{ - // This is not actually reachable as this case is caught earlier, but this - // overload is needed for the code to compile - @throw RLMPredicateException(@"Invalid predicate expressions", - @"Predicate expressions must compare a keypath and another keypath or a constant value"); -} - -bool is_nsnull(id value) { - return !value || value == NSNull.null; -} - -template -bool is_nsnull(T) { - return false; -} - -template -void QueryBuilder::add_constraint(RLMPropertyType type, NSPredicateOperatorType operatorType, - NSComparisonPredicateOptions predicateOptions, L lhs, R rhs) -{ - // The expression operators are only overloaded for realm::null on the rhs - RLMPrecondition(!is_nsnull(lhs), @"Unsupported operator", - @"Nil is only supported on the right side of operators"); - - if (is_nsnull(rhs)) { - do_add_constraint(type, operatorType, predicateOptions, lhs, realm::null()); - } - else { - do_add_constraint(type, operatorType, predicateOptions, lhs, rhs); - } -} - -struct KeyPath { - std::vector links; - RLMProperty *property; - bool containsToManyRelationship; -}; - -KeyPath key_path_from_string(RLMSchema *schema, RLMObjectSchema *objectSchema, NSString *keyPath) -{ - RLMProperty *property; - std::vector links; - - bool keyPathContainsToManyRelationship = false; - - NSUInteger start = 0, length = keyPath.length, end = NSNotFound; - do { - end = [keyPath rangeOfString:@"." options:0 range:{start, length - start}].location; - NSString *propertyName = [keyPath substringWithRange:{start, end == NSNotFound ? length - start : end - start}]; - property = objectSchema[propertyName]; - RLMPrecondition(property, @"Invalid property name", - @"Property '%@' not found in object of type '%@'", propertyName, objectSchema.className); - - if (property.type == RLMPropertyTypeArray || property.type == RLMPropertyTypeLinkingObjects) - keyPathContainsToManyRelationship = true; - - if (end != NSNotFound) { - RLMPrecondition(property.type == RLMPropertyTypeObject || property.type == RLMPropertyTypeArray || property.type == RLMPropertyTypeLinkingObjects, - @"Invalid value", @"Property '%@' is not a link in object of type '%@'", propertyName, objectSchema.className); - - links.push_back(property); - REALM_ASSERT(property.objectClassName); - objectSchema = schema[property.objectClassName]; - } - - start = end + 1; - } while (end != NSNotFound); - - return {std::move(links), property, keyPathContainsToManyRelationship}; -} - -ColumnReference QueryBuilder::column_reference_from_key_path(RLMObjectSchema *objectSchema, NSString *keyPathString, bool isAggregate) -{ - auto keyPath = key_path_from_string(m_schema, objectSchema, keyPathString); - - if (isAggregate && !keyPath.containsToManyRelationship) { - @throw RLMPredicateException(@"Invalid predicate", - @"Aggregate operations can only be used on key paths that include an array property"); - } else if (!isAggregate && keyPath.containsToManyRelationship) { - @throw RLMPredicateException(@"Invalid predicate", - @"Key paths that include an array property must use aggregate operations"); - } - - return ColumnReference(m_query, m_group, m_schema, keyPath.property, std::move(keyPath.links)); -} - -void validate_property_value(const ColumnReference& column, - __unsafe_unretained id const value, - __unsafe_unretained NSString *const err, - __unsafe_unretained RLMObjectSchema *const objectSchema, - __unsafe_unretained NSString *const keyPath) { - RLMProperty *prop = column.property(); - if (prop.type == RLMPropertyTypeArray) { - RLMPrecondition([RLMObjectBaseObjectSchema(RLMDynamicCast(value)).className isEqualToString:prop.objectClassName], - @"Invalid value", err, prop.objectClassName, keyPath, objectSchema.className, value); - } - else { - RLMPrecondition(RLMIsObjectValidForProperty(value, prop), - @"Invalid value", err, RLMTypeToString(prop.type), keyPath, objectSchema.className, value); - } - if (RLMObjectBase *obj = RLMDynamicCast(value)) { - RLMPrecondition(!obj->_row.is_attached() || &column.group() == &obj->_realm.group, - @"Invalid value origin", @"Object must be from the Realm being queried"); - } -} - -template -struct ValueOfTypeWithCollectionOperationHelper; - -template <> -struct ValueOfTypeWithCollectionOperationHelper { - static auto convert(const CollectionOperation& operation) - { - assert(operation.type() == CollectionOperation::Count); - return operation.link_column().resolve().count(); - } -}; - -#define VALUE_OF_TYPE_WITH_COLLECTION_OPERATOR_HELPER(OperationType, function) \ -template \ -struct ValueOfTypeWithCollectionOperationHelper { \ - static auto convert(const CollectionOperation& operation) \ - { \ - REALM_ASSERT(operation.type() == OperationType); \ - auto targetColumn = operation.link_column().resolve().template column(operation.column().index()); \ - return targetColumn.function(); \ - } \ -} \ - -VALUE_OF_TYPE_WITH_COLLECTION_OPERATOR_HELPER(CollectionOperation::Minimum, min); -VALUE_OF_TYPE_WITH_COLLECTION_OPERATOR_HELPER(CollectionOperation::Maximum, max); -VALUE_OF_TYPE_WITH_COLLECTION_OPERATOR_HELPER(CollectionOperation::Sum, sum); -VALUE_OF_TYPE_WITH_COLLECTION_OPERATOR_HELPER(CollectionOperation::Average, average); -#undef VALUE_OF_TYPE_WITH_COLLECTION_OPERATOR_HELPER - -template -auto value_of_type_with_collection_operation(T&& value) { - return value_of_type(std::forward(value)); -} - -template -auto value_of_type_with_collection_operation(CollectionOperation operation) { - using helper = ValueOfTypeWithCollectionOperationHelper; - return helper::convert(operation); -} - -template -void QueryBuilder::add_collection_operation_constraint(RLMPropertyType propertyType, NSPredicateOperatorType operatorType, T... values) -{ - switch (propertyType) { - case RLMPropertyTypeInt: - add_numeric_constraint(propertyType, operatorType, value_of_type_with_collection_operation(values)...); - break; - case RLMPropertyTypeFloat: - add_numeric_constraint(propertyType, operatorType, value_of_type_with_collection_operation(values)...); - break; - case RLMPropertyTypeDouble: - add_numeric_constraint(propertyType, operatorType, value_of_type_with_collection_operation(values)...); - break; - default: - REALM_ASSERT(false && "Only numeric property types should hit this path."); - } -} - -template -void QueryBuilder::add_collection_operation_constraint(NSPredicateOperatorType operatorType, - CollectionOperation collectionOperation, T... values) -{ - static_assert(sizeof...(T) == 2, "add_collection_operation_constraint accepts only two values as arguments"); - - switch (collectionOperation.type()) { - case CollectionOperation::Count: - add_numeric_constraint(RLMPropertyTypeInt, operatorType, - value_of_type_with_collection_operation(values)...); - break; - case CollectionOperation::Minimum: - add_collection_operation_constraint(collectionOperation.column().type(), operatorType, values...); - break; - case CollectionOperation::Maximum: - add_collection_operation_constraint(collectionOperation.column().type(), operatorType, values...); - break; - case CollectionOperation::Sum: - add_collection_operation_constraint(collectionOperation.column().type(), operatorType, values...); - break; - case CollectionOperation::Average: - add_collection_operation_constraint(collectionOperation.column().type(), operatorType, values...); - break; - } -} - -bool key_path_contains_collection_operator(NSString *keyPath) { - return [keyPath rangeOfString:@"@"].location != NSNotFound; -} - -NSString *get_collection_operation_name_from_key_path(NSString *keyPath, NSString **leadingKeyPath, NSString **trailingKey) { - NSRange at = [keyPath rangeOfString:@"@"]; - if (at.location == NSNotFound || at.location >= keyPath.length - 1) { - @throw RLMPredicateException(@"Invalid key path", @"'%@' is not a valid key path'", keyPath); - } - - if (at.location == 0 || [keyPath characterAtIndex:at.location - 1] != '.') { - @throw RLMPredicateException(@"Invalid key path", @"'%@' is not a valid key path'", keyPath); - } - - NSRange trailingKeyRange = [keyPath rangeOfString:@"." options:0 range:{at.location, keyPath.length - at.location} locale:nil]; - - *leadingKeyPath = [keyPath substringToIndex:at.location - 1]; - if (trailingKeyRange.location == NSNotFound) { - *trailingKey = nil; - return [keyPath substringFromIndex:at.location]; - } else { - *trailingKey = [keyPath substringFromIndex:trailingKeyRange.location + 1]; - return [keyPath substringWithRange:{at.location, trailingKeyRange.location - at.location}]; - } -} - -CollectionOperation QueryBuilder::collection_operation_from_key_path(RLMObjectSchema *desc, NSString *keyPath) { - NSString *leadingKeyPath; - NSString *trailingKey; - NSString *collectionOperationName = get_collection_operation_name_from_key_path(keyPath, &leadingKeyPath, &trailingKey); - - ColumnReference linkColumn = column_reference_from_key_path(desc, leadingKeyPath, true); - util::Optional column; - if (trailingKey) { - RLMPrecondition([trailingKey rangeOfString:@"."].location == NSNotFound, @"Invalid key path", - @"Right side of collection operator may only have a single level key"); - NSString *fullKeyPath = [leadingKeyPath stringByAppendingFormat:@".%@", trailingKey]; - column = column_reference_from_key_path(desc, fullKeyPath, true); - } - - return {collectionOperationName, std::move(linkColumn), std::move(column)}; -} - -void QueryBuilder::apply_collection_operator_expression(RLMObjectSchema *desc, - NSString *keyPath, id value, - NSComparisonPredicate *pred) { - CollectionOperation operation = collection_operation_from_key_path(desc, keyPath); - operation.validate_comparison(value); - - if (pred.leftExpression.expressionType == NSKeyPathExpressionType) { - add_collection_operation_constraint(pred.predicateOperatorType, operation, operation, value); - } else { - add_collection_operation_constraint(pred.predicateOperatorType, operation, value, operation); - } -} - -void QueryBuilder::apply_value_expression(RLMObjectSchema *desc, - NSString *keyPath, id value, - NSComparisonPredicate *pred) -{ - if (key_path_contains_collection_operator(keyPath)) { - apply_collection_operator_expression(desc, keyPath, value, pred); - return; - } - - bool isAny = pred.comparisonPredicateModifier == NSAnyPredicateModifier; - ColumnReference column = column_reference_from_key_path(desc, keyPath, isAny); - - // check to see if this is a between query - if (pred.predicateOperatorType == NSBetweenPredicateOperatorType) { - add_between_constraint(std::move(column), value); - return; - } - - // turn "key.path IN collection" into ored together ==. "collection IN key.path" is handled elsewhere. - if (pred.predicateOperatorType == NSInPredicateOperatorType) { - process_or_group(m_query, value, [&](id item) { - id normalized = value_from_constant_expression_or_value(item); - validate_property_value(column, normalized, - @"Expected object of type %@ in IN clause for property '%@' on object of type '%@', but received: %@", desc, keyPath); - add_constraint(column.type(), NSEqualToPredicateOperatorType, pred.options, column, normalized); - }); - return; - } - - validate_property_value(column, value, @"Expected object of type %@ for property '%@' on object of type '%@', but received: %@", desc, keyPath); - if (pred.leftExpression.expressionType == NSKeyPathExpressionType) { - add_constraint(column.type(), pred.predicateOperatorType, pred.options, std::move(column), value); - } else { - add_constraint(column.type(), pred.predicateOperatorType, pred.options, value, std::move(column)); - } -} - -void QueryBuilder::apply_column_expression(RLMObjectSchema *desc, - NSString *leftKeyPath, NSString *rightKeyPath, - NSComparisonPredicate *predicate) -{ - bool left_key_path_contains_collection_operator = key_path_contains_collection_operator(leftKeyPath); - bool right_key_path_contains_collection_operator = key_path_contains_collection_operator(rightKeyPath); - if (left_key_path_contains_collection_operator && right_key_path_contains_collection_operator) { - @throw RLMPredicateException(@"Unsupported predicate", @"Key paths including aggregate operations cannot be compared with other aggregate operations."); - } - - if (left_key_path_contains_collection_operator) { - CollectionOperation left = collection_operation_from_key_path(desc, leftKeyPath); - ColumnReference right = column_reference_from_key_path(desc, rightKeyPath, false); - left.validate_comparison(right); - add_collection_operation_constraint(predicate.predicateOperatorType, left, left, std::move(right)); - return; - } - if (right_key_path_contains_collection_operator) { - ColumnReference left = column_reference_from_key_path(desc, leftKeyPath, false); - CollectionOperation right = collection_operation_from_key_path(desc, rightKeyPath); - right.validate_comparison(left); - add_collection_operation_constraint(predicate.predicateOperatorType, right, std::move(left), right); - return; - } - - bool isAny = false; - ColumnReference left = column_reference_from_key_path(desc, leftKeyPath, isAny); - ColumnReference right = column_reference_from_key_path(desc, rightKeyPath, isAny); - - // NOTE: It's assumed that column type must match and no automatic type conversion is supported. - RLMPrecondition(left.type() == right.type(), - RLMPropertiesComparisonTypeMismatchException, - RLMPropertiesComparisonTypeMismatchReason, - RLMTypeToString(left.type()), - RLMTypeToString(right.type())); - - // TODO: Should we handle special case where left row is the same as right row (tautology) - add_constraint(left.type(), predicate.predicateOperatorType, predicate.options, - std::move(left), std::move(right)); -} - -// Identify expressions of the form [SELF valueForKeyPath:] -bool is_self_value_for_key_path_function_expression(NSExpression *expression) -{ - if (expression.expressionType != NSFunctionExpressionType) - return false; - - if (expression.operand.expressionType != NSEvaluatedObjectExpressionType) - return false; - - return [expression.function isEqualToString:@"valueForKeyPath:"]; -} - -// -[NSPredicate predicateWithSubtitutionVariables:] results in function expressions of the form [SELF valueForKeyPath:] -// that apply_predicate cannot handle. Replace such expressions with equivalent NSKeyPathExpressionType expressions. -NSExpression *simplify_self_value_for_key_path_function_expression(NSExpression *expression) { - if (is_self_value_for_key_path_function_expression(expression)) { - if (NSString *keyPath = [expression.arguments.firstObject keyPath]) { - return [NSExpression expressionForKeyPath:keyPath]; - } - } - return expression; -} - -void QueryBuilder::apply_subquery_count_expression(RLMObjectSchema *objectSchema, - NSExpression *subqueryExpression, NSPredicateOperatorType operatorType, NSExpression *right) { - if (right.expressionType != NSConstantValueExpressionType || ![right.constantValue isKindOfClass:[NSNumber class]]) { - @throw RLMPredicateException(@"Invalid predicate expression", @"SUBQUERY(
).@count is only supported when compared with a constant number."); - } - int64_t value = [right.constantValue integerValue]; - - ColumnReference collectionColumn = column_reference_from_key_path(objectSchema, [subqueryExpression.collection keyPath], true); - RLMObjectSchema *collectionMemberObjectSchema = m_schema[collectionColumn.property().objectClassName]; - - // Eliminate references to the iteration variable in the subquery. - NSPredicate *subqueryPredicate = [subqueryExpression.predicate predicateWithSubstitutionVariables:@{ subqueryExpression.variable : [NSExpression expressionForEvaluatedObject] }]; - subqueryPredicate = transformPredicate(subqueryPredicate, simplify_self_value_for_key_path_function_expression); - - Query subquery = RLMPredicateToQuery(subqueryPredicate, collectionMemberObjectSchema, m_schema, m_group); - add_numeric_constraint(RLMPropertyTypeInt, operatorType, - collectionColumn.resolve(std::move(subquery)).count(), value); -} - -void QueryBuilder::apply_function_subquery_expression(RLMObjectSchema *objectSchema, NSExpression *functionExpression, - NSPredicateOperatorType operatorType, NSExpression *right) { - if (![functionExpression.function isEqualToString:@"valueForKeyPath:"] || functionExpression.arguments.count != 1) { - @throw RLMPredicateException(@"Invalid predicate", @"The '%@' function is not supported on the result of a SUBQUERY.", functionExpression.function); - } - - NSExpression *keyPathExpression = functionExpression.arguments.firstObject; - if ([keyPathExpression.keyPath isEqualToString:@"@count"]) { - apply_subquery_count_expression(objectSchema, functionExpression.operand, operatorType, right); - } else { - @throw RLMPredicateException(@"Invalid predicate", @"SUBQUERY is only supported when immediately followed by .@count that is compared with a constant number."); - } -} - -void QueryBuilder::apply_function_expression(RLMObjectSchema *objectSchema, NSExpression *functionExpression, - NSPredicateOperatorType operatorType, NSExpression *right) { - if (functionExpression.operand.expressionType == NSSubqueryExpressionType) { - apply_function_subquery_expression(objectSchema, functionExpression, operatorType, right); - } else { - @throw RLMPredicateException(@"Invalid predicate", @"The '%@' function is not supported.", functionExpression.function); - } -} - - -void QueryBuilder::apply_predicate(NSPredicate *predicate, RLMObjectSchema *objectSchema) -{ - // Compound predicates. - if ([predicate isMemberOfClass:[NSCompoundPredicate class]]) { - NSCompoundPredicate *comp = (NSCompoundPredicate *)predicate; - - switch ([comp compoundPredicateType]) { - case NSAndPredicateType: - if (comp.subpredicates.count) { - // Add all of the subpredicates. - m_query.group(); - for (NSPredicate *subp in comp.subpredicates) { - apply_predicate(subp, objectSchema); - } - m_query.end_group(); - } else { - // NSCompoundPredicate's documentation states that an AND predicate with no subpredicates evaluates to TRUE. - m_query.and_query(std::unique_ptr(new TrueExpression)); - } - break; - - case NSOrPredicateType: { - // Add all of the subpredicates with ors inbetween. - process_or_group(m_query, comp.subpredicates, [&](__unsafe_unretained NSPredicate *const subp) { - apply_predicate(subp, objectSchema); - }); - break; - } - - case NSNotPredicateType: - // Add the negated subpredicate - m_query.Not(); - apply_predicate(comp.subpredicates.firstObject, objectSchema); - break; - - default: - @throw RLMPredicateException(@"Invalid compound predicate type", - @"Only support AND, OR and NOT predicate types"); - } - } - else if ([predicate isMemberOfClass:[NSComparisonPredicate class]]) { - NSComparisonPredicate *compp = (NSComparisonPredicate *)predicate; - - // check modifier - RLMPrecondition(compp.comparisonPredicateModifier != NSAllPredicateModifier, - @"Invalid predicate", @"ALL modifier not supported"); - - NSExpressionType exp1Type = compp.leftExpression.expressionType; - NSExpressionType exp2Type = compp.rightExpression.expressionType; - - if (compp.comparisonPredicateModifier == NSAnyPredicateModifier) { - // for ANY queries - RLMPrecondition(exp1Type == NSKeyPathExpressionType && exp2Type == NSConstantValueExpressionType, - @"Invalid predicate", - @"Predicate with ANY modifier must compare a KeyPath with RLMArray with a value"); - } - - if (compp.predicateOperatorType == NSBetweenPredicateOperatorType || compp.predicateOperatorType == NSInPredicateOperatorType) { - // Inserting an array via %@ gives NSConstantValueExpressionType, but including it directly gives NSAggregateExpressionType - if (exp1Type == NSKeyPathExpressionType && (exp2Type == NSAggregateExpressionType || exp2Type == NSConstantValueExpressionType)) { - // "key.path IN %@", "key.path IN {
}", "key.path BETWEEN %@", or "key.path BETWEEN {
}". - exp2Type = NSConstantValueExpressionType; - } - else if (compp.predicateOperatorType == NSInPredicateOperatorType && exp1Type == NSConstantValueExpressionType && exp2Type == NSKeyPathExpressionType) { - // "%@ IN key.path" is equivalent to "ANY key.path IN %@". Rewrite the former into the latter. - compp = [NSComparisonPredicate predicateWithLeftExpression:compp.rightExpression rightExpression:compp.leftExpression - modifier:NSAnyPredicateModifier type:NSEqualToPredicateOperatorType options:0]; - exp1Type = NSKeyPathExpressionType; - exp2Type = NSConstantValueExpressionType; - } - else { - if (compp.predicateOperatorType == NSBetweenPredicateOperatorType) { - @throw RLMPredicateException(@"Invalid predicate", - @"Predicate with BETWEEN operator must compare a KeyPath with an aggregate with two values"); - } - else if (compp.predicateOperatorType == NSInPredicateOperatorType) { - @throw RLMPredicateException(@"Invalid predicate", - @"Predicate with IN operator must compare a KeyPath with an aggregate"); - } - } - } - - if (exp1Type == NSKeyPathExpressionType && exp2Type == NSKeyPathExpressionType) { - // both expression are KeyPaths - apply_column_expression(objectSchema, compp.leftExpression.keyPath, compp.rightExpression.keyPath, compp); - } - else if (exp1Type == NSKeyPathExpressionType && exp2Type == NSConstantValueExpressionType) { - // comparing keypath to value - apply_value_expression(objectSchema, compp.leftExpression.keyPath, compp.rightExpression.constantValue, compp); - } - else if (exp1Type == NSConstantValueExpressionType && exp2Type == NSKeyPathExpressionType) { - // comparing value to keypath - apply_value_expression(objectSchema, compp.rightExpression.keyPath, compp.leftExpression.constantValue, compp); - } - else if (exp1Type == NSFunctionExpressionType) { - apply_function_expression(objectSchema, compp.leftExpression, compp.predicateOperatorType, compp.rightExpression); - } - else if (exp1Type == NSSubqueryExpressionType) { - // The subquery expressions that we support are handled by the NSFunctionExpressionType case above. - @throw RLMPredicateException(@"Invalid predicate expression", @"SUBQUERY is only supported when immediately followed by .@count."); - } - else { - @throw RLMPredicateException(@"Invalid predicate expressions", - @"Predicate expressions must compare a keypath and another keypath or a constant value"); - } - } - else if ([predicate isEqual:[NSPredicate predicateWithValue:YES]]) { - m_query.and_query(std::unique_ptr(new TrueExpression)); - } else if ([predicate isEqual:[NSPredicate predicateWithValue:NO]]) { - m_query.and_query(std::unique_ptr(new FalseExpression)); - } - else { - // invalid predicate type - @throw RLMPredicateException(@"Invalid predicate", - @"Only support compound, comparison, and constant predicates"); - } -} - -std::vector RLMValidatedColumnIndicesForSort(RLMClassInfo& classInfo, NSString *keyPathString) -{ - RLMPrecondition([keyPathString rangeOfString:@"@"].location == NSNotFound, @"Invalid key path for sort", - @"Cannot sort on '%@': sorting on key paths that include collection operators is not supported.", - keyPathString); - auto keyPath = key_path_from_string(classInfo.realm.schema, classInfo.rlmObjectSchema, keyPathString); - - RLMPrecondition(!keyPath.containsToManyRelationship, @"Invalid key path for sort", - @"Cannot sort on '%@': sorting on key paths that include a to-many relationship is not supported.", - keyPathString); - - switch (keyPath.property.type) { - case RLMPropertyTypeBool: - case RLMPropertyTypeDate: - case RLMPropertyTypeDouble: - case RLMPropertyTypeFloat: - case RLMPropertyTypeInt: - case RLMPropertyTypeString: - break; - - default: - @throw RLMPredicateException(@"Invalid sort property type", - @"Cannot sort on key path '%@' on object of type '%s': sorting is only supported on bool, date, double, float, integer, and string properties, but property is of type %@.", - keyPathString, classInfo.rlmObjectSchema.className, RLMTypeToString(keyPath.property.type)); - } - - std::vector columnIndices; - columnIndices.reserve(keyPath.links.size() + 1); - - auto currentClassInfo = &classInfo; - for (RLMProperty *link : keyPath.links) { - auto tableColumn = currentClassInfo->tableColumn(link); - currentClassInfo = ¤tClassInfo->linkTargetType(tableColumn); - columnIndices.push_back(tableColumn); - } - columnIndices.push_back(currentClassInfo->tableColumn(keyPath.property)); - - return columnIndices; -} - -} // namespace - -realm::Query RLMPredicateToQuery(NSPredicate *predicate, RLMObjectSchema *objectSchema, - RLMSchema *schema, Group &group) -{ - auto query = get_table(group, objectSchema).where(); - - // passing a nil predicate is a no-op - if (!predicate) { - return query; - } - - @autoreleasepool { - QueryBuilder(query, group, schema).apply_predicate(predicate, objectSchema); - } - - // Test the constructed query in core - std::string validateMessage = query.validate(); - RLMPrecondition(validateMessage.empty(), @"Invalid query", @"%.*s", - (int)validateMessage.size(), validateMessage.c_str()); - return query; -} - -realm::SortDescriptor RLMSortDescriptorFromDescriptors(RLMClassInfo& classInfo, NSArray *descriptors) { - std::vector> columnIndices; - std::vector ascending; - columnIndices.reserve(descriptors.count); - ascending.reserve(descriptors.count); - - for (RLMSortDescriptor *descriptor in descriptors) { - columnIndices.push_back(RLMValidatedColumnIndicesForSort(classInfo, descriptor.keyPath)); - ascending.push_back(descriptor.ascending); - } - - return {*classInfo.table(), std::move(columnIndices), std::move(ascending)}; -} diff --git a/Pods/Realm/Realm/RLMRealm.mm b/Pods/Realm/Realm/RLMRealm.mm deleted file mode 100644 index 0dd01160..00000000 --- a/Pods/Realm/Realm/RLMRealm.mm +++ /dev/null @@ -1,749 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMRealm_Private.hpp" - -#import "RLMAnalytics.hpp" -#import "RLMArray_Private.hpp" -#import "RLMRealmConfiguration_Private.hpp" -#import "RLMMigration_Private.h" -#import "RLMObjectSchema_Private.hpp" -#import "RLMProperty_Private.h" -#import "RLMObjectStore.h" -#import "RLMObject_Private.h" -#import "RLMObject_Private.hpp" -#import "RLMObservation.hpp" -#import "RLMProperty.h" -#import "RLMQueryUtil.hpp" -#import "RLMRealmUtil.hpp" -#import "RLMSchema_Private.hpp" -#import "RLMSyncManager_Private.h" -#import "RLMThreadSafeReference_Private.hpp" -#import "RLMUpdateChecker.hpp" -#import "RLMUtil.hpp" - -#include "impl/realm_coordinator.hpp" -#include "object_store.hpp" -#include "schema.hpp" -#include "shared_realm.hpp" - -#include -#include -#include - -using namespace realm; -using util::File; - -@interface RLMRealmNotificationToken : RLMNotificationToken -@property (nonatomic, strong) RLMRealm *realm; -@property (nonatomic, copy) RLMNotificationBlock block; -@end - -@interface RLMRealm () -@property (nonatomic, strong) NSHashTable *notificationHandlers; -- (void)sendNotifications:(RLMNotification)notification; -@end - -void RLMDisableSyncToDisk() { - realm::disable_sync_to_disk(); -} - -@implementation RLMRealmNotificationToken -- (void)stop { - [_realm verifyThread]; - [_realm.notificationHandlers removeObject:self]; - _realm = nil; - _block = nil; -} - -- (void)suppressNextNotification { - // Temporarily replace the block with one which restores the old block - // rather than producing a notification. - - // This briefly creates a retain cycle but it's fine because the block will - // be synchronously called shortly after this method is called. Unlike with - // collection notifications, this does not have to go through the object - // store or do fancy things to handle transaction coalescing because it's - // called synchronously by the obj-c code and not by the object store. - auto notificationBlock = _block; - _block = ^(RLMNotification, RLMRealm *) { - _block = notificationBlock; - }; -} - -- (void)dealloc { - if (_realm || _block) { - NSLog(@"RLMNotificationToken released without unregistering a notification. You must hold " - @"on to the RLMNotificationToken returned from addNotificationBlock and call " - @"-[RLMNotificationToken stop] when you no longer wish to receive RLMRealm notifications."); - } -} -@end - -static bool shouldForciblyDisableEncryption() { - static bool disableEncryption = getenv("REALM_DISABLE_ENCRYPTION"); - return disableEncryption; -} - -NSData *RLMRealmValidatedEncryptionKey(NSData *key) { - if (shouldForciblyDisableEncryption()) { - return nil; - } - - if (key) { - if (key.length != 64) { - @throw RLMException(@"Encryption key must be exactly 64 bytes long"); - } -#if TARGET_OS_WATCH - @throw RLMException(@"Cannot open an encrypted Realm on watchOS."); -#endif - } - - return key; -} - -@implementation RLMRealm { - NSHashTable *_collectionEnumerators; - bool _sendingNotifications; -} - -+ (BOOL)isCoreDebug { - return realm::Version::has_feature(realm::feature_Debug); -} - -+ (void)initialize { - static bool initialized; - if (initialized) { - return; - } - initialized = true; - - RLMCheckForUpdates(); - RLMSendAnalytics(); -} - -- (BOOL)isEmpty { - return realm::ObjectStore::is_empty(self.group); -} - -- (void)verifyThread { - _realm->verify_thread(); -} - -- (BOOL)inWriteTransaction { - return _realm->is_in_transaction(); -} - -- (realm::Group &)group { - return _realm->read_group(); -} - -- (BOOL)autorefresh { - return _realm->auto_refresh(); -} - -- (void)setAutorefresh:(BOOL)autorefresh { - _realm->set_auto_refresh(autorefresh); -} - -+ (instancetype)defaultRealm { - return [RLMRealm realmWithConfiguration:[RLMRealmConfiguration rawDefaultConfiguration] error:nil]; -} - -+ (instancetype)realmWithURL:(NSURL *)fileURL { - RLMRealmConfiguration *configuration = [RLMRealmConfiguration defaultConfiguration]; - configuration.fileURL = fileURL; - return [RLMRealm realmWithConfiguration:configuration error:nil]; -} -// ARC tries to eliminate calls to autorelease when the value is then immediately -// returned, but this results in significantly different semantics between debug -// and release builds for RLMRealm, so force it to always autorelease. -static id RLMAutorelease(id value) { - // +1 __bridge_retained, -1 CFAutorelease - return value ? (__bridge id)CFAutorelease((__bridge_retained CFTypeRef)value) : nil; -} - -static void RLMRealmSetSchemaAndAlign(RLMRealm *realm, RLMSchema *targetSchema) { - realm.schema = targetSchema; - realm->_info = RLMSchemaInfo(realm, targetSchema, realm->_realm->schema()); -} - -+ (instancetype)realmWithSharedRealm:(SharedRealm)sharedRealm schema:(RLMSchema *)schema { - RLMRealm *realm = [RLMRealm new]; - realm->_realm = sharedRealm; - realm->_dynamic = YES; - RLMRealmSetSchemaAndAlign(realm, schema); - return RLMAutorelease(realm); -} - -REALM_NOINLINE void RLMRealmTranslateException(NSError **error) { - try { - throw; - } - catch (RealmFileException const& ex) { - switch (ex.kind()) { - case RealmFileException::Kind::PermissionDenied: - RLMSetErrorOrThrow(RLMMakeError(RLMErrorFilePermissionDenied, ex), error); - break; - case RealmFileException::Kind::IncompatibleLockFile: { - NSString *err = @"Realm file is currently open in another process " - "which cannot share access with this process. All " - "processes sharing a single file must be the same " - "architecture. For sharing files between the Realm " - "Browser and an iOS simulator, this means that you " - "must use a 64-bit simulator."; - RLMSetErrorOrThrow(RLMMakeError(RLMErrorIncompatibleLockFile, - File::PermissionDenied(err.UTF8String, ex.path())), error); - break; - } - case RealmFileException::Kind::NotFound: - RLMSetErrorOrThrow(RLMMakeError(RLMErrorFileNotFound, ex), error); - break; - case RealmFileException::Kind::Exists: - RLMSetErrorOrThrow(RLMMakeError(RLMErrorFileExists, ex), error); - break; - case RealmFileException::Kind::BadHistoryError: { - NSString *err = @"Realm file's history format is incompatible with the " - "settings in the configuration object being used to open " - "the Realm. Note that Realms configured for sync cannot be " - "opened as non-synced Realms, and vice versa. Otherwise, the " - "file may be corrupt."; - RLMSetErrorOrThrow(RLMMakeError(RLMErrorFileAccess, - File::AccessError(err.UTF8String, ex.path())), error); - break; - } - case RealmFileException::Kind::AccessError: - RLMSetErrorOrThrow(RLMMakeError(RLMErrorFileAccess, ex), error); - break; - case RealmFileException::Kind::FormatUpgradeRequired: - RLMSetErrorOrThrow(RLMMakeError(RLMErrorFileFormatUpgradeRequired, ex), error); - break; - default: - RLMSetErrorOrThrow(RLMMakeError(RLMErrorFail, ex), error); - break; - } - } - catch (AddressSpaceExhausted const &ex) { - RLMSetErrorOrThrow(RLMMakeError(RLMErrorAddressSpaceExhausted, ex), error); - } - catch (SchemaMismatchException const& ex) { - RLMSetErrorOrThrow(RLMMakeError(RLMErrorSchemaMismatch, ex), error); - } - catch (std::system_error const& ex) { - RLMSetErrorOrThrow(RLMMakeError(ex), error); - } - catch (const std::exception &exp) { - RLMSetErrorOrThrow(RLMMakeError(RLMErrorFail, exp), error); - } -} - -+ (instancetype)realmWithConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error { - bool dynamic = configuration.dynamic; - bool readOnly = configuration.readOnly; - - { - Realm::Config& config = configuration.config; - - // try to reuse existing realm first - if (config.cache || dynamic) { - if (RLMRealm *realm = RLMGetThreadLocalCachedRealmForPath(config.path)) { - auto const& old_config = realm->_realm->config(); - if (old_config.read_only() != config.read_only()) { - @throw RLMException(@"Realm at path '%s' already opened with different read permissions", config.path.c_str()); - } - if (old_config.in_memory != config.in_memory) { - @throw RLMException(@"Realm at path '%s' already opened with different inMemory settings", config.path.c_str()); - } - if (realm->_dynamic != dynamic) { - @throw RLMException(@"Realm at path '%s' already opened with different dynamic settings", config.path.c_str()); - } - if (old_config.encryption_key != config.encryption_key) { - @throw RLMException(@"Realm at path '%s' already opened with different encryption key", config.path.c_str()); - } - return RLMAutorelease(realm); - } - } - } - - configuration = [configuration copy]; - Realm::Config& config = configuration.config; - - RLMRealm *realm = [RLMRealm new]; - realm->_dynamic = dynamic; - - // protects the realm cache and accessors cache - static std::mutex initLock; - std::lock_guard lock(initLock); - - try { - realm->_realm = Realm::get_shared_realm(config); - } - catch (...) { - RLMRealmTranslateException(error); - return nil; - } - - RLMSchema *cachedRealmSchema; - @autoreleasepool { - // ensure that cachedRealm doesn't end up in this thread's autorelease pool - cachedRealmSchema = RLMGetAnyCachedRealmForPath(config.path).schema; - } - - // if we have a cached realm on another thread, copy without a transaction - if (cachedRealmSchema) { - RLMRealmSetSchemaAndAlign(realm, cachedRealmSchema); - } - else if (dynamic) { - RLMRealmSetSchemaAndAlign(realm, [RLMSchema dynamicSchemaFromObjectStoreSchema:realm->_realm->schema()]); - } - else { - // set/align schema or perform migration if needed - RLMSchema *schema = configuration.customSchema ?: RLMSchema.sharedSchema; - - Realm::MigrationFunction migrationFunction; - auto migrationBlock = configuration.migrationBlock; - if (migrationBlock && configuration.schemaVersion > 0) { - migrationFunction = [=](SharedRealm old_realm, SharedRealm realm, Schema& mutableSchema) { - RLMSchema *oldSchema = [RLMSchema dynamicSchemaFromObjectStoreSchema:old_realm->schema()]; - RLMRealm *oldRealm = [RLMRealm realmWithSharedRealm:old_realm schema:oldSchema]; - - // The destination RLMRealm can't just use the schema from the - // SharedRealm because it doesn't have information about whether or - // not a class was defined in Swift, which effects how new objects - // are created - RLMRealm *newRealm = [RLMRealm realmWithSharedRealm:realm schema:schema.copy]; - - [[[RLMMigration alloc] initWithRealm:newRealm oldRealm:oldRealm schema:mutableSchema] execute:migrationBlock]; - - oldRealm->_realm = nullptr; - newRealm->_realm = nullptr; - }; - } - - try { - realm->_realm->update_schema(schema.objectStoreCopy, config.schema_version, - std::move(migrationFunction)); - } - catch (...) { - RLMRealmTranslateException(error); - return nil; - } - - RLMRealmSetSchemaAndAlign(realm, schema); - RLMRealmCreateAccessors(realm.schema); - - if (!readOnly) { - // initializing the schema started a read transaction, so end it - [realm invalidate]; - } - } - - if (config.cache) { - RLMCacheRealm(config.path, realm); - } - - if (!readOnly) { - realm->_realm->m_binding_context = RLMCreateBindingContext(realm); - realm->_realm->m_binding_context->realm = realm->_realm; - } - - return RLMAutorelease(realm); -} - -+ (void)resetRealmState { - RLMClearRealmCache(); - realm::_impl::RealmCoordinator::clear_cache(); - [RLMRealmConfiguration resetRealmConfigurationState]; -} - -- (void)verifyNotificationsAreSupported { - [self verifyThread]; - if (_realm->config().read_only()) { - @throw RLMException(@"Read-only Realms do not change and do not have change notifications"); - } - if (!_realm->can_deliver_notifications()) { - @throw RLMException(@"Can only add notification blocks from within runloops."); - } -} - -- (RLMNotificationToken *)addNotificationBlock:(RLMNotificationBlock)block { - if (!block) { - @throw RLMException(@"The notification block should not be nil"); - } - [self verifyNotificationsAreSupported]; - - _realm->read_group(); - - if (!_notificationHandlers) { - _notificationHandlers = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory]; - } - - RLMRealmNotificationToken *token = [[RLMRealmNotificationToken alloc] init]; - token.realm = self; - token.block = block; - [_notificationHandlers addObject:token]; - return token; -} - -- (void)sendNotifications:(RLMNotification)notification { - NSAssert(!_realm->config().read_only(), @"Read-only realms do not have notifications"); - if (_sendingNotifications) { - return; - } - NSUInteger count = _notificationHandlers.count; - if (count == 0) { - return; - } - - _sendingNotifications = true; - auto cleanup = realm::util::make_scope_exit([&]() noexcept { - _sendingNotifications = false; - }); - - // call this realm's notification blocks - if (count == 1) { - if (auto block = [_notificationHandlers.anyObject block]) { - block(notification, self); - } - } - else { - for (RLMRealmNotificationToken *token in _notificationHandlers.allObjects) { - if (auto block = token.block) { - block(notification, self); - } - } - } -} - -- (RLMRealmConfiguration *)configuration { - RLMRealmConfiguration *configuration = [[RLMRealmConfiguration alloc] init]; - configuration.config = _realm->config(); - configuration.dynamic = _dynamic; - configuration.customSchema = _schema; - return configuration; -} - -- (void)beginWriteTransaction { - try { - _realm->begin_transaction(); - } - catch (std::exception &ex) { - @throw RLMException(ex); - } -} - -- (void)commitWriteTransaction { - [self commitWriteTransaction:nil]; -} - -- (BOOL)commitWriteTransaction:(NSError **)outError { - try { - _realm->commit_transaction(); - return YES; - } - catch (...) { - RLMRealmTranslateException(outError); - return NO; - } -} - -- (BOOL)commitWriteTransactionWithoutNotifying:(NSArray *)tokens error:(NSError **)error { - for (RLMNotificationToken *token in tokens) { - if (token.realm != self) { - @throw RLMException(@"Incorrect Realm: only notifications for the Realm being modified can be skipped."); - } - [token suppressNextNotification]; - } - - try { - _realm->commit_transaction(); - return YES; - } - catch (...) { - RLMRealmTranslateException(error); - return NO; - } -} - -- (void)transactionWithBlock:(void(^)(void))block { - [self transactionWithBlock:block error:nil]; -} - -- (BOOL)transactionWithBlock:(void(^)(void))block error:(NSError **)outError { - [self beginWriteTransaction]; - block(); - if (_realm->is_in_transaction()) { - return [self commitWriteTransaction:outError]; - } - return YES; -} - -- (void)cancelWriteTransaction { - try { - _realm->cancel_transaction(); - } - catch (std::exception &ex) { - @throw RLMException(ex); - } -} - -- (void)invalidate { - if (_realm->is_in_transaction()) { - NSLog(@"WARNING: An RLMRealm instance was invalidated during a write " - "transaction and all pending changes have been rolled back."); - } - - [self detachAllEnumerators]; - - for (auto& objectInfo : _info) { - for (RLMObservationInfo *info : objectInfo.second.observedObjects) { - info->willChange(RLMInvalidatedKey); - } - } - - _realm->invalidate(); - - for (auto& objectInfo : _info) { - for (RLMObservationInfo *info : objectInfo.second.observedObjects) { - info->didChange(RLMInvalidatedKey); - } - objectInfo.second.releaseTable(); - } -} - -- (nullable id)resolveThreadSafeReference:(RLMThreadSafeReference *)reference { - return [reference resolveReferenceInRealm:self]; -} - -/** - Replaces all string columns in this Realm with a string enumeration column and compacts the - database file. - - Cannot be called from a write transaction. - - Compaction will not occur if other `RLMRealm` instances exist. - - While compaction is in progress, attempts by other threads or processes to open the database will - wait. - - Be warned that resource requirements for compaction is proportional to the amount of live data in - the database. - - Compaction works by writing the database contents to a temporary database file and then replacing - the database with the temporary one. The name of the temporary file is formed by appending - `.tmp_compaction_space` to the name of the database. - - @return YES if the compaction succeeded. - */ -- (BOOL)compact { - // compact() automatically ends the read transaction, but we need to clean - // up cached state and send invalidated notifications when that happens, so - // explicitly end it first unless we're in a write transaction (in which - // case compact() will throw an exception) - if (!_realm->is_in_transaction()) { - [self invalidate]; - } - - try { - return _realm->compact(); - } - catch (std::exception const& ex) { - @throw RLMException(ex); - } -} - -- (void)dealloc { - if (_realm) { - if (_realm->is_in_transaction()) { - [self cancelWriteTransaction]; - NSLog(@"WARNING: An RLMRealm instance was deallocated during a write transaction and all " - "pending changes have been rolled back. Make sure to retain a reference to the " - "RLMRealm for the duration of the write transaction."); - } - } -} - -- (BOOL)refresh { - return _realm->refresh(); -} - -- (void)addObject:(__unsafe_unretained RLMObject *const)object { - RLMAddObjectToRealm(object, self, false); -} - -- (void)addObjects:(id)array { - for (RLMObject *obj in array) { - if (![obj isKindOfClass:[RLMObject class]]) { - @throw RLMException(@"Cannot insert objects of type %@ with addObjects:. Only RLMObjects are supported.", - NSStringFromClass(obj.class)); - } - [self addObject:obj]; - } -} - -- (void)addOrUpdateObject:(RLMObject *)object { - // verify primary key - if (!object.objectSchema.primaryKeyProperty) { - @throw RLMException(@"'%@' does not have a primary key and can not be updated", object.objectSchema.className); - } - - RLMAddObjectToRealm(object, self, true); -} - -- (void)addOrUpdateObjectsFromArray:(id)array { - for (RLMObject *obj in array) { - [self addOrUpdateObject:obj]; - } -} - -- (void)deleteObject:(RLMObject *)object { - RLMDeleteObjectFromRealm(object, self); -} - -- (void)deleteObjects:(id)array { - if ([array respondsToSelector:@selector(realm)] && [array respondsToSelector:@selector(deleteObjectsFromRealm)]) { - if (self != (RLMRealm *)[array realm]) { - @throw RLMException(@"Can only delete objects from the Realm they belong to."); - } - [array deleteObjectsFromRealm]; - } - else if ([array conformsToProtocol:@protocol(NSFastEnumeration)]) { - for (id obj in array) { - if ([obj isKindOfClass:RLMObjectBase.class]) { - RLMDeleteObjectFromRealm(obj, self); - } - } - } - else { - @throw RLMException(@"Invalid array type - container must be an RLMArray, RLMArray, or NSArray of RLMObjects"); - } -} - -- (void)deleteAllObjects { - RLMDeleteAllObjectsFromRealm(self); -} - -- (RLMResults *)allObjects:(NSString *)objectClassName { - return RLMGetObjects(self, objectClassName, nil); -} - -- (RLMResults *)objects:(NSString *)objectClassName where:(NSString *)predicateFormat, ... { - va_list args; - va_start(args, predicateFormat); - RLMResults *results = [self objects:objectClassName where:predicateFormat args:args]; - va_end(args); - return results; -} - -- (RLMResults *)objects:(NSString *)objectClassName where:(NSString *)predicateFormat args:(va_list)args { - return [self objects:objectClassName withPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]]; -} - -- (RLMResults *)objects:(NSString *)objectClassName withPredicate:(NSPredicate *)predicate { - return RLMGetObjects(self, objectClassName, predicate); -} - -- (RLMObject *)objectWithClassName:(NSString *)className forPrimaryKey:(id)primaryKey { - return RLMGetObject(self, className, primaryKey); -} - -+ (uint64_t)schemaVersionAtURL:(NSURL *)fileURL encryptionKey:(NSData *)key error:(NSError **)error { - try { - RLMRealmConfiguration *config = [[RLMRealmConfiguration alloc] init]; - config.fileURL = fileURL; - config.encryptionKey = RLMRealmValidatedEncryptionKey(key); - - uint64_t version = Realm::get_schema_version(config.config); - if (version == realm::ObjectStore::NotVersioned) { - RLMSetErrorOrThrow([NSError errorWithDomain:RLMErrorDomain code:RLMErrorFail userInfo:@{NSLocalizedDescriptionKey:@"Cannot open an uninitialized realm in read-only mode"}], error); - } - return version; - } - catch (std::exception &exp) { - RLMSetErrorOrThrow(RLMMakeError(RLMErrorFail, exp), error); - return RLMNotVersioned; - } -} - -+ (nullable NSError *)migrateRealm:(RLMRealmConfiguration *)configuration { - // Preserves backwards compatibility - NSError *error; - [self performMigrationForConfiguration:configuration error:&error]; - return error; -} - -+ (BOOL)performMigrationForConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error { - if (RLMGetAnyCachedRealmForPath(configuration.config.path)) { - @throw RLMException(@"Cannot migrate Realms that are already open."); - } - - NSError *localError; // Prevents autorelease - BOOL success; - @autoreleasepool { - success = [RLMRealm realmWithConfiguration:configuration error:&localError] != nil; - } - if (!success && error) { - *error = localError; // Must set outside pool otherwise will free anyway - } - return success; -} - -- (RLMObject *)createObject:(NSString *)className withValue:(id)value { - return (RLMObject *)RLMCreateObjectInRealmWithValue(self, className, value, false); -} - -- (BOOL)writeCopyToURL:(NSURL *)fileURL encryptionKey:(NSData *)key error:(NSError **)error { - key = RLMRealmValidatedEncryptionKey(key); - NSString *path = fileURL.path; - - try { - _realm->write_copy(path.UTF8String, {static_cast(key.bytes), key.length}); - return YES; - } - catch (...) { - __autoreleasing NSError *dummyError; - if (!error) { - error = &dummyError; - } - RLMRealmTranslateException(error); - return NO; - } - - return NO; -} - -- (void)registerEnumerator:(RLMFastEnumerator *)enumerator { - if (!_collectionEnumerators) { - _collectionEnumerators = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory]; - } - [_collectionEnumerators addObject:enumerator]; - -} - -- (void)unregisterEnumerator:(RLMFastEnumerator *)enumerator { - [_collectionEnumerators removeObject:enumerator]; -} - -- (void)detachAllEnumerators { - for (RLMFastEnumerator *enumerator in _collectionEnumerators) { - [enumerator detach]; - } - _collectionEnumerators = nil; -} - -@end diff --git a/Pods/Realm/Realm/RLMRealmConfiguration+Sync.mm b/Pods/Realm/Realm/RLMRealmConfiguration+Sync.mm deleted file mode 100644 index 528d7327..00000000 --- a/Pods/Realm/Realm/RLMRealmConfiguration+Sync.mm +++ /dev/null @@ -1,64 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMRealmConfiguration+Sync.h" - -#import "RLMRealmConfiguration_Private.hpp" -#import "RLMSyncConfiguration_Private.hpp" -#import "RLMSyncUser_Private.hpp" -#import "RLMSyncManager_Private.h" -#import "RLMSyncUtil_Private.hpp" -#import "RLMUtil.hpp" - -#import "sync/sync_config.hpp" -#import "sync/sync_manager.hpp" - -@implementation RLMRealmConfiguration (Sync) - -#pragma mark - API - -- (void)setSyncConfiguration:(RLMSyncConfiguration *)syncConfiguration { - RLMSyncUser *user = syncConfiguration.user; - if (user.state == RLMSyncUserStateError) { - @throw RLMException(@"Cannot set a sync configuration which has an errored-out user."); - } - - NSURL *realmURL = syncConfiguration.realmURL; - // Ensure sync manager is initialized, if it hasn't already been. - [RLMSyncManager sharedManager]; - NSAssert(user.identity, @"Cannot call this method on a user that doesn't have an identity."); - if (syncConfiguration.customFileURL) { - self.config.path = syncConfiguration.customFileURL.path.UTF8String; - } else { - self.config.path = SyncManager::shared().path_for_realm([user.identity UTF8String], - [realmURL.absoluteString UTF8String]); - } - self.config.in_memory = false; - self.config.sync_config = std::make_shared([syncConfiguration rawConfiguration]); - self.config.schema_mode = realm::SchemaMode::Additive; -} - -- (RLMSyncConfiguration *)syncConfiguration { - if (!self.config.sync_config) { - return nil; - } - realm::SyncConfig& sync_config = *self.config.sync_config; - return [[RLMSyncConfiguration alloc] initWithRawConfig:sync_config]; -} - -@end diff --git a/Pods/Realm/Realm/RLMRealmConfiguration.mm b/Pods/Realm/Realm/RLMRealmConfiguration.mm deleted file mode 100644 index b6ea49e5..00000000 --- a/Pods/Realm/Realm/RLMRealmConfiguration.mm +++ /dev/null @@ -1,266 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMRealmConfiguration_Private.h" - -#import "RLMObjectSchema_Private.hpp" -#import "RLMRealm_Private.h" -#import "RLMSchema_Private.hpp" -#import "RLMUtil.hpp" - -#import "schema.hpp" -#import "shared_realm.hpp" - -static NSString *const c_RLMRealmConfigurationProperties[] = { - @"fileURL", - @"inMemoryIdentifier", - @"encryptionKey", - @"readOnly", - @"schemaVersion", - @"migrationBlock", - @"deleteRealmIfMigrationNeeded", - @"dynamic", - @"customSchema", -}; - -static NSString *const c_defaultRealmFileName = @"default.realm"; -RLMRealmConfiguration *s_defaultConfiguration; - -NSString *RLMRealmPathForFileAndBundleIdentifier(NSString *fileName, NSString *bundleIdentifier) { - return [RLMDefaultDirectoryForBundleIdentifier(bundleIdentifier) - stringByAppendingPathComponent:fileName]; -} - -NSString *RLMRealmPathForFile(NSString *fileName) { - static NSString *directory = RLMDefaultDirectoryForBundleIdentifier(nil); - return [directory stringByAppendingPathComponent:fileName]; -} - -@implementation RLMRealmConfiguration { - realm::Realm::Config _config; -} - -- (realm::Realm::Config&)config { - return _config; -} - -+ (instancetype)defaultConfiguration { - return [[self rawDefaultConfiguration] copy]; -} - -+ (void)setDefaultConfiguration:(RLMRealmConfiguration *)configuration { - if (!configuration) { - @throw RLMException(@"Cannot set the default configuration to nil."); - } - @synchronized(c_defaultRealmFileName) { - s_defaultConfiguration = [configuration copy]; - } -} - -+ (RLMRealmConfiguration *)rawDefaultConfiguration { - @synchronized(c_defaultRealmFileName) { - if (!s_defaultConfiguration) { - s_defaultConfiguration = [[RLMRealmConfiguration alloc] init]; - } - } - return s_defaultConfiguration; -} - -+ (void)resetRealmConfigurationState { - @synchronized(c_defaultRealmFileName) { - s_defaultConfiguration = nil; - } -} - -- (instancetype)init { - self = [super init]; - if (self) { - static NSURL *defaultRealmURL = [NSURL fileURLWithPath:RLMRealmPathForFile(c_defaultRealmFileName)]; - self.fileURL = defaultRealmURL; - self.schemaVersion = 0; - } - - return self; -} - -- (instancetype)copyWithZone:(NSZone *)zone { - RLMRealmConfiguration *configuration = [[[self class] allocWithZone:zone] init]; - configuration->_config = _config; - configuration->_dynamic = _dynamic; - configuration->_migrationBlock = _migrationBlock; - configuration->_customSchema = _customSchema; - return configuration; -} - -- (NSString *)description { - NSMutableString *string = [NSMutableString stringWithFormat:@"%@ {\n", self.class]; - for (NSString *key : c_RLMRealmConfigurationProperties) { - NSString *description = [[self valueForKey:key] description]; - description = [description stringByReplacingOccurrencesOfString:@"\n" withString:@"\n\t"]; - - [string appendFormat:@"\t%@ = %@;\n", key, description]; - } - return [string stringByAppendingString:@"}"]; -} - -static void RLMNSStringToStdString(std::string &out, NSString *in) { - out.resize([in maximumLengthOfBytesUsingEncoding:NSUTF8StringEncoding]); - if (out.empty()) { - return; - } - - NSUInteger size = out.size(); - [in getBytes:&out[0] - maxLength:size - usedLength:&size - encoding:NSUTF8StringEncoding - options:0 range:{0, in.length} remainingRange:nullptr]; - out.resize(size); -} - -- (NSURL *)fileURL { - if (_config.in_memory || _config.sync_config) { - return nil; - } - return [NSURL fileURLWithPath:@(_config.path.c_str())]; -} - -- (void)setFileURL:(NSURL *)fileURL { - NSString *path = fileURL.path; - if (path.length == 0) { - @throw RLMException(@"Realm path must not be empty"); - } - _config.sync_config = nullptr; - - RLMNSStringToStdString(_config.path, path); - _config.in_memory = false; -} - -- (NSString *)inMemoryIdentifier { - if (!_config.in_memory) { - return nil; - } - return [@(_config.path.c_str()) lastPathComponent]; -} - -- (void)setInMemoryIdentifier:(NSString *)inMemoryIdentifier { - if (inMemoryIdentifier.length == 0) { - @throw RLMException(@"In-memory identifier must not be empty"); - } - _config.sync_config = nullptr; - - RLMNSStringToStdString(_config.path, [NSTemporaryDirectory() stringByAppendingPathComponent:inMemoryIdentifier]); - _config.in_memory = true; -} - -- (NSData *)encryptionKey { - return _config.encryption_key.empty() ? nil : [NSData dataWithBytes:_config.encryption_key.data() length:_config.encryption_key.size()]; -} - -- (void)setEncryptionKey:(NSData * __nullable)encryptionKey { - if (NSData *key = RLMRealmValidatedEncryptionKey(encryptionKey)) { - auto bytes = static_cast(key.bytes); - _config.encryption_key.assign(bytes, bytes + key.length); - } - else { - _config.encryption_key.clear(); - } -} - -- (BOOL)readOnly { - return _config.read_only(); -} - -- (void)setReadOnly:(BOOL)readOnly { - if (readOnly) { - if (self.deleteRealmIfMigrationNeeded) { - @throw RLMException(@"Cannot set `readOnly` when `deleteRealmIfMigrationNeeded` is set."); - } - _config.schema_mode = realm::SchemaMode::ReadOnly; - } - else if (self.readOnly) { - _config.schema_mode = realm::SchemaMode::Automatic; - } -} - -- (uint64_t)schemaVersion { - return _config.schema_version; -} - -- (void)setSchemaVersion:(uint64_t)schemaVersion { - if (schemaVersion == RLMNotVersioned) { - @throw RLMException(@"Cannot set schema version to %llu (RLMNotVersioned)", RLMNotVersioned); - } - _config.schema_version = schemaVersion; -} - -- (BOOL)deleteRealmIfMigrationNeeded { - return _config.schema_mode == realm::SchemaMode::ResetFile; -} - -- (void)setDeleteRealmIfMigrationNeeded:(BOOL)deleteRealmIfMigrationNeeded { - if (deleteRealmIfMigrationNeeded) { - if (self.readOnly) { - @throw RLMException(@"Cannot set `deleteRealmIfMigrationNeeded` when `readOnly` is set."); - } - _config.schema_mode = realm::SchemaMode::ResetFile; - } - else if (self.deleteRealmIfMigrationNeeded) { - _config.schema_mode = realm::SchemaMode::Automatic; - } -} - -- (NSArray *)objectClasses { - return [_customSchema.objectSchema valueForKeyPath:@"objectClass"]; -} - -- (void)setObjectClasses:(NSArray *)objectClasses { - self.customSchema = [RLMSchema schemaWithObjectClasses:objectClasses]; -} - -- (void)setDynamic:(bool)dynamic { - _dynamic = dynamic; - _config.cache = !dynamic; -} - -- (bool)cache { - return _config.cache; -} - -- (void)setCache:(bool)cache { - _config.cache = cache; -} - -- (bool)disableFormatUpgrade { - return _config.disable_format_upgrade; -} - -- (void)setDisableFormatUpgrade:(bool)disableFormatUpgrade { - _config.disable_format_upgrade = disableFormatUpgrade; -} - -- (realm::SchemaMode)schemaMode { - return _config.schema_mode; -} - -- (void)setSchemaMode:(realm::SchemaMode)mode { - _config.schema_mode = mode; -} - -@end - diff --git a/Pods/Realm/Realm/RLMRealmUtil.mm b/Pods/Realm/Realm/RLMRealmUtil.mm deleted file mode 100644 index 0d38a914..00000000 --- a/Pods/Realm/Realm/RLMRealmUtil.mm +++ /dev/null @@ -1,143 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMRealmUtil.hpp" - -#import "RLMObjectSchema_Private.hpp" -#import "RLMObservation.hpp" -#import "RLMRealm_Private.hpp" -#import "RLMUtil.hpp" - -#import -#import - -#import "binding_context.hpp" - -#import -#import -#import -#import -#import -#import - -// Global realm state -static std::mutex s_realmCacheMutex; -static std::map s_realmsPerPath; - -void RLMCacheRealm(std::string const& path, RLMRealm *realm) { - std::lock_guard lock(s_realmCacheMutex); - NSMapTable *realms = s_realmsPerPath[path]; - if (!realms) { - s_realmsPerPath[path] = realms = [NSMapTable mapTableWithKeyOptions:NSPointerFunctionsOpaquePersonality|NSPointerFunctionsOpaqueMemory - valueOptions:NSPointerFunctionsWeakMemory]; - } - [realms setObject:realm forKey:(__bridge id)pthread_self()]; -} - -RLMRealm *RLMGetAnyCachedRealmForPath(std::string const& path) { - std::lock_guard lock(s_realmCacheMutex); - return [s_realmsPerPath[path] objectEnumerator].nextObject; -} - -RLMRealm *RLMGetThreadLocalCachedRealmForPath(std::string const& path) { - std::lock_guard lock(s_realmCacheMutex); - return [s_realmsPerPath[path] objectForKey:(__bridge id)pthread_self()]; -} - -void RLMClearRealmCache() { - std::lock_guard lock(s_realmCacheMutex); - s_realmsPerPath.clear(); -} - -namespace { -class RLMNotificationHelper : public realm::BindingContext { -public: - RLMNotificationHelper(RLMRealm *realm) : _realm(realm) { } - - bool can_deliver_notifications() const noexcept override { - // The main thread may not be in a run loop yet if we're called from - // something like `applicationDidFinishLaunching:`, but it presumably will - // be in the future - if ([NSThread isMainThread]) { - return true; - } - // Current mode indicates why the current callout from the runloop was made, - // and is null if a runloop callout isn't currently being processed - if (auto mode = CFRunLoopCopyCurrentMode(CFRunLoopGetCurrent())) { - CFRelease(mode); - return true; - } - return false; - } - - void changes_available() override { - @autoreleasepool { - auto realm = _realm; - if (realm && !realm.autorefresh) { - [realm sendNotifications:RLMRealmRefreshRequiredNotification]; - } - } - } - - std::vector get_observed_rows() override { - @autoreleasepool { - if (auto realm = _realm) { - [realm detachAllEnumerators]; - return RLMGetObservedRows(realm->_info); - } - return {}; - } - } - - void will_change(std::vector const& observed, std::vector const& invalidated) override { - @autoreleasepool { - RLMWillChange(observed, invalidated); - } - } - - void did_change(std::vector const& observed, std::vector const& invalidated, bool version_changed) override { - try { - @autoreleasepool { - RLMDidChange(observed, invalidated); - if (version_changed) { - [_realm sendNotifications:RLMRealmDidChangeNotification]; - } - } - } - catch (...) { - // This can only be called during a write transaction if it was - // called due to the transaction beginning, so cancel it to ensure - // exceptions thrown here behave the same as exceptions thrown when - // actually beginning the write - if (_realm.inWriteTransaction) { - [_realm cancelWriteTransaction]; - } - throw; - } - } - -private: - // This is owned by the realm, so it needs to not retain the realm - __weak RLMRealm *const _realm; -}; -} // anonymous namespace - - -std::unique_ptr RLMCreateBindingContext(RLMRealm *realm) { - return std::unique_ptr(new RLMNotificationHelper(realm)); -} diff --git a/Pods/Realm/Realm/RLMResults.mm b/Pods/Realm/Realm/RLMResults.mm deleted file mode 100644 index bc6695cc..00000000 --- a/Pods/Realm/Realm/RLMResults.mm +++ /dev/null @@ -1,482 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMResults_Private.h" - -#import "RLMArray_Private.hpp" -#import "RLMCollection_Private.hpp" -#import "RLMObjectSchema_Private.hpp" -#import "RLMObjectStore.h" -#import "RLMObject_Private.hpp" -#import "RLMObservation.hpp" -#import "RLMProperty_Private.h" -#import "RLMQueryUtil.hpp" -#import "RLMRealm_Private.hpp" -#import "RLMSchema_Private.h" -#import "RLMThreadSafeReference_Private.hpp" -#import "RLMUtil.hpp" - -#import "results.hpp" - -#import -#import -#import - -using namespace realm; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wincomplete-implementation" -@implementation RLMNotificationToken -@end -#pragma clang diagnostic pop - -@interface RLMResults () -@end - -// -// RLMResults implementation -// -@implementation RLMResults { - realm::Results _results; - RLMRealm *_realm; - RLMClassInfo *_info; -} - -- (instancetype)initPrivate { - self = [super init]; - return self; -} - -static void assertKeyPathIsNotNested(NSString *keyPath) { - if ([keyPath rangeOfString:@"."].location != NSNotFound) { - @throw RLMException(@"Nested key paths are not supported yet for KVC collection operators."); - } -} - -[[gnu::noinline]] -[[noreturn]] -static void throwError(NSString *aggregateMethod) { - try { - throw; - } - catch (realm::InvalidTransactionException const&) { - @throw RLMException(@"Cannot modify Results outside of a write transaction"); - } - catch (realm::IncorrectThreadException const&) { - @throw RLMException(@"Realm accessed from incorrect thread"); - } - catch (realm::Results::InvalidatedException const&) { - @throw RLMException(@"RLMResults has been invalidated"); - } - catch (realm::Results::DetatchedAccessorException const&) { - @throw RLMException(@"Object has been invalidated"); - } - catch (realm::Results::IncorrectTableException const& e) { - @throw RLMException(@"Object type '%s' does not match RLMResults type '%s'.", - e.actual.data(), e.expected.data()); - } - catch (realm::Results::OutOfBoundsIndexException const& e) { - @throw RLMException(@"Index %zu is out of bounds (must be less than %zu)", - e.requested, e.valid_count); - } - catch (realm::Results::UnsupportedColumnTypeException const& e) { - @throw RLMException(@"%@ is not supported for %@ property '%s'", - aggregateMethod, - RLMTypeToString((RLMPropertyType)e.column_type), - e.column_name.data()); - } -} - -template -static auto translateErrors(Function&& f, NSString *aggregateMethod=nil) { - try { - return f(); - } - catch (...) { - throwError(aggregateMethod); - } -} - -+ (instancetype)resultsWithObjectInfo:(RLMClassInfo&)info - results:(realm::Results)results { - RLMResults *ar = [[self alloc] initPrivate]; - ar->_results = std::move(results); - ar->_realm = info.realm; - ar->_info = &info; - return ar; -} - -+ (instancetype)emptyDetachedResults { - return [[self alloc] initPrivate]; -} - -static inline void RLMResultsValidateInWriteTransaction(__unsafe_unretained RLMResults *const ar) { - ar->_realm->_realm->verify_thread(); - ar->_realm->_realm->verify_in_write(); -} - -- (BOOL)isInvalidated { - return translateErrors([&] { return !_results.is_valid(); }); -} - -- (NSUInteger)count { - return translateErrors([&] { return _results.size(); }); -} - -- (NSString *)objectClassName { - return RLMStringDataToNSString(_results.get_object_type()); -} - -- (RLMClassInfo *)objectInfo { - return _info; -} - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state - objects:(__unused __unsafe_unretained id [])buffer - count:(NSUInteger)len { - if (!_info) { - return 0; - } - - __autoreleasing RLMFastEnumerator *enumerator; - if (state->state == 0) { - enumerator = [[RLMFastEnumerator alloc] initWithCollection:self objectSchema:*_info]; - state->extra[0] = (long)enumerator; - state->extra[1] = self.count; - } - else { - enumerator = (__bridge id)(void *)state->extra[0]; - } - - return [enumerator countByEnumeratingWithState:state count:len]; -} - -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ... { - va_list args; - va_start(args, predicateFormat); - NSUInteger index = [self indexOfObjectWhere:predicateFormat args:args]; - va_end(args); - return index; -} - -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args { - return [self indexOfObjectWithPredicate:[NSPredicate predicateWithFormat:predicateFormat - arguments:args]]; -} - -- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate { - if (_results.get_mode() == Results::Mode::Empty) { - return NSNotFound; - } - - Query query = translateErrors([&] { return _results.get_query(); }); - query.and_query(RLMPredicateToQuery(predicate, _info->rlmObjectSchema, _realm.schema, _realm.group)); - query.sync_view_if_needed(); - -#if REALM_VER_MAJOR >= 2 - size_t indexInTable; - if (const auto& sort = _results.get_sort()) { - // A sort order is specified so we need to return the first match given that ordering. - TableView table_view = query.find_all(); - table_view.sort(sort); - if (!table_view.size()) { - return NSNotFound; - } - indexInTable = table_view.get_source_ndx(0); - } else { - indexInTable = query.find(); - } - if (indexInTable == realm::not_found) { - return NSNotFound; - } - return RLMConvertNotFound(_results.index_of(indexInTable)); -#else - TableView table_view; - if (const auto& sort = _results.get_sort()) { - // A sort order is specified so we need to return the first match given that ordering. - table_view = query.find_all(); - table_view.sort(sort); - } else { - table_view = query.find_all(0, -1, 1); - } - if (!table_view.size()) { - return NSNotFound; - } - return _results.index_of(table_view.get_source_ndx(0)); -#endif -} - -- (id)objectAtIndex:(NSUInteger)index { - return translateErrors([&] { - return RLMCreateObjectAccessor(_realm, *_info, _results.get(index)); - }); -} - -- (id)firstObject { - auto row = translateErrors([&] { return _results.first(); }); - return row ? RLMCreateObjectAccessor(_realm, *_info, *row) : nil; -} - -- (id)lastObject { - auto row = translateErrors([&] { return _results.last(); }); - return row ? RLMCreateObjectAccessor(_realm, *_info, *row) : nil; -} - -- (NSUInteger)indexOfObject:(RLMObject *)object { - if (!object || (!object->_realm && !object.invalidated)) { - return NSNotFound; - } - - return translateErrors([&] { - return RLMConvertNotFound(_results.index_of(object->_row)); - }); -} - -- (id)valueForKeyPath:(NSString *)keyPath { - if ([keyPath characterAtIndex:0] == '@') { - if ([keyPath isEqualToString:@"@count"]) { - return @(self.count); - } - NSRange operatorRange = [keyPath rangeOfString:@"." options:NSLiteralSearch]; - NSUInteger keyPathLength = keyPath.length; - NSUInteger separatorIndex = operatorRange.location != NSNotFound ? operatorRange.location : keyPathLength; - NSString *operatorName = [keyPath substringWithRange:NSMakeRange(1, separatorIndex - 1)]; - SEL opSelector = NSSelectorFromString([NSString stringWithFormat:@"_%@ForKeyPath:", operatorName]); - BOOL isValidOperator = [self respondsToSelector:opSelector]; - if (!isValidOperator) { - @throw RLMException(@"Unsupported KVC collection operator found in key path '%@'", keyPath); - } - else if (separatorIndex >= keyPathLength - 1) { - @throw RLMException(@"Missing key path for KVC collection operator %@ in key path '%@'", operatorName, keyPath); - } - NSString *operatorKeyPath = [keyPath substringFromIndex:separatorIndex + 1]; - if (isValidOperator) { - return ((id(*)(id, SEL, id))objc_msgSend)(self, opSelector, operatorKeyPath); - } - } - return [super valueForKeyPath:keyPath]; -} - -- (id)valueForKey:(NSString *)key { - return translateErrors([&] { - return RLMCollectionValueForKey(self, key); - }); -} - -- (void)setValue:(id)value forKey:(NSString *)key { - translateErrors([&] { RLMResultsValidateInWriteTransaction(self); }); - RLMCollectionSetValueForKey(self, key, value); -} - -- (NSNumber *)_aggregateForKeyPath:(NSString *)keyPath method:(util::Optional (Results::*)(size_t))method - methodName:(NSString *)methodName returnNilForEmpty:(BOOL)returnNilForEmpty { - assertKeyPathIsNotNested(keyPath); - return [self aggregate:keyPath method:method methodName:methodName returnNilForEmpty:returnNilForEmpty]; -} - -- (NSNumber *)_minForKeyPath:(NSString *)keyPath { - return [self _aggregateForKeyPath:keyPath method:&Results::min methodName:@"@min" returnNilForEmpty:YES]; -} - -- (NSNumber *)_maxForKeyPath:(NSString *)keyPath { - return [self _aggregateForKeyPath:keyPath method:&Results::max methodName:@"@max" returnNilForEmpty:YES]; -} - -- (NSNumber *)_sumForKeyPath:(NSString *)keyPath { - return [self _aggregateForKeyPath:keyPath method:&Results::sum methodName:@"@sum" returnNilForEmpty:NO]; -} - -- (NSNumber *)_avgForKeyPath:(NSString *)keyPath { - return [self _aggregateForKeyPath:keyPath method:&Results::average methodName:@"@avg" returnNilForEmpty:YES]; -} - -- (NSArray *)_unionOfObjectsForKeyPath:(NSString *)keyPath { - assertKeyPathIsNotNested(keyPath); - return translateErrors([&] { - return RLMCollectionValueForKey(self, keyPath); - }); -} - -- (NSArray *)_distinctUnionOfObjectsForKeyPath:(NSString *)keyPath { - return [NSSet setWithArray:[self _unionOfObjectsForKeyPath:keyPath]].allObjects; -} - -- (NSArray *)_unionOfArraysForKeyPath:(NSString *)keyPath { - assertKeyPathIsNotNested(keyPath); - if ([keyPath isEqualToString:@"self"]) { - @throw RLMException(@"self is not a valid key-path for a KVC array collection operator as 'unionOfArrays'."); - } - - return translateErrors([&] { - NSArray *nestedResults = RLMCollectionValueForKey(self, keyPath); - NSMutableArray *flatArray = [NSMutableArray arrayWithCapacity:nestedResults.count]; - for (id array in nestedResults) { - NSArray *nsArray = RLMCollectionValueForKey(array, @"self"); - [flatArray addObjectsFromArray:nsArray]; - } - return flatArray; - }); -} - -- (NSArray *)_distinctUnionOfArraysForKeyPath:(__unused NSString *)keyPath { - return [NSSet setWithArray:[self _unionOfArraysForKeyPath:keyPath]].allObjects; -} - -- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ... { - va_list args; - va_start(args, predicateFormat); - RLMResults *results = [self objectsWhere:predicateFormat args:args]; - va_end(args); - return results; -} - -- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args { - return [self objectsWithPredicate:[NSPredicate predicateWithFormat:predicateFormat arguments:args]]; -} - -- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate { - return translateErrors([&] { - if (_results.get_mode() == Results::Mode::Empty) { - return self; - } - auto query = RLMPredicateToQuery(predicate, _info->rlmObjectSchema, _realm.schema, _realm.group); - return [RLMResults resultsWithObjectInfo:*_info results:_results.filter(std::move(query))]; - }); -} - -- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending { - return [self sortedResultsUsingDescriptors:@[[RLMSortDescriptor sortDescriptorWithKeyPath:keyPath ascending:ascending]]]; -} - -- (RLMResults *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascending { - return [self sortedResultsUsingKeyPath:property ascending:ascending]; -} - -- (RLMResults *)sortedResultsUsingDescriptors:(NSArray *)properties { - if (properties.count == 0) { - return self; - } - return translateErrors([&] { - if (_results.get_mode() == Results::Mode::Empty) { - return self; - } - - return [RLMResults resultsWithObjectInfo:*_info results:_results.sort(RLMSortDescriptorFromDescriptors(*_info, properties))]; - }); -} - -- (id)objectAtIndexedSubscript:(NSUInteger)index { - return [self objectAtIndex:index]; -} - -- (id)aggregate:(NSString *)property method:(util::Optional (Results::*)(size_t))method - methodName:(NSString *)methodName returnNilForEmpty:(BOOL)returnNilForEmpty { - if (_results.get_mode() == Results::Mode::Empty) { - return returnNilForEmpty ? nil : @0; - } - size_t column = _info->tableColumn(property); - auto value = translateErrors([&] { return (_results.*method)(column); }, methodName); - if (!value) { - return nil; - } - return RLMMixedToObjc(*value); -} - -- (id)minOfProperty:(NSString *)property { - return [self aggregate:property method:&Results::min methodName:@"minOfProperty" returnNilForEmpty:YES]; -} - -- (id)maxOfProperty:(NSString *)property { - return [self aggregate:property method:&Results::max methodName:@"maxOfProperty" returnNilForEmpty:YES]; -} - -- (id)sumOfProperty:(NSString *)property { - return [self aggregate:property method:&Results::sum methodName:@"sumOfProperty" returnNilForEmpty:NO]; -} - -- (id)averageOfProperty:(NSString *)property { - return [self aggregate:property method:&Results::average methodName:@"averageOfProperty" returnNilForEmpty:YES]; -} - -- (void)deleteObjectsFromRealm { - return translateErrors([&] { - if (_results.get_mode() == Results::Mode::Table) { - RLMResultsValidateInWriteTransaction(self); - RLMClearTable(*_info); - } - else { - RLMTrackDeletions(_realm, ^{ _results.clear(); }); - } - }); -} - -- (NSString *)description { - return RLMDescriptionWithMaxDepth(@"RLMResults", self, RLMDescriptionMaxDepth); -} - -- (NSUInteger)indexInSource:(NSUInteger)index { - return translateErrors([&] { return _results.get(index).get_index(); }); -} - -- (realm::TableView)tableView { - return translateErrors([&] { return _results.get_tableview(); }); -} - -// The compiler complains about the method's argument type not matching due to -// it not having the generic type attached, but it doesn't seem to be possible -// to actually include the generic type -// http://www.openradar.me/radar?id=6135653276319744 -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wmismatched-parameter-types" -- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *, RLMCollectionChange *, NSError *))block { - [_realm verifyNotificationsAreSupported]; - return RLMAddNotificationBlock(self, _results, block, true); -} -#pragma clang diagnostic pop - -- (BOOL)isAttached -{ - return !!_realm; -} - -#pragma mark - Thread Confined Protocol Conformance - -- (std::unique_ptr)makeThreadSafeReference { - return std::make_unique>(_realm->_realm->obtain_thread_safe_reference(_results)); -} - -- (id)objectiveCMetadata { - return nil; -} - -+ (instancetype)objectWithThreadSafeReference:(std::unique_ptr)reference - metadata:(__unused id)metadata - realm:(RLMRealm *)realm { - REALM_ASSERT_DEBUG(dynamic_cast *>(reference.get())); - auto results_reference = static_cast *>(reference.get()); - - Results results = realm->_realm->resolve_thread_safe_reference(std::move(*results_reference)); - - return [RLMResults resultsWithObjectInfo:realm->_info[RLMStringDataToNSString(results.get_object_type())] - results:std::move(results)]; -} - -@end - -@implementation RLMLinkingObjects -@end diff --git a/Pods/Realm/Realm/RLMSchema.mm b/Pods/Realm/Realm/RLMSchema.mm deleted file mode 100644 index a3899bd2..00000000 --- a/Pods/Realm/Realm/RLMSchema.mm +++ /dev/null @@ -1,338 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSchema_Private.h" - -#import "RLMAccessor.h" -#import "RLMObject_Private.hpp" -#import "RLMObjectSchema_Private.hpp" -#import "RLMProperty_Private.h" -#import "RLMRealm_Private.hpp" -#import "RLMSwiftSupport.h" -#import "RLMUtil.hpp" - -#import "object_store.hpp" -#import "schema.hpp" - -#import - -#import -#include - -using namespace realm; - -const uint64_t RLMNotVersioned = realm::ObjectStore::NotVersioned; - -// RLMSchema private properties -@interface RLMSchema () -@property (nonatomic, readwrite) NSMutableDictionary *objectSchemaByName; -@end - -static RLMSchema *s_sharedSchema = [[RLMSchema alloc] init]; -static NSMutableDictionary *s_localNameToClass = [[NSMutableDictionary alloc] init]; -static NSMutableDictionary *s_privateObjectSubclasses = [[NSMutableDictionary alloc] init]; - -static enum class SharedSchemaState { - Uninitialized, - Initializing, - Initialized -} s_sharedSchemaState = SharedSchemaState::Uninitialized; - -@implementation RLMSchema { - NSArray *_objectSchema; - realm::Schema _objectStoreSchema; -} - -// Caller must @synchronize on s_localNameToClass -static RLMObjectSchema *RLMRegisterClass(Class cls) { - if (RLMObjectSchema *schema = s_privateObjectSubclasses[[cls className]]) { - return schema; - } - - auto prevState = s_sharedSchemaState; - s_sharedSchemaState = SharedSchemaState::Initializing; - RLMObjectSchema *schema = [RLMObjectSchema schemaForObjectClass:cls]; - s_sharedSchemaState = prevState; - - // set unmanaged class on shared shema for unmanaged object creation - schema.unmanagedClass = RLMUnmanagedAccessorClassForObjectClass(schema.objectClass, schema); - - // override sharedSchema class methods for performance - RLMReplaceSharedSchemaMethod(cls, schema); - - s_privateObjectSubclasses[schema.className] = schema; - if ([cls shouldIncludeInDefaultSchema] && prevState != SharedSchemaState::Initialized) { - s_sharedSchema.objectSchemaByName[schema.className] = schema; - } - - return schema; -} - -// Caller must @synchronize on s_localNameToClass -static void RLMRegisterClassLocalNames(Class *classes, NSUInteger count) { - for (NSUInteger i = 0; i < count; i++) { - Class cls = classes[i]; - - if (!RLMIsObjectSubclass(cls) || RLMIsGeneratedClass(cls)) { - continue; - } - - NSString *className = NSStringFromClass(cls); - if ([RLMSwiftSupport isSwiftClassName:className]) { - className = [RLMSwiftSupport demangleClassName:className]; - } - // NSStringFromClass demangles the names for top-level Swift classes - // but not for nested classes. _T indicates it's a Swift symbol, t - // indicates it's a type, and C indicates it's a class. - else if ([className hasPrefix:@"_TtC"]) { - @throw RLMException(@"RLMObject subclasses cannot be nested within other declarations. Please move %@ to global scope.", className); - } - - if (Class existingClass = s_localNameToClass[className]) { - if (existingClass != cls) { - @throw RLMException(@"RLMObject subclasses with the same name cannot be included twice in the same target. " - @"Please make sure '%@' is only linked once to your current target.", className); - } - continue; - } - - s_localNameToClass[className] = cls; - RLMReplaceClassNameMethod(cls, className); - } -} - -- (instancetype)init { - self = [super init]; - if (self) { - _objectSchemaByName = [[NSMutableDictionary alloc] init]; - } - return self; -} - -- (NSArray *)objectSchema { - if (!_objectSchema) { - _objectSchema = [_objectSchemaByName allValues]; - } - return _objectSchema; -} - -- (void)setObjectSchema:(NSArray *)objectSchema { - _objectSchema = objectSchema; - _objectSchemaByName = [NSMutableDictionary dictionaryWithCapacity:objectSchema.count]; - for (RLMObjectSchema *object in objectSchema) { - [_objectSchemaByName setObject:object forKey:object.className]; - } -} - -- (RLMObjectSchema *)schemaForClassName:(NSString *)className { - if (RLMObjectSchema *schema = _objectSchemaByName[className]) { - return schema; // fast path for already-initialized schemas - } else if (Class cls = [RLMSchema classForString:className]) { - [cls sharedSchema]; // initialize the schema - return _objectSchemaByName[className]; // try again - } else { - return nil; - } -} - -- (RLMObjectSchema *)objectForKeyedSubscript:(__unsafe_unretained NSString *const)className { - RLMObjectSchema *schema = [self schemaForClassName:className]; - if (!schema) { - @throw RLMException(@"Object type '%@' not managed by the Realm", className); - } - return schema; -} - -+ (instancetype)schemaWithObjectClasses:(NSArray *)classes { - NSUInteger count = classes.count; - auto classArray = std::make_unique<__unsafe_unretained Class[]>(count); - [classes getObjects:classArray.get() range:NSMakeRange(0, count)]; - - RLMSchema *schema = [[self alloc] init]; - @synchronized(s_localNameToClass) { - RLMRegisterClassLocalNames(classArray.get(), count); - - schema->_objectSchemaByName = [NSMutableDictionary dictionaryWithCapacity:count]; - for (Class cls in classes) { - if (!RLMIsObjectSubclass(cls)) { - @throw RLMException(@"Can't add non-Object type '%@' to a schema.", cls); - } - schema->_objectSchemaByName[[cls className]] = RLMRegisterClass(cls); - } - } - - NSMutableArray *errors = [NSMutableArray new]; - // Verify that all of the targets of links are included in the class list - [schema->_objectSchemaByName enumerateKeysAndObjectsUsingBlock:^(id, RLMObjectSchema *objectSchema, BOOL *) { - for (RLMProperty *prop in objectSchema.properties) { - if (prop.type != RLMPropertyTypeObject && prop.type != RLMPropertyTypeArray) { - continue; - } - if (!schema->_objectSchemaByName[prop.objectClassName]) { - [errors addObject:[NSString stringWithFormat:@"- '%@.%@' links to class '%@', which is missing from the list of classes managed by the Realm", objectSchema.className, prop.name, prop.objectClassName]]; - } - } - }]; - if (errors.count) { - @throw RLMException(@"Invalid class subset list:\n%@", [errors componentsJoinedByString:@"\n"]); - } - - return schema; -} - -+ (RLMObjectSchema *)sharedSchemaForClass:(Class)cls { - @synchronized(s_localNameToClass) { - // We create instances of Swift objects during schema init, and they - // obviously need to not also try to initialize the schema - if (s_sharedSchemaState == SharedSchemaState::Initializing) { - return nil; - } - - RLMRegisterClassLocalNames(&cls, 1); - return RLMRegisterClass(cls); - } -} - -+ (instancetype)partialSharedSchema { - return s_sharedSchema; -} - -// schema based on runtime objects -+ (instancetype)sharedSchema { - @synchronized(s_localNameToClass) { - // We replace this method with one which just returns s_sharedSchema - // once initialization is complete, but we still need to check if it's - // already complete because it may have been done by another thread - // while we were waiting for the lock - if (s_sharedSchemaState == SharedSchemaState::Initialized) { - return s_sharedSchema; - } - - if (s_sharedSchemaState == SharedSchemaState::Initializing) { - @throw RLMException(@"Illegal recursive call of +[%@ %@]. Note: Properties of Swift `Object` classes must not be prepopulated with queried results from a Realm.", self, NSStringFromSelector(_cmd)); - } - - s_sharedSchemaState = SharedSchemaState::Initializing; - try { - // Make sure we've discovered all classes - { - unsigned int numClasses; - using malloc_ptr = std::unique_ptr<__unsafe_unretained Class[], decltype(&free)>; - malloc_ptr classes(objc_copyClassList(&numClasses), &free); - RLMRegisterClassLocalNames(classes.get(), numClasses); - } - - [s_localNameToClass enumerateKeysAndObjectsUsingBlock:^(NSString *, Class cls, BOOL *) { - RLMRegisterClass(cls); - }]; - } - catch (...) { - s_sharedSchemaState = SharedSchemaState::Uninitialized; - throw; - } - - // Replace this method with one that doesn't need to acquire a lock - Class metaClass = objc_getMetaClass(class_getName(self)); - IMP imp = imp_implementationWithBlock(^{ return s_sharedSchema; }); - class_replaceMethod(metaClass, @selector(sharedSchema), imp, "@@:"); - - s_sharedSchemaState = SharedSchemaState::Initialized; - } - - return s_sharedSchema; -} - -// schema based on tables in a realm -+ (instancetype)dynamicSchemaFromObjectStoreSchema:(Schema const&)objectStoreSchema { - // cache descriptors for all subclasses of RLMObject - NSMutableArray *schemaArray = [NSMutableArray arrayWithCapacity:objectStoreSchema.size()]; - for (auto &objectSchema : objectStoreSchema) { - RLMObjectSchema *schema = [RLMObjectSchema objectSchemaForObjectStoreSchema:objectSchema]; - [schemaArray addObject:schema]; - } - - // set class array and mapping - RLMSchema *schema = [RLMSchema new]; - schema.objectSchema = schemaArray; - return schema; -} - -+ (Class)classForString:(NSString *)className { - if (Class cls = s_localNameToClass[className]) { - return cls; - } - - if (Class cls = NSClassFromString(className)) { - return RLMIsObjectSubclass(cls) ? cls : nil; - } - - // className might be the local name of a Swift class we haven't registered - // yet, so scan them all then recheck - { - unsigned int numClasses; - std::unique_ptr<__unsafe_unretained Class[], decltype(&free)> classes(objc_copyClassList(&numClasses), &free); - RLMRegisterClassLocalNames(classes.get(), numClasses); - } - - return s_localNameToClass[className]; -} - -- (id)copyWithZone:(NSZone *)zone { - RLMSchema *schema = [[RLMSchema allocWithZone:zone] init]; - schema->_objectSchemaByName = [[NSMutableDictionary allocWithZone:zone] - initWithDictionary:_objectSchemaByName copyItems:YES]; - return schema; -} - -- (BOOL)isEqualToSchema:(RLMSchema *)schema { - if (_objectSchemaByName.count != schema->_objectSchemaByName.count) { - return NO; - } - __block BOOL matches = YES; - [_objectSchemaByName enumerateKeysAndObjectsUsingBlock:^(NSString *name, RLMObjectSchema *objectSchema, BOOL *stop) { - if (![schema->_objectSchemaByName[name] isEqualToObjectSchema:objectSchema]) { - *stop = YES; - matches = NO; - } - }]; - return matches; -} - -- (NSString *)description { - NSMutableString *objectSchemaString = [NSMutableString string]; - NSArray *sort = @[[NSSortDescriptor sortDescriptorWithKey:@"className" ascending:YES]]; - for (RLMObjectSchema *objectSchema in [self.objectSchema sortedArrayUsingDescriptors:sort]) { - [objectSchemaString appendFormat:@"\t%@\n", - [objectSchema.description stringByReplacingOccurrencesOfString:@"\n" withString:@"\n\t"]]; - } - return [NSString stringWithFormat:@"Schema {\n%@}", objectSchemaString]; -} - -- (Schema)objectStoreCopy { - if (_objectStoreSchema.size() == 0) { - std::vector schema; - schema.reserve(_objectSchemaByName.count); - [_objectSchemaByName enumerateKeysAndObjectsUsingBlock:[&](NSString *, RLMObjectSchema *objectSchema, BOOL *) { - schema.push_back(objectSchema.objectStoreCopy); - }]; - _objectStoreSchema = std::move(schema); - } - return _objectStoreSchema; -} - -@end diff --git a/Pods/Realm/Realm/RLMSwiftSupport.m b/Pods/Realm/Realm/RLMSwiftSupport.m deleted file mode 100644 index e16c79ea..00000000 --- a/Pods/Realm/Realm/RLMSwiftSupport.m +++ /dev/null @@ -1,31 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSwiftSupport.h" - -@implementation RLMSwiftSupport - -+ (BOOL)isSwiftClassName:(NSString *)className { - return [className rangeOfString:@"."].location != NSNotFound; -} - -+ (NSString *)demangleClassName:(NSString *)className { - return [className substringFromIndex:[className rangeOfString:@"."].location + 1]; -} - -@end diff --git a/Pods/Realm/Realm/RLMSyncConfiguration.mm b/Pods/Realm/Realm/RLMSyncConfiguration.mm deleted file mode 100644 index 8625f5e1..00000000 --- a/Pods/Realm/Realm/RLMSyncConfiguration.mm +++ /dev/null @@ -1,170 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncConfiguration_Private.hpp" - -#import "RLMSyncManager_Private.h" -#import "RLMSyncSession_Private.hpp" -#import "RLMSyncUser_Private.hpp" -#import "RLMSyncUtil_Private.hpp" -#import "RLMUtil.hpp" - -#import "sync/sync_manager.hpp" -#import "sync/sync_config.hpp" - -#import - -using namespace realm; - -namespace { -using ProtocolError = realm::sync::ProtocolError; - -RLMSyncSystemErrorKind errorKindForSyncError(SyncError error) { - if (error.is_client_reset_requested()) { - return RLMSyncSystemErrorKindClientReset; - } else if (error.error_code == ProtocolError::bad_authentication) { - return RLMSyncSystemErrorKindUser; - } else if (error.is_session_level_protocol_error()) { - return RLMSyncSystemErrorKindSession; - } else if (error.is_connection_level_protocol_error()) { - return RLMSyncSystemErrorKindConnection; - } else if (error.is_client_error()) { - return RLMSyncSystemErrorKindClient; - } else { - return RLMSyncSystemErrorKindUnknown; - } -} -} - -static BOOL isValidRealmURL(NSURL *url) { - NSString *scheme = [url scheme]; - if (![scheme isEqualToString:@"realm"] && ![scheme isEqualToString:@"realms"]) { - return NO; - } - return YES; -} - -@interface RLMSyncConfiguration () { - std::unique_ptr _config; -} - -- (instancetype)initWithUser:(RLMSyncUser *)user - realmURL:(NSURL *)url - customFileURL:(nullable NSURL *)customFileURL - stopPolicy:(RLMSyncStopPolicy)stopPolicy - errorHandler:(std::function)errorHandler; -@end - -@implementation RLMSyncConfiguration - -@dynamic stopPolicy; - -- (instancetype)initWithRawConfig:(realm::SyncConfig)config { - if (self = [super init]) { - _config = std::make_unique(config); - } - return self; -} - -- (BOOL)isEqual:(id)object { - if (![object isKindOfClass:[RLMSyncConfiguration class]]) { - return NO; - } - RLMSyncConfiguration *that = (RLMSyncConfiguration *)object; - return [self.realmURL isEqual:that.realmURL] - && [self.user isEqual:that.user] - && self.stopPolicy == that.stopPolicy; -} - -- (realm::SyncConfig)rawConfiguration { - return *_config; -} - -- (RLMSyncUser *)user { - return [[RLMSyncUser alloc] initWithSyncUser:_config->user]; -} - -- (RLMSyncStopPolicy)stopPolicy { - return translateStopPolicy(_config->stop_policy); -} - -- (void)setStopPolicy:(RLMSyncStopPolicy)stopPolicy { - _config->stop_policy = translateStopPolicy(stopPolicy); -} - -- (NSURL *)realmURL { - NSString *rawStringURL = @(_config->realm_url.c_str()); - return [NSURL URLWithString:rawStringURL]; -} - -- (instancetype)initWithUser:(RLMSyncUser *)user realmURL:(NSURL *)url { - return [self initWithUser:user - realmURL:url - customFileURL:nil - stopPolicy:RLMSyncStopPolicyAfterChangesUploaded - errorHandler:nullptr]; -} - -- (instancetype)initWithUser:(RLMSyncUser *)user - realmURL:(NSURL *)url - customFileURL:(nullable NSURL *)customFileURL - stopPolicy:(RLMSyncStopPolicy)stopPolicy - errorHandler:(std::function)errorHandler { - if (self = [super init]) { - if (!isValidRealmURL(url)) { - @throw RLMException(@"The provided URL (%@) was not a valid Realm URL.", [url absoluteString]); - } - auto bindHandler = [=](auto&, - const SyncConfig& config, - const std::shared_ptr& session) { - [user _bindSessionWithConfig:config - session:session - completion:[RLMSyncManager sharedManager].sessionCompletionNotifier]; - }; - if (!errorHandler) { - errorHandler = [=](std::shared_ptr errored_session, - SyncError error) { - RLMSyncSession *session = [[RLMSyncSession alloc] initWithSyncSession:errored_session]; - NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithCapacity:error.user_info.size()]; - for (auto& pair : error.user_info) { - userInfo[@(pair.first.c_str())] = @(pair.second.c_str()); - } - // FIXME: how should the binding respond if the `is_fatal` bool is true? - [[RLMSyncManager sharedManager] _fireErrorWithCode:error.error_code.value() - message:@(error.message.c_str()) - isFatal:error.is_fatal - session:session - userInfo:userInfo - errorClass:errorKindForSyncError(error)]; - }; - } - - _config = std::make_unique(SyncConfig{ - [user _syncUser], - [[url absoluteString] UTF8String], - translateStopPolicy(stopPolicy), - std::move(bindHandler), - std::move(errorHandler) - }); - self.customFileURL = customFileURL; - return self; - } - return nil; -} - -@end diff --git a/Pods/Realm/Realm/RLMSyncCredentials.m b/Pods/Realm/Realm/RLMSyncCredentials.m deleted file mode 100644 index 03669e60..00000000 --- a/Pods/Realm/Realm/RLMSyncCredentials.m +++ /dev/null @@ -1,96 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncCredentials.h" -#import "RLMSyncUtil_Private.h" - -/// A Twitter account as an identity provider. -//extern RLMIdentityProvider const RLMIdentityProviderTwitter; - -RLMIdentityProvider const RLMIdentityProviderDebug = @"debug"; -RLMIdentityProvider const RLMIdentityProviderRealm = @"realm"; -RLMIdentityProvider const RLMIdentityProviderUsernamePassword = @"password"; -RLMIdentityProvider const RLMIdentityProviderFacebook = @"facebook"; -RLMIdentityProvider const RLMIdentityProviderTwitter = @"twitter"; -RLMIdentityProvider const RLMIdentityProviderGoogle = @"google"; -RLMIdentityProvider const RLMIdentityProviderCloudKit = @"cloudkit"; - -@interface RLMSyncCredentials () - -- (instancetype)initWithCustomToken:(RLMSyncCredentialsToken)token - provider:(RLMIdentityProvider)provider - userInfo:(NSDictionary *)userInfo NS_DESIGNATED_INITIALIZER; - -@property (nonatomic, readwrite) RLMSyncCredentialsToken token; -@property (nonatomic, readwrite) RLMIdentityProvider provider; -@property (nonatomic, readwrite) NSDictionary *userInfo; - -@end - -@implementation RLMSyncCredentials - -+ (instancetype)credentialsWithFacebookToken:(RLMSyncCredentialsToken)token { - return [[self alloc] initWithCustomToken:token provider:RLMIdentityProviderFacebook userInfo:nil]; -} - -+ (instancetype)credentialsWithGoogleToken:(RLMSyncCredentialsToken)token { - return [[self alloc] initWithCustomToken:token provider:RLMIdentityProviderGoogle userInfo:nil]; -} - -+ (instancetype)credentialsWithCloudKitToken:(RLMSyncCredentialsToken)token { - return [[self alloc] initWithCustomToken:token provider:RLMIdentityProviderCloudKit userInfo:nil]; -} - -+ (instancetype)credentialsWithUsername:(NSString *)username - password:(NSString *)password - register:(BOOL)shouldRegister { - return [[self alloc] initWithCustomToken:username - provider:RLMIdentityProviderUsernamePassword - userInfo:@{kRLMSyncPasswordKey: password, - kRLMSyncRegisterKey: @(shouldRegister)}]; -} - -+ (instancetype)credentialsWithAccessToken:(RLMServerToken)accessToken identity:(NSString *)identity { - return [[self alloc] initWithCustomToken:accessToken - provider:RLMIdentityProviderAccessToken - userInfo:@{kRLMSyncIdentityKey: identity}]; -} - -- (BOOL)isEqual:(id)object { - if (![object isKindOfClass:[RLMSyncCredentials class]]) { - return NO; - } - RLMSyncCredentials *that = (RLMSyncCredentials *)object; - return ([self.token isEqualToString:that.token] - && [self.provider isEqualToString:that.provider] - && [self.userInfo isEqual:that.userInfo]); -} - -- (instancetype)initWithCustomToken:(RLMSyncCredentialsToken)token - provider:(RLMIdentityProvider)provider - userInfo:(NSDictionary *)userInfo { - if (self = [super init]) { - self.token = token; - self.provider = provider; - self.userInfo = userInfo; - return self; - } - return nil; -} - -@end diff --git a/Pods/Realm/Realm/RLMSyncErrorResponseModel.m b/Pods/Realm/Realm/RLMSyncErrorResponseModel.m deleted file mode 100644 index 5e751399..00000000 --- a/Pods/Realm/Realm/RLMSyncErrorResponseModel.m +++ /dev/null @@ -1,48 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncErrorResponseModel.h" - -static const NSString *const kRLMSyncErrorStatusKey = @"status"; -static const NSString *const kRLMSyncErrorCodeKey = @"code"; -static const NSString *const kRLMSyncErrorTitleKey = @"title"; -static const NSString *const kRLMSyncErrorHintKey = @"hint"; - -@interface RLMSyncErrorResponseModel () - -@property (nonatomic, readwrite) NSInteger status; -@property (nonatomic, readwrite) NSInteger code; -@property (nonatomic, readwrite) NSString *title; -@property (nonatomic, readwrite) NSString *hint; - -@end - -@implementation RLMSyncErrorResponseModel - -- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary { - if (self = [super init]) { - RLM_SYNC_PARSE_DOUBLE_OR_ABORT(jsonDictionary, kRLMSyncErrorStatusKey, status); - RLM_SYNC_PARSE_DOUBLE_OR_ABORT(jsonDictionary, kRLMSyncErrorCodeKey, code); - RLM_SYNC_PARSE_OPTIONAL_STRING(jsonDictionary, kRLMSyncErrorTitleKey, title); - RLM_SYNC_PARSE_OPTIONAL_STRING(jsonDictionary, kRLMSyncErrorHintKey, hint); - return self; - } - return nil; -} - -@end diff --git a/Pods/Realm/Realm/RLMSyncManager.mm b/Pods/Realm/Realm/RLMSyncManager.mm deleted file mode 100644 index 7e2cfd5e..00000000 --- a/Pods/Realm/Realm/RLMSyncManager.mm +++ /dev/null @@ -1,215 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncManager_Private.h" - -#import "RLMRealmConfiguration+Sync.h" -#import "RLMSyncConfiguration_Private.hpp" -#import "RLMSyncSession_Private.hpp" -#import "RLMSyncUser_Private.hpp" -#import "RLMUtil.hpp" - -#import "sync/sync_config.hpp" -#import "sync/sync_manager.hpp" -#import "sync/sync_session.hpp" - -using namespace realm; -using Level = realm::util::Logger::Level; - -namespace { - -Level levelForSyncLogLevel(RLMSyncLogLevel logLevel) { - switch (logLevel) { - case RLMSyncLogLevelOff: return Level::off; - case RLMSyncLogLevelFatal: return Level::fatal; - case RLMSyncLogLevelError: return Level::error; - case RLMSyncLogLevelWarn: return Level::warn; - case RLMSyncLogLevelInfo: return Level::info; - case RLMSyncLogLevelDetail: return Level::detail; - case RLMSyncLogLevelDebug: return Level::debug; - case RLMSyncLogLevelTrace: return Level::trace; - case RLMSyncLogLevelAll: return Level::all; - } - REALM_UNREACHABLE(); // Unrecognized log level. -} - -RLMSyncLogLevel logLevelForLevel(Level logLevel) { - switch (logLevel) { - case Level::off: return RLMSyncLogLevelOff; - case Level::fatal: return RLMSyncLogLevelFatal; - case Level::error: return RLMSyncLogLevelError; - case Level::warn: return RLMSyncLogLevelWarn; - case Level::info: return RLMSyncLogLevelInfo; - case Level::detail: return RLMSyncLogLevelDetail; - case Level::debug: return RLMSyncLogLevelDebug; - case Level::trace: return RLMSyncLogLevelTrace; - case Level::all: return RLMSyncLogLevelAll; - } - REALM_UNREACHABLE(); // Unrecognized log level. -} - -struct CocoaSyncLogger : public realm::util::RootLogger { - void do_log(Level, std::string message) override { - NSLog(@"Sync: %@", RLMStringDataToNSString(message)); - } -}; - -struct CocoaSyncLoggerFactory : public realm::SyncLoggerFactory { - std::unique_ptr make_logger(realm::util::Logger::Level level) override { - auto logger = std::make_unique(); - logger->set_level_threshold(level); - return std::move(logger); - } -} s_syncLoggerFactory; - -} // anonymous namespace - -@interface RLMSyncManager () -- (instancetype)initWithCustomRootDirectory:(nullable NSURL *)rootDirectory NS_DESIGNATED_INITIALIZER; -@end - -@implementation RLMSyncManager - -static RLMSyncManager *s_sharedManager = nil; -static dispatch_once_t s_onceToken; - -+ (instancetype)sharedManager { - dispatch_once(&s_onceToken, ^{ - s_sharedManager = [[RLMSyncManager alloc] initWithCustomRootDirectory:nil]; - }); - return s_sharedManager; -} - -- (instancetype)initWithCustomRootDirectory:(NSURL *)rootDirectory { - if (self = [super init]) { - // Initialize the sync engine. - SyncManager::shared().set_logger_factory(s_syncLoggerFactory); - bool should_encrypt = !getenv("REALM_DISABLE_METADATA_ENCRYPTION") && !RLMIsRunningInPlayground(); - auto mode = should_encrypt ? SyncManager::MetadataMode::Encryption : SyncManager::MetadataMode::NoEncryption; - rootDirectory = rootDirectory ?: [NSURL fileURLWithPath:RLMDefaultDirectoryForBundleIdentifier(nil)]; - SyncManager::shared().configure_file_system(rootDirectory.path.UTF8String, mode, none, true); - return self; - } - return nil; -} - -- (NSString *)appID { - if (!_appID) { - _appID = [[NSBundle mainBundle] bundleIdentifier] ?: @"(none)"; - } - return _appID; -} - -#pragma mark - Passthrough properties - -- (RLMSyncLogLevel)logLevel { - return logLevelForLevel(realm::SyncManager::shared().log_level()); -} - -- (void)setLogLevel:(RLMSyncLogLevel)logLevel { - realm::SyncManager::shared().set_log_level(levelForSyncLogLevel(logLevel)); -} - -- (BOOL)disableSSLValidation { - return realm::SyncManager::shared().client_should_validate_ssl(); -} - -- (void)setDisableSSLValidation:(BOOL)disableSSLValidation { - realm::SyncManager::shared().set_client_should_validate_ssl(!disableSSLValidation); -} - -#pragma mark - Private API - -- (void)_fireError:(NSError *)error { - dispatch_async(dispatch_get_main_queue(), ^{ - if (self.errorHandler) { - self.errorHandler(error, nil); - } - }); -} - -- (void)_fireErrorWithCode:(int)errorCode - message:(NSString *)message - isFatal:(BOOL)fatal - session:(RLMSyncSession *)session - userInfo:(NSDictionary *)userInfo - errorClass:(RLMSyncSystemErrorKind)errorClass { - NSError *error = nil; - NSMutableDictionary *mutableUserInfo = [userInfo mutableCopy]; - mutableUserInfo[@"description"] = message; - mutableUserInfo[@"error"] = @(errorCode); - mutableUserInfo[@"underlying_class"] = @(errorClass); - - switch (errorClass) { - case RLMSyncSystemErrorKindClientReset: { - // Client reset is a special case; the application can respond to it to a greater degree than - // it can for most other errors. - mutableUserInfo = [@{} mutableCopy]; - mutableUserInfo[kRLMSyncPathOfRealmBackupCopyKey] = userInfo[@(realm::SyncError::c_recovery_file_path_key)]; - std::string original_path = [userInfo[@(realm::SyncError::c_original_file_path_key)] UTF8String]; - mutableUserInfo[kRLMSyncInitiateClientResetBlockKey] = ^{ - SyncManager::shared().immediately_run_file_actions(original_path); - }; - error = [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorClientResetError - userInfo:mutableUserInfo]; - break; - } - case RLMSyncSystemErrorKindUser: - error = [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorClientUserError - userInfo:mutableUserInfo]; - break; - case RLMSyncSystemErrorKindSession: - error = [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorClientSessionError - userInfo:mutableUserInfo]; - break; - case RLMSyncSystemErrorKindConnection: - case RLMSyncSystemErrorKindClient: - // Report the error. There's nothing the user can do about it, though. - if (fatal) { - error = [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorClientInternalError - userInfo:mutableUserInfo]; - } - break; - case RLMSyncSystemErrorKindUnknown: - break; - } - dispatch_async(dispatch_get_main_queue(), ^{ - if (!self.errorHandler || !error) { - return; - } - self.errorHandler(error, session); - }); -} - -- (NSArray *)_allUsers { - NSMutableArray *buffer = [NSMutableArray array]; - for (auto user : SyncManager::shared().all_logged_in_users()) { - [buffer addObject:[[RLMSyncUser alloc] initWithSyncUser:std::move(user)]]; - } - return buffer; -} - -+ (void)resetForTesting { - SyncManager::shared().reset_for_testing(); -} - -@end diff --git a/Pods/Realm/Realm/RLMSyncPermissionChange.m b/Pods/Realm/Realm/RLMSyncPermissionChange.m deleted file mode 100644 index 55ba2fe2..00000000 --- a/Pods/Realm/Realm/RLMSyncPermissionChange.m +++ /dev/null @@ -1,69 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncPermissionChange_Private.h" -#import "RLMSyncUtil_Private.h" - -@implementation RLMSyncPermissionChange - -+ (instancetype)permissionChangeWithRealmURL:(NSString *)realmURL - userID:(NSString *)userID - read:(nullable NSNumber *)mayRead - write:(nullable NSNumber *)mayWrite - manage:(nullable NSNumber *)mayManage { - RLMSyncPermissionChange *permissionChange = [RLMSyncPermissionChange new]; - permissionChange.realmUrl = realmURL; - permissionChange.userId = userID; - permissionChange.mayRead = mayRead; - permissionChange.mayWrite = mayWrite; - permissionChange.mayManage = mayManage; - return permissionChange; -} - -+ (NSArray *)requiredProperties { - return @[@"id", @"createdAt", @"updatedAt", @"realmUrl", @"userId"]; -} - -+ (NSDictionary *)defaultPropertyValues { - NSDate *now = [NSDate date]; - return @{ - @"id": [NSUUID UUID].UUIDString, - @"createdAt": now, - @"updatedAt": now, - @"realmUrl": @"*", - @"userId": @"*" - }; -} - -+ (nullable NSString *)primaryKey { - return @"id"; -} - -+ (BOOL)shouldIncludeInDefaultSchema { - return NO; -} - -- (RLMSyncManagementObjectStatus)status { - return RLMMakeSyncManagementObjectStatus(self.statusCode); -} - -+ (NSString *)_realmObjectName { - return @"PermissionChange"; -} - -@end diff --git a/Pods/Realm/Realm/RLMSyncPermissionOffer.m b/Pods/Realm/Realm/RLMSyncPermissionOffer.m deleted file mode 100644 index 6f38a787..00000000 --- a/Pods/Realm/Realm/RLMSyncPermissionOffer.m +++ /dev/null @@ -1,72 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncPermissionOffer_Private.h" -#import "RLMSyncUtil_Private.h" - -@implementation RLMSyncPermissionOffer - -+ (instancetype)permissionOfferWithRealmURL:(NSString *)realmURL - expiresAt:(nullable NSDate *)expiresAt - read:(BOOL)mayRead - write:(BOOL)mayWrite - manage:(BOOL)mayManage { - RLMSyncPermissionOffer *permissionOffer = [RLMSyncPermissionOffer new]; - permissionOffer.realmUrl = realmURL; - permissionOffer.expiresAt = expiresAt; - permissionOffer.mayRead = mayRead; - permissionOffer.mayWrite = mayWrite; - permissionOffer.mayManage = mayManage; - return permissionOffer; -} - -+ (NSArray *)requiredProperties { - return @[@"id", @"createdAt", @"updatedAt", @"realmUrl"]; -} - -+ (NSArray *)indexedProperties { - return @[@"token"]; -} - -+ (NSDictionary *)defaultPropertyValues { - NSDate *now = [NSDate date]; - return @{ - @"id": [NSUUID UUID].UUIDString, - @"createdAt": now, - @"updatedAt": now, - @"realmUrl": @"" - }; -} - -+ (nullable NSString *)primaryKey { - return @"id"; -} - -+ (BOOL)shouldIncludeInDefaultSchema { - return NO; -} - -- (RLMSyncManagementObjectStatus)status { - return RLMMakeSyncManagementObjectStatus(self.statusCode); -} - -+ (NSString *)_realmObjectName { - return @"PermissionOffer"; -} - -@end diff --git a/Pods/Realm/Realm/RLMSyncPermissionOfferResponse.m b/Pods/Realm/Realm/RLMSyncPermissionOfferResponse.m deleted file mode 100644 index ab7b685b..00000000 --- a/Pods/Realm/Realm/RLMSyncPermissionOfferResponse.m +++ /dev/null @@ -1,60 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncPermissionOfferResponse_Private.h" -#import "RLMSyncUtil_Private.h" - -@implementation RLMSyncPermissionOfferResponse - -+ (instancetype)permissionOfferResponseWithToken:(NSString *)token { - RLMSyncPermissionOfferResponse *permissionOfferResponse = [RLMSyncPermissionOfferResponse new]; - permissionOfferResponse.token = token; - return permissionOfferResponse; -} - -+ (NSArray *)requiredProperties { - return @[@"id", @"createdAt", @"updatedAt", @"token"]; -} - -+ (NSDictionary *)defaultPropertyValues { - NSDate *now = [NSDate date]; - return @{ - @"id": [NSUUID UUID].UUIDString, - @"createdAt": now, - @"updatedAt": now, - @"token": @"", - }; -} - -+ (nullable NSString *)primaryKey { - return @"id"; -} - -+ (BOOL)shouldIncludeInDefaultSchema { - return NO; -} - -- (RLMSyncManagementObjectStatus)status { - return RLMMakeSyncManagementObjectStatus(self.statusCode); -} - -+ (NSString *)_realmObjectName { - return @"PermissionOfferResponse"; -} - -@end diff --git a/Pods/Realm/Realm/RLMSyncSession.mm b/Pods/Realm/Realm/RLMSyncSession.mm deleted file mode 100644 index 0dc1f5dd..00000000 --- a/Pods/Realm/Realm/RLMSyncSession.mm +++ /dev/null @@ -1,173 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncSession_Private.hpp" - -#import "RLMSyncConfiguration_Private.hpp" -#import "RLMSyncUser_Private.hpp" -#import "sync/sync_session.hpp" - -using namespace realm; - -@interface RLMProgressNotificationToken() { - uint64_t _token; - std::weak_ptr _session; -} -@end - -@implementation RLMProgressNotificationToken - -- (void)suppressNextNotification { - // No-op, but implemented in case this token is passed to - // `-[RLMRealm commitWriteTransactionWithoutNotifying:]`. -} - -- (void)stop { - if (auto session = _session.lock()) { - session->unregister_progress_notifier(_token); - _session.reset(); - _token = 0; - } -} - -- (void)dealloc { - if (_token != 0) { - NSLog(@"RLMProgressNotificationToken released without unregistering a notification. " - @"You must hold on to the RLMProgressNotificationToken and call " - @"-[RLMProgressNotificationToken stop] when you no longer wish to receive " - @"progress update notifications."); - } -} - -- (nullable instancetype)initWithTokenValue:(uint64_t)token - session:(std::shared_ptr)session { - if (token == 0) { - return nil; - } - if (self = [super init]) { - _token = token; - _session = session; - return self; - } - return nil; -} - -@end - -@implementation RLMSyncSession - -- (instancetype)initWithSyncSession:(std::shared_ptr)session { - if (self = [super init]) { - _session = session; - return self; - } - return nil; -} - -- (RLMSyncConfiguration *)configuration { - if (auto session = _session.lock()) { - if (session->state() != SyncSession::PublicState::Error) { - return [[RLMSyncConfiguration alloc] initWithRawConfig:session->config()]; - } - } - return nil; -} - -- (NSURL *)realmURL { - if (auto session = _session.lock()) { - if (auto url = session->full_realm_url()) { - return [NSURL URLWithString:@(url->c_str())]; - } - } - return nil; -} - -- (RLMSyncUser *)parentUser { - if (auto session = _session.lock()) { - if (session->state() != SyncSession::PublicState::Error) { - return [[RLMSyncUser alloc] initWithSyncUser:session->user()]; - } - } - return nil; -} - -- (RLMSyncSessionState)state { - if (auto session = _session.lock()) { - if (session->state() == SyncSession::PublicState::Inactive) { - return RLMSyncSessionStateInactive; - } - if (session->state() != SyncSession::PublicState::Error) { - return RLMSyncSessionStateActive; - } - } - return RLMSyncSessionStateInvalid; -} - -- (BOOL)waitForUploadCompletionOnQueue:(dispatch_queue_t)queue callback:(void(^)(void))callback { - if (auto session = _session.lock()) { - if (session->state() == SyncSession::PublicState::Error) { - return NO; - } - queue = queue ?: dispatch_get_main_queue(); - session->wait_for_upload_completion([=](std::error_code) { // FIXME: report error to user - dispatch_async(queue, callback); - }); - return YES; - } - return NO; -} - -- (BOOL)waitForDownloadCompletionOnQueue:(dispatch_queue_t)queue callback:(void(^)(void))callback { - if (auto session = _session.lock()) { - if (session->state() == SyncSession::PublicState::Error) { - return NO; - } - queue = queue ?: dispatch_get_main_queue(); - session->wait_for_download_completion([=](std::error_code) { // FIXME: report error to user - dispatch_async(queue, callback); - }); - return YES; - } - return NO; -} - -- (RLMProgressNotificationToken *)addProgressNotificationForDirection:(RLMSyncProgressDirection)direction - mode:(RLMSyncProgress)mode - block:(RLMProgressNotificationBlock)block { - if (auto session = _session.lock()) { - if (session->state() == SyncSession::PublicState::Error) { - return nil; - } - // Get the current runloop, or create one if necessary. - CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent(); - auto notifier_direction = (direction == RLMSyncProgressDirectionUpload - ? SyncSession::NotifierType::upload - : SyncSession::NotifierType::download); - bool is_streaming = (mode == RLMSyncProgressReportIndefinitely); - uint64_t token = session->register_progress_notifier([=](uint64_t transferred, uint64_t transferrable) { - CFRunLoopPerformBlock(currentRunLoop, kCFRunLoopCommonModes, ^{ - block((NSUInteger)transferred, (NSUInteger)transferrable); - }); - CFRunLoopWakeUp(currentRunLoop); - }, notifier_direction, is_streaming); - return [[RLMProgressNotificationToken alloc] initWithTokenValue:token session:std::move(session)]; - } - return nil; -} - -@end diff --git a/Pods/Realm/Realm/RLMSyncSessionRefreshHandle.mm b/Pods/Realm/Realm/RLMSyncSessionRefreshHandle.mm deleted file mode 100644 index dcfc39dd..00000000 --- a/Pods/Realm/Realm/RLMSyncSessionRefreshHandle.mm +++ /dev/null @@ -1,252 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncSessionRefreshHandle.hpp" - -#import "RLMAuthResponseModel.h" -#import "RLMNetworkClient.h" -#import "RLMSyncManager_Private.h" -#import "RLMSyncUser_Private.hpp" -#import "RLMTokenModels.h" -#import "RLMUtil.hpp" - -#import "sync/sync_session.hpp" - -using namespace realm; - -@interface RLMSyncSessionRefreshHandle () { - std::weak_ptr _session; - std::shared_ptr _strongSession; -} - -@property (nonatomic, weak) RLMSyncUser *user; -@property (nonatomic, strong) NSString *pathToRealm; -@property (nonatomic) NSTimer *timer; - -@property (nonatomic) NSURL *realmURL; -@property (nonatomic, copy) RLMSyncBasicErrorReportingBlock completionBlock; - -@end - -@implementation RLMSyncSessionRefreshHandle - -- (instancetype)initWithRealmURL:(NSURL *)realmURL - user:(RLMSyncUser *)user - session:(std::shared_ptr)session - completionBlock:(RLMSyncBasicErrorReportingBlock)completionBlock { - if (self = [super init]) { - NSString *path = [realmURL path]; - self.pathToRealm = path; - self.user = user; - self.completionBlock = completionBlock; - self.realmURL = realmURL; - // For the initial bind, we want to prolong the session's lifetime. - _strongSession = std::move(session); - _session = _strongSession; - // Immediately fire off the network request. - [self _timerFired:nil]; - return self; - } - return nil; -} - -- (void)dealloc { - [self.timer invalidate]; -} - -- (void)invalidate { - _strongSession = nullptr; - [self.timer invalidate]; -} - -+ (NSDate *)fireDateForTokenExpirationDate:(NSDate *)date nowDate:(NSDate *)nowDate { - static const NSTimeInterval refreshBuffer = 10; - NSDate *fireDate = [date dateByAddingTimeInterval:-refreshBuffer]; - // Only fire times in the future are valid. - return ([fireDate compare:nowDate] == NSOrderedDescending ? fireDate : nil); -} - -- (void)scheduleRefreshTimer:(NSDate *)dateWhenTokenExpires { - // Schedule the timer on the main queue. - // It's very likely that this method will be run on a side thread, for example - // on the thread that runs `NSURLSession`'s completion blocks. We can't be - // guaranteed that there's an existing runloop on those threads, and we don't want - // to create and start a new one if one doesn't already exist. - dispatch_async(dispatch_get_main_queue(), ^{ - [self.timer invalidate]; - NSDate *fireDate = [RLMSyncSessionRefreshHandle fireDateForTokenExpirationDate:dateWhenTokenExpires - nowDate:[NSDate date]]; - if (!fireDate) { - [self.user _unregisterRefreshHandleForURLPath:self.pathToRealm]; - return; - } - self.timer = [[NSTimer alloc] initWithFireDate:fireDate - interval:0 - target:self - selector:@selector(_timerFired:) - userInfo:nil - repeats:NO]; - [[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSDefaultRunLoopMode]; - }); -} - -/// Handler for network requests whose responses successfully parse into an auth response model. -- (BOOL)_handleSuccessfulRequest:(RLMAuthResponseModel *)model strongUser:(RLMSyncUser *)user { - // Success - std::shared_ptr session = _session.lock(); - if (!session) { - // The session is dead or in a fatal error state. - [user _unregisterRefreshHandleForURLPath:self.pathToRealm]; - [self invalidate]; - return NO; - } - bool success = session->state() != SyncSession::PublicState::Error; - if (success) { - // Calculate the resolved path. - NSString *resolvedURLString = nil; - RLMServerPath resolvedPath = model.accessToken.tokenData.path; - // Munge the path back onto the original URL, because the `sync` API expects an entire URL. - NSURLComponents *urlBuffer = [NSURLComponents componentsWithURL:self.realmURL - resolvingAgainstBaseURL:YES]; - urlBuffer.path = resolvedPath; - resolvedURLString = [[urlBuffer URL] absoluteString]; - if (!resolvedURLString) { - @throw RLMException(@"Resolved path returned from the server was invalid (%@).", resolvedPath); - } - // Pass the token and resolved path to the underlying sync subsystem. - session->refresh_access_token([model.accessToken.token UTF8String], {resolvedURLString.UTF8String}); - success = session->state() != SyncSession::PublicState::Error; - if (success) { - // Schedule a refresh. If we're successful we must already have `bind()`ed the session - // initially, so we can null out the strong pointer. - _strongSession = nullptr; - NSDate *expires = [NSDate dateWithTimeIntervalSince1970:model.accessToken.tokenData.expires]; - [self scheduleRefreshTimer:expires]; - } else { - // The session is dead or in a fatal error state. - [user _unregisterRefreshHandleForURLPath:self.pathToRealm]; - [self invalidate]; - } - } - if (self.completionBlock) { - self.completionBlock(success ? nil : [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorClientSessionError - userInfo:nil]); - } - return success; -} - -/// Handler for network requests that failed before the JSON parsing stage. -- (BOOL)_handleFailedRequest:(NSError *)error strongUser:(RLMSyncUser *)user { - NSError *syncError = [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorBadResponse - userInfo:@{kRLMSyncUnderlyingErrorKey: error}]; - if (self.completionBlock) { - self.completionBlock(syncError); - } - [[RLMSyncManager sharedManager] _fireError:syncError]; - // Certain errors related to network connectivity should trigger a retry. - NSDate *nextTryDate = nil; - if (error.domain == NSURLErrorDomain) { - switch (error.code) { - case NSURLErrorCannotConnectToHost: - case NSURLErrorNotConnectedToInternet: - case NSURLErrorNetworkConnectionLost: - case NSURLErrorTimedOut: - case NSURLErrorDNSLookupFailed: - case NSURLErrorCannotFindHost: - // FIXME: 10 seconds is an arbitrarily chosen value, consider rationalizing it. - nextTryDate = [NSDate dateWithTimeIntervalSinceNow:10]; - break; - default: - break; - } - } - if (!nextTryDate) { - // This error isn't a network failure error. Just invalidate the refresh handle and stop. - [user _unregisterRefreshHandleForURLPath:self.pathToRealm]; - [self invalidate]; - return NO; - } - // If we tried to initially bind the session and failed, we'll try again. However, each - // subsequent attempt will use a weak pointer to avoid prolonging the session's lifetime - // unnecessarily. - _strongSession = nullptr; - [self scheduleRefreshTimer:nextTryDate]; - return NO; -} - -/// Callback handler for network requests. -- (BOOL)_onRefreshCompletionWithError:(NSError *)error json:(NSDictionary *)json { - RLMSyncUser *user = self.user; - if (!user) { - return NO; - } - if (json && !error) { - RLMAuthResponseModel *model = [[RLMAuthResponseModel alloc] initWithDictionary:json - requireAccessToken:YES - requireRefreshToken:NO]; - if (model) { - return [self _handleSuccessfulRequest:model strongUser:user]; - } - // Otherwise, malformed JSON - error = [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorBadResponse - userInfo:@{kRLMSyncErrorJSONKey: json}]; - [user _unregisterRefreshHandleForURLPath:self.pathToRealm]; - [self.timer invalidate]; - if (self.completionBlock) { - self.completionBlock(error); - } - [[RLMSyncManager sharedManager] _fireError:error]; - return NO; - } else { - REALM_ASSERT(error); - return [self _handleFailedRequest:error strongUser:user]; - } -} - -- (void)_timerFired:(__unused NSTimer *)timer { - RLMSyncUser *user = self.user; - if (!user) { - return; - } - RLMServerToken refreshToken = user._refreshToken; - if (!refreshToken) { - [user _unregisterRefreshHandleForURLPath:self.pathToRealm]; - [self.timer invalidate]; - return; - } - - NSDictionary *json = @{ - kRLMSyncProviderKey: @"realm", - kRLMSyncPathKey: self.pathToRealm, - kRLMSyncDataKey: refreshToken, - kRLMSyncAppIDKey: [RLMSyncManager sharedManager].appID, - }; - - RLMSyncCompletionBlock handler = ^(NSError *error, NSDictionary *json) { - [self _onRefreshCompletionWithError:error json:json]; - }; - [RLMNetworkClient postRequestToEndpoint:RLMServerEndpointAuth - server:user.authenticationServer - JSON:json - completion:handler]; -} - -@end diff --git a/Pods/Realm/Realm/RLMSyncUser.mm b/Pods/Realm/Realm/RLMSyncUser.mm deleted file mode 100644 index afde9980..00000000 --- a/Pods/Realm/Realm/RLMSyncUser.mm +++ /dev/null @@ -1,282 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncUser_Private.hpp" - -#import "RLMAuthResponseModel.h" -#import "RLMNetworkClient.h" -#import "RLMSyncManager_Private.h" -#import "RLMSyncSession_Private.hpp" -#import "RLMSyncSessionRefreshHandle.hpp" -#import "RLMTokenModels.h" -#import "RLMUtil.hpp" - -#import "sync/sync_manager.hpp" -#import "sync/sync_session.hpp" -#import "sync/sync_user.hpp" - -using namespace realm; - -@interface RLMSyncUser () { - std::shared_ptr _user; -} - -- (instancetype)initWithAuthServer:(nullable NSURL *)authServer NS_DESIGNATED_INITIALIZER; - -@property (nonatomic, readwrite) NSURL *authenticationServer; - -/** - All 'refresh handles' associated with Realms opened by this user. A refresh handle is - an object that encapsulates the concept of periodically refreshing the Realm's access - token before it expires. Tokens are indexed by their paths (e.g. `/~/path/to/realm`). - */ -@property (nonatomic) NSMutableDictionary *refreshHandles; - -@end - -@implementation RLMSyncUser - -#pragma mark - static API - -+ (NSDictionary *)allUsers { - NSArray *allUsers = [[RLMSyncManager sharedManager] _allUsers]; - return [NSDictionary dictionaryWithObjects:allUsers - forKeys:[allUsers valueForKey:@"identity"]]; -} - -+ (RLMSyncUser *)currentUser { - NSArray *allUsers = [[RLMSyncManager sharedManager] _allUsers]; - if (allUsers.count > 1) { - @throw RLMException(@"+currentUser cannot be called if more that one valid, logged-in user exists."); - } - return allUsers.firstObject; -} - -#pragma mark - API - -- (instancetype)initWithAuthServer:(nullable NSURL *)authServer { - if (self = [super init]) { - self.authenticationServer = authServer; - return self; - } - return nil; -} - -- (instancetype)initWithSyncUser:(std::shared_ptr)user { - NSString *rawServerURL = @(user->server_url().c_str()); - if (self = [self initWithAuthServer:[NSURL URLWithString:rawServerURL]]) { - _user = user; - return self; - } - return nil; -} - -- (BOOL)isEqual:(id)object { - if (![object isKindOfClass:[RLMSyncUser class]]) { - return NO; - } - return _user == ((RLMSyncUser *)object)->_user; -} - -+ (void)logInWithCredentials:(RLMSyncCredentials *)credential - authServerURL:(NSURL *)authServerURL - onCompletion:(RLMUserCompletionBlock)completion { - [self logInWithCredentials:credential - authServerURL:authServerURL - timeout:30 - onCompletion:completion]; -} - -+ (void)logInWithCredentials:(RLMSyncCredentials *)credential - authServerURL:(NSURL *)authServerURL - timeout:(NSTimeInterval)timeout - onCompletion:(RLMUserCompletionBlock)completion { - RLMSyncUser *user = [[RLMSyncUser alloc] initWithAuthServer:authServerURL]; - [RLMSyncUser _performLogInForUser:user - credentials:credential - authServerURL:authServerURL - timeout:timeout - completionBlock:completion]; -} - -- (void)logOut { - if (!_user) { - return; - } - _user->log_out(); - for (id key in self.refreshHandles) { - [self.refreshHandles[key] invalidate]; - } - [self.refreshHandles removeAllObjects]; -} - -- (nullable RLMSyncSession *)sessionForURL:(NSURL *)url { - if (!_user) { - return nil; - } - auto path = SyncManager::shared().path_for_realm(_user->identity(), [url.absoluteString UTF8String]); - return [[RLMSyncSession alloc] initWithSyncSession:_user->session_for_on_disk_path(path)]; -} - -- (NSArray *)allSessions { - if (!_user) { - return @[]; - } - NSMutableArray *buffer = [NSMutableArray array]; - auto sessions = _user->all_sessions(); - for (auto session : sessions) { - [buffer addObject:[[RLMSyncSession alloc] initWithSyncSession:std::move(session)]]; - } - return [buffer copy]; -} - -- (NSString *)identity { - if (!_user) { - return nil; - } - return @(_user->identity().c_str()); -} - -- (RLMSyncUserState)state { - if (!_user) { - return RLMSyncUserStateError; - } - switch (_user->state()) { - case SyncUser::State::Active: - return RLMSyncUserStateActive; - case SyncUser::State::LoggedOut: - return RLMSyncUserStateLoggedOut; - case SyncUser::State::Error: - return RLMSyncUserStateError; - } -} - -- (RLMRealm *)managementRealmWithError:(NSError **)error { - return [RLMRealm realmWithConfiguration:[RLMRealmConfiguration managementConfigurationForUser:self] error:error]; -} - -#pragma mark - Private API - -- (void)_unregisterRefreshHandleForURLPath:(NSString *)path { - [self.refreshHandles removeObjectForKey:path]; -} - -- (NSString *)_refreshToken { - if (!_user) { - return nil; - } - return @(_user->refresh_token().c_str()); -} - -- (void)_bindSessionWithConfig:(const SyncConfig&)config - session:(std::shared_ptr)session - completion:(RLMSyncBasicErrorReportingBlock)completion { - // Create a refresh handle, and have it handle all the work. - NSURL *realmURL = [NSURL URLWithString:@(config.realm_url.c_str())]; - NSString *path = [realmURL path]; - REALM_ASSERT(realmURL && path); - [self.refreshHandles[path] invalidate]; - self.refreshHandles[path] = [[RLMSyncSessionRefreshHandle alloc] initWithRealmURL:realmURL - user:self - session:std::move(session) - completionBlock:completion]; -} - -- (std::shared_ptr)_syncUser { - return _user; -} - -+ (void)_performLogInForUser:(RLMSyncUser *)user - credentials:(RLMSyncCredentials *)credentials - authServerURL:(NSURL *)authServerURL - timeout:(NSTimeInterval)timeout - completionBlock:(RLMUserCompletionBlock)completion { - // Special credential login should be treated differently. - if (credentials.provider == RLMIdentityProviderAccessToken) { - [self _performLoginForDirectAccessTokenCredentials:credentials user:user completionBlock:completion]; - return; - } - - // Prepare login network request - NSMutableDictionary *json = [@{ - kRLMSyncProviderKey: credentials.provider, - kRLMSyncDataKey: credentials.token, - kRLMSyncAppIDKey: [RLMSyncManager sharedManager].appID, - } mutableCopy]; - NSMutableDictionary *info = [(credentials.userInfo ?: @{}) mutableCopy]; - - if ([info count] > 0) { - // Munge user info into the JSON request. - json[@"user_info"] = info; - } - - RLMSyncCompletionBlock handler = ^(NSError *error, NSDictionary *json) { - if (json && !error) { - RLMAuthResponseModel *model = [[RLMAuthResponseModel alloc] initWithDictionary:json - requireAccessToken:NO - requireRefreshToken:YES]; - if (!model) { - // Malformed JSON - error = [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorBadResponse - userInfo:@{kRLMSyncErrorJSONKey: json}]; - completion(nil, error); - return; - } else { - std::string server_url = authServerURL.absoluteString.UTF8String; - auto sync_user = SyncManager::shared().get_user([model.refreshToken.tokenData.identity UTF8String], - [model.refreshToken.token UTF8String], - std::move(server_url)); - if (!sync_user) { - completion(nil, [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorClientSessionError - userInfo:nil]); - return; - } - user->_user = sync_user; - completion(user, nil); - } - } else { - // Something else went wrong - completion(nil, error); - } - }; - [RLMNetworkClient postRequestToEndpoint:RLMServerEndpointAuth - server:authServerURL - JSON:json - timeout:timeout - completion:handler]; -} - -+ (void)_performLoginForDirectAccessTokenCredentials:(RLMSyncCredentials *)credentials - user:(RLMSyncUser *)user - completionBlock:(nonnull RLMUserCompletionBlock)completion { - NSString *identity = credentials.userInfo[kRLMSyncIdentityKey]; - NSAssert(identity != nil, @"Improperly created direct access token credential."); - auto sync_user = SyncManager::shared().get_user([identity UTF8String], [credentials.token UTF8String], none, true); - if (!sync_user) { - completion(nil, [NSError errorWithDomain:RLMSyncErrorDomain - code:RLMSyncErrorClientSessionError - userInfo:nil]); - return; - } - user->_user = sync_user; - completion(user, nil); -} - -@end diff --git a/Pods/Realm/Realm/RLMSyncUtil.mm b/Pods/Realm/Realm/RLMSyncUtil.mm deleted file mode 100644 index c3f9f60c..00000000 --- a/Pods/Realm/Realm/RLMSyncUtil.mm +++ /dev/null @@ -1,96 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import "RLMSyncUtil_Private.hpp" -#import "RLMSyncUser_Private.hpp" -#import "RLMRealmConfiguration+Sync.h" -#import "RLMRealmConfiguration_Private.hpp" -#import "RLMSyncPermissionChange.h" -#import "RLMSyncPermissionOffer.h" -#import "RLMSyncPermissionOfferResponse.h" - -@implementation RLMRealmConfiguration (RealmSync) -+ (instancetype)managementConfigurationForUser:(RLMSyncUser *)user { - NSURLComponents *components = [NSURLComponents componentsWithURL:user.authenticationServer resolvingAgainstBaseURL:NO]; - if ([components.scheme isEqualToString:@"https"]) { - components.scheme = @"realms"; - } else { - components.scheme = @"realm"; - } - components.path = @"/~/__management"; - NSURL *managementRealmURL = components.URL; - RLMSyncConfiguration *syncConfig = [[RLMSyncConfiguration alloc] initWithUser:user realmURL:managementRealmURL]; - RLMRealmConfiguration *config = [RLMRealmConfiguration new]; - config.syncConfiguration = syncConfig; - config.objectClasses = @[RLMSyncPermissionChange.class, RLMSyncPermissionOffer.class, RLMSyncPermissionOfferResponse.class]; - return config; -} -@end - -RLMIdentityProvider const RLMIdentityProviderAccessToken = @"_access_token"; - -NSString *const RLMSyncErrorDomain = @"io.realm.sync"; - -NSString *const kRLMSyncPathOfRealmBackupCopyKey = @"recovered_realm_location_path"; -NSString *const kRLMSyncInitiateClientResetBlockKey = @"initiate_client_reset_block"; - -NSString *const kRLMSyncAppIDKey = @"app_id"; -NSString *const kRLMSyncDataKey = @"data"; -NSString *const kRLMSyncErrorJSONKey = @"json"; -NSString *const kRLMSyncErrorStatusCodeKey = @"statusCode"; -NSString *const kRLMSyncIdentityKey = @"identity"; -NSString *const kRLMSyncPasswordKey = @"password"; -NSString *const kRLMSyncPathKey = @"path"; -NSString *const kRLMSyncProviderKey = @"provider"; -NSString *const kRLMSyncRegisterKey = @"register"; -NSString *const kRLMSyncUnderlyingErrorKey = @"underlying_error"; - -namespace realm { - -SyncSessionStopPolicy translateStopPolicy(RLMSyncStopPolicy stopPolicy) { - switch (stopPolicy) { - case RLMSyncStopPolicyImmediately: return SyncSessionStopPolicy::Immediately; - case RLMSyncStopPolicyLiveIndefinitely: return SyncSessionStopPolicy::LiveIndefinitely; - case RLMSyncStopPolicyAfterChangesUploaded: return SyncSessionStopPolicy::AfterChangesUploaded; - } - REALM_UNREACHABLE(); // Unrecognized stop policy. -} - -RLMSyncStopPolicy translateStopPolicy(SyncSessionStopPolicy stop_policy) -{ - switch (stop_policy) { - case SyncSessionStopPolicy::Immediately: return RLMSyncStopPolicyImmediately; - case SyncSessionStopPolicy::LiveIndefinitely: return RLMSyncStopPolicyLiveIndefinitely; - case SyncSessionStopPolicy::AfterChangesUploaded: return RLMSyncStopPolicyAfterChangesUploaded; - } - REALM_UNREACHABLE(); -} - -} - -RLMSyncManagementObjectStatus RLMMakeSyncManagementObjectStatus(NSNumber *statusCode) { - if (!statusCode) { - return RLMSyncManagementObjectStatusNotProcessed; - } - if (statusCode.integerValue == 0) { - return RLMSyncManagementObjectStatusSuccess; - } - return RLMSyncManagementObjectStatusError; -} diff --git a/Pods/Realm/Realm/RLMThreadSafeReference.mm b/Pods/Realm/Realm/RLMThreadSafeReference.mm deleted file mode 100644 index 7149fa47..00000000 --- a/Pods/Realm/Realm/RLMThreadSafeReference.mm +++ /dev/null @@ -1,79 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMThreadSafeReference_Private.hpp" -#import "RLMUtil.hpp" - -template -static auto translateErrors(Function&& f) { - try { - return f(); - } - catch (std::exception const& e) { - @throw RLMException(e); - } -} - -@implementation RLMThreadSafeReference { - std::unique_ptr _reference; - id _metadata; - Class _type; -} - -- (instancetype)initWithThreadConfined:(id)threadConfined { - if (!(self = [super init])) { - return nil; - } - - REALM_ASSERT_DEBUG([threadConfined conformsToProtocol:@protocol(RLMThreadConfined)]); - if (![threadConfined conformsToProtocol:@protocol(RLMThreadConfined_Private)]) { - @throw RLMException(@"Illegal custom conformance to `RLMThreadConfined` by `%@`", threadConfined.class); - } else if (threadConfined.invalidated) { - @throw RLMException(@"Cannot construct reference to invalidated object"); - } else if (!threadConfined.realm) { - @throw RLMException(@"Cannot construct reference to unmanaged object, " - "which can be passed across threads directly"); - } - - translateErrors([&] { - _reference = [(id)threadConfined makeThreadSafeReference]; - _metadata = ((id)threadConfined).objectiveCMetadata; - }); - _type = threadConfined.class; - - return self; -} - -+ (instancetype)referenceWithThreadConfined:(id)threadConfined { - return [[self alloc] initWithThreadConfined:threadConfined]; -} - -- (id)resolveReferenceInRealm:(RLMRealm *)realm { - if (!_reference) { - @throw RLMException(@"Can only resolve a thread safe reference once."); - } - return translateErrors([&] { - return [_type objectWithThreadSafeReference:std::move(_reference) metadata:_metadata realm:realm]; - }); -} - -- (BOOL)isInvalidated { - return !_reference; -} - -@end diff --git a/Pods/Realm/Realm/RLMTokenModels.m b/Pods/Realm/Realm/RLMTokenModels.m deleted file mode 100644 index e85e70e5..00000000 --- a/Pods/Realm/Realm/RLMTokenModels.m +++ /dev/null @@ -1,71 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMTokenModels.h" -#import "RLMSyncUtil_Private.h" - -static const NSString *const kRLMSyncTokenDataKey = @"token_data"; -static const NSString *const kRLMSyncTokenKey = @"token"; -static const NSString *const kRLMSyncExpiresKey = @"expires"; - -@interface RLMTokenDataModel () - -@property (nonatomic, readwrite) NSString *identity; -@property (nonatomic, readwrite) NSString *appID; -@property (nonatomic, readwrite) NSString *path; -@property (nonatomic, readwrite) NSTimeInterval expires; -//@property (nonatomic, readwrite) NSArray *access; - -@end - -@implementation RLMTokenDataModel - -- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary { - if (self = [super init]) { - RLM_SYNC_PARSE_STRING_OR_ABORT(jsonDictionary, kRLMSyncIdentityKey, identity); - RLM_SYNC_PARSE_OPTIONAL_STRING(jsonDictionary, kRLMSyncAppIDKey, appID); - RLM_SYNC_PARSE_OPTIONAL_STRING(jsonDictionary, kRLMSyncPathKey, path); - RLM_SYNC_PARSE_DOUBLE_OR_ABORT(jsonDictionary, kRLMSyncExpiresKey, expires); - return self; - } - return nil; -} - -@end - -@interface RLMTokenModel () - -@property (nonatomic, readwrite) NSString *token; -@property (nonatomic, nullable, readwrite) NSString *path; -@property (nonatomic, readwrite) RLMTokenDataModel *tokenData; - -@end - -@implementation RLMTokenModel - -- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary { - if (self = [super init]) { - RLM_SYNC_PARSE_STRING_OR_ABORT(jsonDictionary, kRLMSyncTokenKey, token); - RLM_SYNC_PARSE_OPTIONAL_STRING(jsonDictionary, kRLMSyncPathKey, path); - RLM_SYNC_PARSE_MODEL_OR_ABORT(jsonDictionary, kRLMSyncTokenDataKey, RLMTokenDataModel, tokenData); - return self; - } - return nil; -} - -@end diff --git a/Pods/Realm/Realm/RLMUpdateChecker.mm b/Pods/Realm/Realm/RLMUpdateChecker.mm deleted file mode 100644 index e282ee85..00000000 --- a/Pods/Realm/Realm/RLMUpdateChecker.mm +++ /dev/null @@ -1,48 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMUpdateChecker.hpp" - -#import "RLMRealm.h" -#import "RLMUtil.hpp" - -#if TARGET_IPHONE_SIMULATOR && !defined(REALM_COCOA_VERSION) -#import "RLMVersion.h" -#endif - -void RLMCheckForUpdates() { -#if TARGET_IPHONE_SIMULATOR - if (getenv("REALM_DISABLE_UPDATE_CHECKER") || RLMIsRunningInPlayground()) { - return; - } - - auto handler = ^(NSData *data, NSURLResponse *response, NSError *error) { - if (error || ((NSHTTPURLResponse *)response).statusCode != 200) { - return; - } - - NSString *latestVersion = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; - if (![REALM_COCOA_VERSION isEqualToString:latestVersion]) { - NSLog(@"Version %@ of Realm is now available: https://github.com/realm/realm-cocoa/blob/v%@/CHANGELOG.md", latestVersion, latestVersion); - } - }; - - NSString *url = [NSString stringWithFormat:@"https://static.realm.io/update/cocoa?%@", REALM_COCOA_VERSION]; - [[NSURLSession.sharedSession dataTaskWithURL:[NSURL URLWithString:url] completionHandler:handler] resume]; -#endif -} diff --git a/Pods/Realm/Realm/RLMUtil.mm b/Pods/Realm/Realm/RLMUtil.mm deleted file mode 100644 index fa77a9d2..00000000 --- a/Pods/Realm/Realm/RLMUtil.mm +++ /dev/null @@ -1,387 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMUtil.hpp" - -#import "RLMArray_Private.hpp" -#import "RLMListBase.h" -#import "RLMObjectSchema_Private.hpp" -#import "RLMObjectStore.h" -#import "RLMObject_Private.hpp" -#import "RLMProperty_Private.h" -#import "RLMSchema_Private.h" -#import "RLMSwiftSupport.h" - -#import "shared_realm.hpp" - -#import -#import - -#include -#include - -#if !defined(REALM_COCOA_VERSION) -#import "RLMVersion.h" -#endif - -static inline bool nsnumber_is_like_integer(__unsafe_unretained NSNumber *const obj) -{ - char data_type = [obj objCType][0]; - return data_type == *@encode(bool) || - data_type == *@encode(char) || - data_type == *@encode(short) || - data_type == *@encode(int) || - data_type == *@encode(long) || - data_type == *@encode(long long) || - data_type == *@encode(unsigned short) || - data_type == *@encode(unsigned int) || - data_type == *@encode(unsigned long) || - data_type == *@encode(unsigned long long); -} - -static inline bool nsnumber_is_like_bool(__unsafe_unretained NSNumber *const obj) -{ - // @encode(BOOL) is 'B' on iOS 64 and 'c' - // objcType is always 'c'. Therefore compare to "c". - if ([obj objCType][0] == 'c') { - return true; - } - - if (nsnumber_is_like_integer(obj)) { - int value = [obj intValue]; - return value == 0 || value == 1; - } - - return false; -} - -static inline bool nsnumber_is_like_float(__unsafe_unretained NSNumber *const obj) -{ - char data_type = [obj objCType][0]; - return data_type == *@encode(float) || - data_type == *@encode(short) || - data_type == *@encode(int) || - data_type == *@encode(long) || - data_type == *@encode(long long) || - data_type == *@encode(unsigned short) || - data_type == *@encode(unsigned int) || - data_type == *@encode(unsigned long) || - data_type == *@encode(unsigned long long) || - // A double is like float if it fits within float bounds - (data_type == *@encode(double) && ABS([obj doubleValue]) <= FLT_MAX); -} - -static inline bool nsnumber_is_like_double(__unsafe_unretained NSNumber *const obj) -{ - char data_type = [obj objCType][0]; - return data_type == *@encode(double) || - data_type == *@encode(float) || - data_type == *@encode(short) || - data_type == *@encode(int) || - data_type == *@encode(long) || - data_type == *@encode(long long) || - data_type == *@encode(unsigned short) || - data_type == *@encode(unsigned int) || - data_type == *@encode(unsigned long) || - data_type == *@encode(unsigned long long); -} - -BOOL RLMIsObjectValidForProperty(__unsafe_unretained id const obj, - __unsafe_unretained RLMProperty *const property) { - if (property.optional && !RLMCoerceToNil(obj)) { - return YES; - } - - switch (property.type) { - case RLMPropertyTypeString: - return [obj isKindOfClass:[NSString class]]; - case RLMPropertyTypeBool: - if ([obj isKindOfClass:[NSNumber class]]) { - return nsnumber_is_like_bool(obj); - } - return NO; - case RLMPropertyTypeDate: - return [obj isKindOfClass:[NSDate class]]; - case RLMPropertyTypeInt: - if (NSNumber *number = RLMDynamicCast(obj)) { - return nsnumber_is_like_integer(number); - } - return NO; - case RLMPropertyTypeFloat: - if (NSNumber *number = RLMDynamicCast(obj)) { - return nsnumber_is_like_float(number); - } - return NO; - case RLMPropertyTypeDouble: - if (NSNumber *number = RLMDynamicCast(obj)) { - return nsnumber_is_like_double(number); - } - return NO; - case RLMPropertyTypeData: - return [obj isKindOfClass:[NSData class]]; - case RLMPropertyTypeAny: - return NO; - case RLMPropertyTypeObject: - case RLMPropertyTypeLinkingObjects: { - // only NSNull, nil, or objects which derive from RLMObject and match the given - // object class are valid - RLMObjectBase *objBase = RLMDynamicCast(obj); - return objBase && [objBase->_objectSchema.className isEqualToString:property.objectClassName]; - } - case RLMPropertyTypeArray: { - if (RLMArray *array = RLMDynamicCast(obj)) { - return [array.objectClassName isEqualToString:property.objectClassName]; - } - if (RLMListBase *list = RLMDynamicCast(obj)) { - return [list._rlmArray.objectClassName isEqualToString:property.objectClassName]; - } - if ([obj conformsToProtocol:@protocol(NSFastEnumeration)]) { - // check each element for compliance - for (id el in (id)obj) { - RLMObjectBase *obj = RLMDynamicCast(el); - if (!obj || ![obj->_objectSchema.className isEqualToString:property.objectClassName]) { - return NO; - } - } - return YES; - } - if (!obj || obj == NSNull.null) { - return YES; - } - return NO; - } - } - @throw RLMException(@"Invalid RLMPropertyType specified"); -} - -NSDictionary *RLMDefaultValuesForObjectSchema(__unsafe_unretained RLMObjectSchema *const objectSchema) { - if (!objectSchema.isSwiftClass) { - return [objectSchema.objectClass defaultPropertyValues]; - } - - NSMutableDictionary *defaults = nil; - if ([objectSchema.objectClass isSubclassOfClass:RLMObject.class]) { - defaults = [NSMutableDictionary dictionaryWithDictionary:[objectSchema.objectClass defaultPropertyValues]]; - } - else { - defaults = [NSMutableDictionary dictionary]; - } - RLMObject *defaultObject = [[objectSchema.objectClass alloc] init]; - for (RLMProperty *prop in objectSchema.properties) { - if (!defaults[prop.name] && defaultObject[prop.name]) { - defaults[prop.name] = defaultObject[prop.name]; - } - } - return defaults; -} - -static NSException *RLMException(NSString *reason, NSDictionary *additionalUserInfo) { - NSMutableDictionary *userInfo = @{RLMRealmVersionKey: REALM_COCOA_VERSION, - RLMRealmCoreVersionKey: @REALM_VERSION}.mutableCopy; - if (additionalUserInfo != nil) { - [userInfo addEntriesFromDictionary:additionalUserInfo]; - } - NSException *e = [NSException exceptionWithName:RLMExceptionName - reason:reason - userInfo:userInfo]; - return e; -} - -NSException *RLMException(NSString *fmt, ...) { - va_list args; - va_start(args, fmt); - NSException *e = RLMException([[NSString alloc] initWithFormat:fmt arguments:args], @{}); - va_end(args); - return e; -} - -NSException *RLMException(std::exception const& exception) { - return RLMException(@"%@", @(exception.what())); -} - -NSError *RLMMakeError(RLMError code, std::exception const& exception) { - return [NSError errorWithDomain:RLMErrorDomain - code:code - userInfo:@{NSLocalizedDescriptionKey: @(exception.what()), - @"Error Code": @(code)}]; -} - -NSError *RLMMakeError(RLMError code, const realm::util::File::AccessError& exception) { - return [NSError errorWithDomain:RLMErrorDomain - code:code - userInfo:@{NSLocalizedDescriptionKey: @(exception.what()), - NSFilePathErrorKey: @(exception.get_path().c_str()), - @"Error Code": @(code)}]; -} - -NSError *RLMMakeError(RLMError code, const realm::RealmFileException& exception) { - NSString *underlying = @(exception.underlying().c_str()); - return [NSError errorWithDomain:RLMErrorDomain - code:code - userInfo:@{NSLocalizedDescriptionKey: @(exception.what()), - NSFilePathErrorKey: @(exception.path().c_str()), - @"Error Code": @(code), - @"Underlying": underlying.length == 0 ? @"n/a" : underlying}]; -} - -NSError *RLMMakeError(std::system_error const& exception) { - BOOL isGenericCategoryError = (exception.code().category() == std::generic_category()); - NSString *category = @(exception.code().category().name()); - NSString *errorDomain = isGenericCategoryError ? NSPOSIXErrorDomain : RLMUnknownSystemErrorDomain; - - return [NSError errorWithDomain:errorDomain - code:exception.code().value() - userInfo:@{NSLocalizedDescriptionKey: @(exception.what()), - @"Error Code": @(exception.code().value()), - @"Category": category}]; -} - -NSError *RLMMakeError(NSException *exception) { - return [NSError errorWithDomain:RLMErrorDomain - code:0 - userInfo:@{NSLocalizedDescriptionKey: exception.reason}]; -} - -void RLMSetErrorOrThrow(NSError *error, NSError **outError) { - if (outError) { - *outError = error; - } - else { - NSString *msg = error.localizedDescription; - if (error.userInfo[NSFilePathErrorKey]) { - msg = [NSString stringWithFormat:@"%@: %@", error.userInfo[NSFilePathErrorKey], error.localizedDescription]; - } - @throw RLMException(msg, @{NSUnderlyingErrorKey: error}); - } -} - -// Determines if class1 descends from class2 -static inline BOOL RLMIsSubclass(Class class1, Class class2) { - class1 = class_getSuperclass(class1); - return RLMIsKindOfClass(class1, class2); -} - -static bool treatFakeObjectAsRLMObject = false; - -void RLMSetTreatFakeObjectAsRLMObject(BOOL flag) { - treatFakeObjectAsRLMObject = flag; -} - -BOOL RLMIsObjectOrSubclass(Class klass) { - if (RLMIsKindOfClass(klass, RLMObjectBase.class)) { - return YES; - } - - if (treatFakeObjectAsRLMObject) { - static Class FakeObjectClass = NSClassFromString(@"FakeObject"); - return RLMIsKindOfClass(klass, FakeObjectClass); - } - return NO; -} - -BOOL RLMIsObjectSubclass(Class klass) { - if (RLMIsSubclass(class_getSuperclass(klass), RLMObjectBase.class)) { - return YES; - } - - if (treatFakeObjectAsRLMObject) { - static Class FakeObjectClass = NSClassFromString(@"FakeObject"); - return RLMIsSubclass(klass, FakeObjectClass); - } - return NO; -} - -BOOL RLMIsDebuggerAttached() -{ - int name[] = { - CTL_KERN, - KERN_PROC, - KERN_PROC_PID, - getpid() - }; - - struct kinfo_proc info; - size_t info_size = sizeof(info); - if (sysctl(name, sizeof(name)/sizeof(name[0]), &info, &info_size, NULL, 0) == -1) { - NSLog(@"sysctl() failed: %s", strerror(errno)); - return false; - } - - return (info.kp_proc.p_flag & P_TRACED) != 0; -} - -BOOL RLMIsRunningInPlayground() { - return [[NSBundle mainBundle].bundleIdentifier hasPrefix:@"com.apple.dt.playground."]; -} - -id RLMMixedToObjc(realm::Mixed const& mixed) { - switch (mixed.get_type()) { - case realm::type_String: - return RLMStringDataToNSString(mixed.get_string()); - case realm::type_Int: - return @(mixed.get_int()); - case realm::type_Float: - return @(mixed.get_float()); - case realm::type_Double: - return @(mixed.get_double()); - case realm::type_Bool: - return @(mixed.get_bool()); - case realm::type_Timestamp: - return RLMTimestampToNSDate(mixed.get_timestamp()); - case realm::type_Binary: - return RLMBinaryDataToNSData(mixed.get_binary()); - case realm::type_Link: - case realm::type_LinkList: - default: - @throw RLMException(@"Invalid data type for RLMPropertyTypeAny property."); - } -} - -NSString *RLMDefaultDirectoryForBundleIdentifier(NSString *bundleIdentifier) { -#if TARGET_OS_TV - (void)bundleIdentifier; - // tvOS prohibits writing to the Documents directory, so we use the Library/Caches directory instead. - return NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0]; -#elif TARGET_OS_IPHONE - (void)bundleIdentifier; - // On iOS the Documents directory isn't user-visible, so put files there - return NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]; -#else - // On OS X it is, so put files in Application Support. If we aren't running - // in a sandbox, put it in a subdirectory based on the bundle identifier - // to avoid accidentally sharing files between applications - NSString *path = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES)[0]; - if (![[NSProcessInfo processInfo] environment][@"APP_SANDBOX_CONTAINER_ID"]) { - if (!bundleIdentifier) { - bundleIdentifier = [NSBundle mainBundle].bundleIdentifier; - } - if (!bundleIdentifier) { - bundleIdentifier = [NSBundle mainBundle].executablePath.lastPathComponent; - } - - path = [path stringByAppendingPathComponent:bundleIdentifier]; - - // create directory - [[NSFileManager defaultManager] createDirectoryAtPath:path - withIntermediateDirectories:YES - attributes:nil - error:nil]; - } - return path; -#endif -} diff --git a/Pods/Realm/Realm/Realm.modulemap b/Pods/Realm/Realm/Realm.modulemap deleted file mode 100644 index ef2d1028..00000000 --- a/Pods/Realm/Realm/Realm.modulemap +++ /dev/null @@ -1,29 +0,0 @@ -framework module Realm { - umbrella header "Realm.h" - - export * - module * { export * } - - explicit module Private { - header "RLMAccessor.h" - header "RLMArray_Private.h" - header "RLMListBase.h" - header "RLMObjectBase_Dynamic.h" - header "RLMObjectSchema_Private.h" - header "RLMObjectStore.h" - header "RLMObject_Private.h" - header "RLMOptionalBase.h" - header "RLMProperty_Private.h" - header "RLMRealmConfiguration_Private.h" - header "RLMRealm_Private.h" - header "RLMResults_Private.h" - header "RLMSchema_Private.h" - header "RLMSyncConfiguration_Private.h" - header "RLMSyncUtil_Private.h" - } - - explicit module Dynamic { - header "RLMRealm_Dynamic.h" - header "RLMObjectBase_Dynamic.h" - } -} diff --git a/Pods/Realm/build.sh b/Pods/Realm/build.sh deleted file mode 100755 index 2fed8c90..00000000 --- a/Pods/Realm/build.sh +++ /dev/null @@ -1,1388 +0,0 @@ -#!/bin/sh - -################################################################################## -# Custom build tool for Realm Objective-C binding. -# -# (C) Copyright 2011-2015 by realm.io. -################################################################################## - -# Warning: pipefail is not a POSIX compatible option, but on OS X it works just fine. -# OS X uses a POSIX complain version of bash as /bin/sh, but apparently it does -# not strip away this feature. Also, this will fail if somebody forces the script -# to be run with zsh. -set -o pipefail -set -e - -source_root="$(dirname "$0")" - -# You can override the version of the core library -: ${REALM_CORE_VERSION:=$(sed -n 's/^REALM_CORE_VERSION=\(.*\)$/\1/p' ${source_root}/dependencies.list)} # set to "current" to always use the current build - -: ${REALM_SYNC_VERSION:=$(sed -n 's/^REALM_SYNC_VERSION=\(.*\)$/\1/p' ${source_root}/dependencies.list)} - -: ${REALM_OBJECT_SERVER_VERSION:=$(sed -n 's/^REALM_OBJECT_SERVER_VERSION=\(.*\)$/\1/p' ${source_root}/dependencies.list)} - -# You can override the xcmode used -: ${XCMODE:=xcodebuild} # must be one of: xcodebuild (default), xcpretty, xctool - -# Provide a fallback value for TMPDIR, relevant for Xcode Bots -: ${TMPDIR:=$(getconf DARWIN_USER_TEMP_DIR)} - -PATH=/usr/libexec:$PATH - -if ! [ -z "${JENKINS_HOME}" ]; then - XCPRETTY_PARAMS="--no-utf --report junit --output build/reports/junit.xml" - CODESIGN_PARAMS="CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO" -fi - -usage() { -cat </dev/null - done -} - -download_object_server() { - local archive_name="realm-object-server-bundled_node_darwin-developer-$REALM_OBJECT_SERVER_VERSION.tar.gz" - curl -L -O "https://static.realm.io/downloads/object-server/$archive_name" - rm -rf sync - mkdir sync - tar xf $archive_name -C sync - rm $archive_name - cp Configuration/object-server-config.yml sync/object-server/configuration.yml - touch "sync/object-server/do_not_open_browser" -} - -download_core() { - echo "Downloading dependency: core ${REALM_CORE_VERSION}" - TMP_DIR="$TMPDIR/core_bin" - mkdir -p "${TMP_DIR}" - CORE_TMP_TAR="${TMP_DIR}/core-${REALM_CORE_VERSION}.tar.xz.tmp" - CORE_TAR="${TMP_DIR}/core-${REALM_CORE_VERSION}.tar.xz" - if [ ! -f "${CORE_TAR}" ]; then - local CORE_URL="https://static.realm.io/downloads/core/realm-core-${REALM_CORE_VERSION}.tar.xz" - set +e # temporarily disable immediate exit - local ERROR # sweeps the exit code unless declared separately - ERROR=$(curl --fail --silent --show-error --location "$CORE_URL" --output "${CORE_TMP_TAR}" 2>&1 >/dev/null) - if [[ $? -ne 0 ]]; then - echo "Downloading core failed:\n${ERROR}" - exit 1 - fi - set -e # re-enable flag - mv "${CORE_TMP_TAR}" "${CORE_TAR}" - fi - - ( - cd "${TMP_DIR}" - rm -rf core - tar xf "${CORE_TAR}" --xz - mv core core-${REALM_CORE_VERSION} - ) - - rm -rf core-${REALM_CORE_VERSION} core - mv ${TMP_DIR}/core-${REALM_CORE_VERSION} . - ln -s core-${REALM_CORE_VERSION} core -} - -download_sync() { - echo "Downloading dependency: sync ${REALM_SYNC_VERSION}" - TMP_DIR="$TMPDIR/sync_bin" - mkdir -p "${TMP_DIR}" - SYNC_TMP_TAR="${TMP_DIR}/sync-${REALM_SYNC_VERSION}.tar.xz.tmp" - SYNC_TAR="${TMP_DIR}/sync-${REALM_SYNC_VERSION}.tar.xz" - if [ ! -f "${SYNC_TAR}" ]; then - local SYNC_URL="https://static.realm.io/downloads/sync/realm-sync-cocoa-${REALM_SYNC_VERSION}.tar.xz" - set +e # temporarily disable immediate exit - local ERROR # sweeps the exit code unless declared separately - ERROR=$(curl --fail --silent --show-error --location "$SYNC_URL" --output "${SYNC_TMP_TAR}" 2>&1 >/dev/null) - if [[ $? -ne 0 ]]; then - echo "Downloading sync failed:\n${ERROR}" - exit 1 - fi - set -e # re-enable flag - mv "${SYNC_TMP_TAR}" "${SYNC_TAR}" - fi - - ( - cd "${TMP_DIR}" - rm -rf sync - tar xf "${SYNC_TAR}" --xz - mv core sync-${REALM_SYNC_VERSION} - ) - - rm -rf sync-${REALM_SYNC_VERSION} core - mv ${TMP_DIR}/sync-${REALM_SYNC_VERSION} . - ln -s sync-${REALM_SYNC_VERSION} core -} - -###################################### -# Variables -###################################### - -COMMAND="$1" - -# Use Debug config if command ends with -debug, otherwise default to Release -case "$COMMAND" in - *-debug) - COMMAND="${COMMAND%-debug}" - CONFIGURATION="Debug" - ;; - *) CONFIGURATION=${CONFIGURATION:-Release} -esac -export CONFIGURATION - -source "${source_root}/scripts/swift-version.sh" - -case "$COMMAND" in - - ###################################### - # Clean - ###################################### - "clean") - find . -type d -name build -exec rm -r "{}" +\; - exit 0 - ;; - - ###################################### - # Object Server - ###################################### - "download-object-server") - download_object_server - exit 0 - ;; - - "start-object-server") - kill_object_server - ./sync/start-object-server.command - exit 0 - ;; - - "reset-object-server-between-tests") - # Leave the server files alone to avoid 'bad_server_ident' errors - rm -rf "~/Library/Application Support/xctest" - rm -rf "~/Library/Application Support/io.realm.TestHost" - rm -rf "~/Library/Application Support/xctest-child" - exit 0 - ;; - - "reset-object-server") - kill_object_server - # Add a short delay, so file system doesn't complain about files in use - sleep 1 - package="${source_root}/sync" - for file in "$package"/realm-object-server-*; do - if [ -d "$file" ]; then - package="$file" - break - fi - done - rm -rf "$package/object-server/root_dir/" - rm -rf "$package/object-server/temp_dir/" - sh build.sh reset-object-server-between-tests - exit 0 - ;; - - ###################################### - # Core - ###################################### - "download-core") - if [ "$REALM_CORE_VERSION" = "current" ]; then - echo "Using version of core already in core/ directory" - exit 0 - fi - if [ -d core -a -d ../realm-core -a ! -L core ]; then - # Allow newer versions than expected for local builds as testing - # with unreleased versions is one of the reasons to use a local build - if ! $(grep -i "${REALM_CORE_VERSION} Release notes" core/release_notes.txt >/dev/null); then - echo "Local build of core is out of date." - exit 1 - else - echo "The core library seems to be up to date." - fi - elif ! [ -L core ]; then - echo "core is not a symlink. Deleting..." - rm -rf core - download_core - # With a prebuilt version we only want to check the first non-empty - # line so that checking out an older commit will download the - # appropriate version of core if the already-present version is too new - elif ! $(grep -m 1 . core/release_notes.txt | grep -i "${REALM_CORE_VERSION} RELEASE NOTES" >/dev/null); then - download_core - else - echo "The core library seems to be up to date." - fi - exit 0 - ;; - - ###################################### - # Sync - ###################################### - "download-sync") - if [ "$REALM_SYNC_VERSION" = "current" ]; then - echo "Using version of core already in core/ directory" - exit 0 - fi - if [ -d core -a -d ../realm-core -a -d ../realm-sync -a ! -L core ]; then - echo "Using version of core already in core/ directory" - elif ! [ -L core ]; then - echo "core is not a symlink. Deleting..." - rm -rf core - download_sync - elif [[ "$(cat core/version.txt)" != "$REALM_SYNC_VERSION" ]]; then - download_sync - else - echo "The core library seems to be up to date." - fi - exit 0 - ;; - - ###################################### - # Swift versioning - ###################################### - "set-swift-version") - version="$2" - if [[ -z "$version" ]]; then - version="$REALM_SWIFT_VERSION" - fi - - SWIFT_VERSION_FILE="RealmSwift/SwiftVersion.swift" - CONTENTS="let swiftLanguageVersion = \"$version\"" - if [ ! -f "$SWIFT_VERSION_FILE" ] || ! grep -q "$CONTENTS" "$SWIFT_VERSION_FILE"; then - echo "$CONTENTS" > "$SWIFT_VERSION_FILE" - fi - - exit 0 - ;; - - "prelaunch-simulator") - sh ${source_root}/scripts/reset-simulators.sh - ;; - - ###################################### - # Building - ###################################### - "build") - sh build.sh ios-static - sh build.sh ios-dynamic - sh build.sh ios-swift - sh build.sh watchos - sh build.sh watchos-swift - sh build.sh tvos - sh build.sh tvos-swift - sh build.sh osx - sh build.sh osx-swift - exit 0 - ;; - - "ios-static") - build_combined 'Realm iOS static' Realm iphoneos iphonesimulator "-static" - exit 0 - ;; - - "ios-dynamic") - build_combined Realm Realm iphoneos iphonesimulator - exit 0 - ;; - - "ios-swift") - sh build.sh ios-dynamic - build_combined RealmSwift RealmSwift iphoneos iphonesimulator '' "/swift-$REALM_SWIFT_VERSION" - cp -R build/ios/Realm.framework build/ios/swift-$REALM_SWIFT_VERSION - exit 0 - ;; - - "watchos") - build_combined Realm Realm watchos watchsimulator - exit 0 - ;; - - "watchos-swift") - sh build.sh watchos - build_combined RealmSwift RealmSwift watchos watchsimulator '' "/swift-$REALM_SWIFT_VERSION" - cp -R build/watchos/Realm.framework build/watchos/swift-$REALM_SWIFT_VERSION - exit 0 - ;; - - "tvos") - build_combined Realm Realm appletvos appletvsimulator - exit 0 - ;; - - "tvos-swift") - sh build.sh tvos - build_combined RealmSwift RealmSwift appletvos appletvsimulator '' "/swift-$REALM_SWIFT_VERSION" - cp -R build/tvos/Realm.framework build/tvos/swift-$REALM_SWIFT_VERSION - exit 0 - ;; - - "osx") - xc "-scheme Realm -configuration $CONFIGURATION" - clean_retrieve "build/DerivedData/Realm/Build/Products/$CONFIGURATION/Realm.framework" "build/osx" "Realm.framework" - exit 0 - ;; - - "osx-swift") - sh build.sh osx - xc "-scheme 'RealmSwift' -configuration $CONFIGURATION build" - destination="build/osx/swift-$REALM_SWIFT_VERSION" - clean_retrieve "build/DerivedData/Realm/Build/Products/$CONFIGURATION/RealmSwift.framework" "$destination" "RealmSwift.framework" - cp -R build/osx/Realm.framework "$destination" - exit 0 - ;; - - ###################################### - # Analysis - ###################################### - - "analyze-osx") - xc "-scheme Realm -configuration $CONFIGURATION analyze" - exit 0 - ;; - - ###################################### - # Testing - ###################################### - "test") - set +e # Run both sets of tests even if the first fails - failed=0 - sh build.sh test-ios-static || failed=1 - sh build.sh test-ios-dynamic || failed=1 - sh build.sh test-ios-swift || failed=1 - sh build.sh test-ios-devices || failed=1 - sh build.sh test-tvos-devices || failed=1 - sh build.sh test-osx || failed=1 - sh build.sh test-osx-swift || failed=1 - exit $failed - ;; - - "test-all") - set +e - failed=0 - sh build.sh test || failed=1 - sh build.sh test-debug || failed=1 - exit $failed - ;; - - "test-ios-static") - test_ios_static "name=iPhone 6" - exit 0 - ;; - - "test-ios7-static") - test_ios_static "name=iPhone 5S,OS=7.1" - exit 0 - ;; - - "test-ios-dynamic") - xc "-scheme Realm -configuration $CONFIGURATION -sdk iphonesimulator -destination 'name=iPhone 6' build" - xc "-scheme Realm -configuration $CONFIGURATION -sdk iphonesimulator -destination 'name=iPhone 6' test 'ARCHS=\$(ARCHS_STANDARD_32_BIT)'" - xc "-scheme Realm -configuration $CONFIGURATION -sdk iphonesimulator -destination 'name=iPhone 6' test" - exit 0 - ;; - - "test-ios-swift") - xc "-scheme RealmSwift -configuration $CONFIGURATION -sdk iphonesimulator -destination 'name=iPhone 6' build" - xc "-scheme RealmSwift -configuration $CONFIGURATION -sdk iphonesimulator -destination 'name=iPhone 6' test 'ARCHS=\$(ARCHS_STANDARD_32_BIT)'" - xc "-scheme RealmSwift -configuration $CONFIGURATION -sdk iphonesimulator -destination 'name=iPhone 6' test" - exit 0 - ;; - - "test-ios-devices") - failed=0 - trap "failed=1" ERR - sh build.sh test-ios-devices-objc - sh build.sh test-ios-devices-swift - exit $failed - ;; - - "test-ios-devices-objc") - test_devices iphoneos "Realm" "$CONFIGURATION" - exit $? - ;; - - "test-ios-devices-swift") - test_devices iphoneos "RealmSwift" "$CONFIGURATION" - exit $? - ;; - - "test-tvos") - xc "-scheme Realm -configuration $CONFIGURATION -sdk appletvsimulator -destination 'name=Apple TV 1080p' test" - exit $? - ;; - - "test-tvos-swift") - xc "-scheme RealmSwift -configuration $CONFIGURATION -sdk appletvsimulator -destination 'name=Apple TV 1080p' test" - exit $? - ;; - - "test-tvos-devices") - test_devices appletvos TestHost "$CONFIGURATION" - ;; - - "test-osx") - COVERAGE_PARAMS="" - if [[ "$CONFIGURATION" == "Debug" ]]; then - COVERAGE_PARAMS="GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES" - fi - xc "-scheme Realm -configuration $CONFIGURATION test $COVERAGE_PARAMS" - exit 0 - ;; - - "test-osx-swift") - xc "-scheme RealmSwift -configuration $CONFIGURATION test" - exit 0 - ;; - - "test-osx-object-server") - xc "-scheme 'Object Server Tests' -configuration $CONFIGURATION -sdk macosx test" - exit 0 - ;; - - ###################################### - # Full verification - ###################################### - "verify") - sh build.sh verify-cocoapods - sh build.sh verify-docs - sh build.sh verify-osx - sh build.sh verify-osx-debug - sh build.sh verify-osx-swift - sh build.sh verify-osx-swift-debug - sh build.sh verify-ios-static - sh build.sh verify-ios-static-debug - sh build.sh verify-ios7-static - sh build.sh verify-ios7-static-debug - sh build.sh verify-ios-dynamic - sh build.sh verify-ios-dynamic-debug - sh build.sh verify-ios-swift - sh build.sh verify-ios-swift-debug - sh build.sh verify-ios-device-objc - sh build.sh verify-ios-device-swift - sh build.sh verify-watchos - sh build.sh verify-tvos - sh build.sh verify-tvos-debug - sh build.sh verify-tvos-device - sh build.sh verify-swiftlint - sh build.sh verify-osx-object-server - ;; - - "verify-cocoapods") - if [[ -d .git ]]; then - # Verify the current branch, unless one was already specified in the sha environment variable. - if [[ -z $sha ]]; then - export sha=$(git rev-parse --abbrev-ref HEAD) - fi - - if [[ $(git log -1 @{push}..) != "" ]] || ! git diff-index --quiet HEAD; then - echo "WARNING: verify-cocoapods will test the latest revision of $sha found on GitHub." - echo " Any unpushed local changes will not be tested." - echo "" - sleep 1 - fi - fi - - cd examples/installation - sh build.sh test-ios-objc-cocoapods - sh build.sh test-ios-objc-cocoapods-dynamic - sh build.sh test-ios-swift-cocoapods - sh build.sh test-osx-objc-cocoapods - sh build.sh test-osx-swift-cocoapods - sh build.sh test-watchos-objc-cocoapods - sh build.sh test-watchos-swift-cocoapods - ;; - - "verify-osx-encryption") - REALM_ENCRYPT_ALL=YES sh build.sh test-osx - exit 0 - ;; - - "verify-osx") - sh build.sh test-osx - sh build.sh analyze-osx - sh build.sh examples-osx - - ( - cd examples/osx/objc/build/DerivedData/RealmExamples/Build/Products/$CONFIGURATION - DYLD_FRAMEWORK_PATH=. ./JSONImport >/dev/null - ) - exit 0 - ;; - - "verify-osx-swift") - sh build.sh test-osx-swift - exit 0 - ;; - - "verify-ios-static") - sh build.sh test-ios-static - sh build.sh examples-ios - ;; - - "verify-ios7-static") - sh build.sh test-ios7-static - ;; - - "verify-ios-dynamic") - sh build.sh test-ios-dynamic - ;; - - "verify-ios-swift") - sh build.sh test-ios-swift - sh build.sh examples-ios-swift - ;; - - "verify-ios-device-objc") - sh build.sh test-ios-devices-objc - exit 0 - ;; - - "verify-ios-device-swift") - sh build.sh test-ios-devices-swift - exit 0 - ;; - - "verify-docs") - sh build.sh docs - for lang in swift objc; do - undocumented="docs/${lang}_output/undocumented.json" - if ruby -rjson -e "j = JSON.parse(File.read('docs/${lang}_output/undocumented.json')); exit j['warnings'].length != 0"; then - echo "Undocumented Realm $lang declarations:" - cat "$undocumented" - exit 1 - fi - done - exit 0 - ;; - - "verify-watchos") - sh build.sh watchos-swift - exit 0 - ;; - - "verify-tvos") - sh build.sh test-tvos - sh build.sh test-tvos-swift - sh build.sh examples-tvos - sh build.sh examples-tvos-swift - exit 0 - ;; - - "verify-tvos-device") - sh build.sh test-tvos-devices - exit 0 - ;; - - "verify-swiftlint") - swiftlint lint --strict - exit 0 - ;; - - "verify-osx-object-server") - sh build.sh download-object-server - sh build.sh test-osx-object-server - sh build.sh reset-object-server - exit 0 - ;; - - ###################################### - # Docs - ###################################### - "docs") - build_docs objc - build_docs swift - exit 0 - ;; - - ###################################### - # Examples - ###################################### - "examples") - sh build.sh clean - sh build.sh examples-ios - sh build.sh examples-ios-swift - sh build.sh examples-osx - sh build.sh examples-tvos - sh build.sh examples-tvos-swift - exit 0 - ;; - - "examples-ios") - sh build.sh prelaunch-simulator - workspace="examples/ios/objc/RealmExamples.xcworkspace" - pod install --project-directory="$workspace/.." --no-repo-update - xc "-workspace $workspace -scheme Simple -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme TableView -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Migration -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Backlink -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme GroupedTableView -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme RACTableView -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Encryption -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Draw -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - - if [ ! -z "${JENKINS_HOME}" ]; then - xc "-workspace $workspace -scheme Extension -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - fi - - exit 0 - ;; - - "examples-ios-swift") - sh build.sh prelaunch-simulator - workspace="examples/ios/swift-$REALM_SWIFT_VERSION/RealmExamples.xcworkspace" - xc "-workspace $workspace -scheme Simple -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme TableView -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Migration -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Encryption -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme Backlink -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme GroupedTableView -configuration $CONFIGURATION -destination 'name=iPhone 6' build ${CODESIGN_PARAMS}" - exit 0 - ;; - - "examples-osx") - xc "-workspace examples/osx/objc/RealmExamples.xcworkspace -scheme JSONImport -configuration ${CONFIGURATION} build ${CODESIGN_PARAMS}" - ;; - - "examples-tvos") - workspace="examples/tvos/objc/RealmExamples.xcworkspace" - xc "-workspace $workspace -scheme DownloadCache -configuration $CONFIGURATION -destination 'name=Apple TV 1080p' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme PreloadedData -configuration $CONFIGURATION -destination 'name=Apple TV 1080p' build ${CODESIGN_PARAMS}" - exit 0 - ;; - - "examples-tvos-swift") - workspace="examples/tvos/swift-$REALM_SWIFT_VERSION/RealmExamples.xcworkspace" - xc "-workspace $workspace -scheme DownloadCache -configuration $CONFIGURATION -destination 'name=Apple TV 1080p' build ${CODESIGN_PARAMS}" - xc "-workspace $workspace -scheme PreloadedData -configuration $CONFIGURATION -destination 'name=Apple TV 1080p' build ${CODESIGN_PARAMS}" - exit 0 - ;; - - ###################################### - # Versioning - ###################################### - "get-version") - version_file="Realm/Realm-Info.plist" - echo "$(PlistBuddy -c "Print :CFBundleVersion" "$version_file")" - exit 0 - ;; - - "set-version") - realm_version="$2" - version_files="Realm/Realm-Info.plist" - - if [ -z "$realm_version" ]; then - echo "You must specify a version." - exit 1 - fi - for version_file in $version_files; do - PlistBuddy -c "Set :CFBundleVersion $realm_version" "$version_file" - PlistBuddy -c "Set :CFBundleShortVersionString $realm_version" "$version_file" - done - sed -i '' "s/^VERSION=.*/VERSION=$realm_version/" dependencies.list - exit 0 - ;; - - ###################################### - # Bitcode Detection - ###################################### - - "binary-has-bitcode") - BINARY="$2" - # Although grep has a '-q' flag to prevent logging to stdout, grep - # behaves differently when used, so redirect stdout to /dev/null. - if otool -l "$BINARY" | grep "segname __LLVM" > /dev/null 2>&1; then - exit 0 - fi - # Work around rdar://21826157 by checking for bitcode in thin binaries - - # Get architectures for binary - archs="$(lipo -info "$BINARY" | rev | cut -d ':' -f1 | rev)" - - archs_array=( $archs ) - if [[ ${#archs_array[@]} < 2 ]]; then - exit 1 # Early exit if not a fat binary - fi - - TEMPDIR=$(mktemp -d $TMPDIR/realm-bitcode-check.XXXX) - - for arch in $archs; do - lipo -thin "$arch" "$BINARY" -output "$TEMPDIR/$arch" - if otool -l "$TEMPDIR/$arch" | grep -q "segname __LLVM"; then - exit 0 - fi - done - exit 1 - ;; - - ###################################### - # CocoaPods - ###################################### - "cocoapods-setup") - if [ ! -d core ]; then - sh build.sh download-sync - rm core - mv sync-* core - fi - - if [[ "$2" != "swift" ]]; then - if [ ! -d Realm/ObjectStore/src ]; then - cat >&2 <&1 | tee build/build.log | xcpretty -r junit -o build/reports/junit.xml || failed=1 - if [ "$failed" = "1" ] && cat build/build.log | grep -E 'DTXProxyChannel|DTXChannel|out of date and needs to be rebuilt|operation never finished bootstrapping'; then - echo "Known Xcode error detected. Running job again." - failed=0 - sh build.sh verify-$target | tee build/build.log | xcpretty -r junit -o build/reports/junit.xml || failed=1 - elif [ "$failed" = "1" ] && tail ~/Library/Logs/CoreSimulator/CoreSimulator.log | grep -E "Operation not supported|Failed to lookup com.apple.coreservices.lsuseractivity.simulatorsupport"; then - echo "Known Xcode error detected. Running job again." - failed=0 - sh build.sh verify-$target | tee build/build.log | xcpretty -r junit -o build/reports/junit.xml || failed=1 - fi - if [ "$failed" = "1" ]; then - echo "\n\n***\nbuild/build.log\n***\n\n" && cat build/build.log - echo "\n\n***\nCoreSimulator.log\n***\n\n" && tail -n2000 ~/Library/Logs/CoreSimulator/CoreSimulator.log - exit 1 - fi - fi - - if [ "$target" = "osx" ] && [ "$configuration" = "Debug" ]; then - gcovr -r . -f ".*Realm.*" -e ".*Tests.*" -e ".*core.*" --xml > build/reports/coverage-report.xml - WS=$(pwd | sed "s/\//\\\\\//g") - sed -i ".bak" "s/\./${WS}/" build/reports/coverage-report.xml - fi - ;; - - ###################################### - # Release packaging - ###################################### - - "package-examples") - cd tightdb_objc - ./scripts/package_examples.rb - zip --symlinks -r realm-examples.zip examples -x "examples/installation/*" - ;; - - "package-test-examples") - if ! VERSION=$(echo realm-objc-*.zip | grep -o '\d*\.\d*\.\d*-[a-z]*'); then - VERSION=$(echo realm-objc-*.zip | grep -o '\d*\.\d*\.\d*') - fi - OBJC="realm-objc-${VERSION}" - SWIFT="realm-swift-${VERSION}" - unzip ${OBJC}.zip - - cp $0 ${OBJC} - cp -r ${source_root}/scripts ${OBJC} - cd ${OBJC} - sh build.sh examples-ios - sh build.sh examples-tvos - sh build.sh examples-osx - cd .. - rm -rf ${OBJC} - - unzip ${SWIFT}.zip - - cp $0 ${SWIFT} - cp -r ${source_root}/scripts ${SWIFT} - cd ${SWIFT} - sh build.sh examples-ios-swift - sh build.sh examples-tvos-swift - cd .. - rm -rf ${SWIFT} - ;; - - "package-ios-static") - cd tightdb_objc - - sh build.sh prelaunch-simulator - sh build.sh test-ios-static - sh build.sh ios-static - - cd build/ios-static - zip --symlinks -r realm-framework-ios.zip Realm.framework - ;; - - "package-ios-dynamic") - cd tightdb_objc - - sh build.sh prelaunch-simulator - sh build.sh ios-dynamic - cd build/ios - zip --symlinks -r realm-dynamic-framework-ios.zip Realm.framework - ;; - - "package-osx") - cd tightdb_objc - sh build.sh test-osx - - cd build/DerivedData/Realm/Build/Products/Release - zip --symlinks -r realm-framework-osx.zip Realm.framework - ;; - - "package-ios-swift") - cd tightdb_objc - for version in 3.0 3.0.1 3.0.2; do - REALM_SWIFT_VERSION="$version" sh build.sh prelaunch-simulator - REALM_SWIFT_VERSION="$version" sh build.sh ios-swift - done - - cd build/ios - zip --symlinks -r realm-swift-framework-ios.zip swift-3.0 swift-3.0.1 swift-3.0.2 - ;; - - "package-osx-swift") - cd tightdb_objc - for version in 3.0 3.0.1 3.0.2; do - REALM_SWIFT_VERSION="$version" sh build.sh prelaunch-simulator - REALM_SWIFT_VERSION="$version" sh build.sh osx-swift - done - - cd build/osx - zip --symlinks -r realm-swift-framework-osx.zip swift-3.0 swift-3.0.1 swift-3.0.2 - ;; - - "package-watchos") - cd tightdb_objc - sh build.sh watchos - - cd build/watchos - zip --symlinks -r realm-framework-watchos.zip Realm.framework - ;; - - "package-watchos-swift") - cd tightdb_objc - for version in 3.0 3.0.1 3.0.2; do - REALM_SWIFT_VERSION="$version" sh build.sh prelaunch-simulator - REALM_SWIFT_VERSION="$version" sh build.sh watchos-swift - done - - cd build/watchos - zip --symlinks -r realm-swift-framework-watchos.zip swift-3.0 swift-3.0.1 swift-3.0.2 - ;; - - "package-tvos") - cd tightdb_objc - sh build.sh tvos - - cd build/tvos - zip --symlinks -r realm-framework-tvos.zip Realm.framework - ;; - - "package-tvos-swift") - cd tightdb_objc - for version in 3.0 3.0.1 3.0.2; do - REALM_SWIFT_VERSION="$version" sh build.sh prelaunch-simulator - REALM_SWIFT_VERSION="$version" sh build.sh tvos-swift - done - - cd build/tvos - zip --symlinks -r realm-swift-framework-tvos.zip swift-3.0 swift-3.0.1 swift-3.0.2 - ;; - - "package-release") - LANG="$2" - TEMPDIR=$(mktemp -d $TMPDIR/realm-release-package-${LANG}.XXXX) - - cd tightdb_objc - VERSION=$(sh build.sh get-version) - cd .. - - FOLDER=${TEMPDIR}/realm-${LANG}-${VERSION} - - mkdir -p ${FOLDER}/osx ${FOLDER}/ios ${FOLDER}/watchos ${FOLDER}/tvos - - if [[ "${LANG}" == "objc" ]]; then - mkdir -p ${FOLDER}/ios/static - mkdir -p ${FOLDER}/ios/dynamic - mkdir -p ${FOLDER}/Swift - - ( - cd ${FOLDER}/osx - unzip ${WORKSPACE}/realm-framework-osx.zip - ) - - ( - cd ${FOLDER}/ios/static - unzip ${WORKSPACE}/realm-framework-ios.zip - ) - - ( - cd ${FOLDER}/ios/dynamic - unzip ${WORKSPACE}/realm-dynamic-framework-ios.zip - ) - - ( - cd ${FOLDER}/watchos - unzip ${WORKSPACE}/realm-framework-watchos.zip - ) - - ( - cd ${FOLDER}/tvos - unzip ${WORKSPACE}/realm-framework-tvos.zip - ) - else - ( - cd ${FOLDER}/osx - unzip ${WORKSPACE}/realm-swift-framework-osx.zip - ) - - ( - cd ${FOLDER}/ios - unzip ${WORKSPACE}/realm-swift-framework-ios.zip - ) - - ( - cd ${FOLDER}/watchos - unzip ${WORKSPACE}/realm-swift-framework-watchos.zip - ) - - ( - cd ${FOLDER}/tvos - unzip ${WORKSPACE}/realm-swift-framework-tvos.zip - ) - fi - - ( - cd ${WORKSPACE}/tightdb_objc - cp -R plugin ${FOLDER} - cp LICENSE ${FOLDER}/LICENSE.txt - if [[ "${LANG}" == "objc" ]]; then - cp Realm/Swift/RLMSupport.swift ${FOLDER}/Swift/ - fi - ) - - ( - cd ${FOLDER} - unzip ${WORKSPACE}/realm-examples.zip - cd examples - if [[ "${LANG}" == "objc" ]]; then - rm -rf ios/swift-* tvos/swift-* - else - rm -rf ios/objc ios/rubymotion osx tvos/objc - fi - ) - - cat > ${FOLDER}/docs.webloc < - - - - URL - https://realm.io/docs/${LANG}/${VERSION} - - -EOF - - ( - cd ${TEMPDIR} - zip --symlinks -r realm-${LANG}-${VERSION}.zip realm-${LANG}-${VERSION} - mv realm-${LANG}-${VERSION}.zip ${WORKSPACE} - ) - ;; - - "test-package-release") - # Generate a release package locally for testing purposes - # Real releases should always be done via Jenkins - if [ -z "${WORKSPACE}" ]; then - echo 'WORKSPACE must be set to a directory to assemble the release in' - exit 1 - fi - if [ -d "${WORKSPACE}" ]; then - echo 'WORKSPACE directory should not already exist' - exit 1 - fi - - REALM_SOURCE="$(pwd)" - mkdir -p "$WORKSPACE" - WORKSPACE="$(cd "$WORKSPACE" && pwd)" - export WORKSPACE - cd $WORKSPACE - git clone --recursive $REALM_SOURCE tightdb_objc - - echo 'Packaging iOS' - sh tightdb_objc/build.sh package-ios-static - cp tightdb_objc/build/ios-static/realm-framework-ios.zip . - sh tightdb_objc/build.sh package-ios-dynamic - cp tightdb_objc/build/ios/realm-dynamic-framework-ios.zip . - sh tightdb_objc/build.sh package-ios-swift - cp tightdb_objc/build/ios/realm-swift-framework-ios.zip . - - echo 'Packaging OS X' - sh tightdb_objc/build.sh package-osx - cp tightdb_objc/build/DerivedData/Realm/Build/Products/Release/realm-framework-osx.zip . - sh tightdb_objc/build.sh package-osx-swift - cp tightdb_objc/build/osx/realm-swift-framework-osx.zip . - - echo 'Packaging watchOS' - sh tightdb_objc/build.sh package-watchos - cp tightdb_objc/build/watchos/realm-framework-watchos.zip . - sh tightdb_objc/build.sh package-watchos-swift - cp tightdb_objc/build/watchos/realm-swift-framework-watchos.zip . - - echo 'Packaging tvOS' - sh tightdb_objc/build.sh package-tvos - cp tightdb_objc/build/tvos/realm-framework-tvos.zip . - sh tightdb_objc/build.sh package-tvos-swift - cp tightdb_objc/build/tvos/realm-swift-framework-tvos.zip . - - echo 'Packaging examples' - sh tightdb_objc/build.sh package-examples - cp tightdb_objc/realm-examples.zip . - - echo 'Building final release packages' - sh tightdb_objc/build.sh package-release objc - sh tightdb_objc/build.sh package-release swift - - echo 'Testing packaged examples' - sh tightdb_objc/build.sh package-test-examples - ;; - - "github-release") - if [ -z "${GITHUB_ACCESS_TOKEN}" ]; then - echo 'GITHUB_ACCESS_TOKEN must be set to create GitHub releases' - exit 1 - fi - ./scripts/github_release.rb - ;; - - "add-empty-changelog") - empty_section=$(cat < CHANGELOG.md - echo >> CHANGELOG.md - echo "$changelog" >> CHANGELOG.md - ;; - - *) - echo "Unknown command '$COMMAND'" - usage - exit 1 - ;; -esac diff --git a/Pods/Realm/core/librealm-ios.a b/Pods/Realm/core/librealm-ios.a deleted file mode 100644 index 8e60d7ce..00000000 Binary files a/Pods/Realm/core/librealm-ios.a and /dev/null differ diff --git a/Pods/Realm/include/NSError+RLMSync.h b/Pods/Realm/include/NSError+RLMSync.h deleted file mode 100644 index ae08d8f5..00000000 --- a/Pods/Realm/include/NSError+RLMSync.h +++ /dev/null @@ -1,43 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2017 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -NS_ASSUME_NONNULL_BEGIN - -/// NSError category extension providing methods to get data out of Realm's -/// "client reset" error. -@interface NSError (RLMSync) - -/** - Given a Realm Object Server client reset error, return the block that can - be called to manually initiate the client reset process, or nil if the - error isn't a client reset error. - */ -- (nullable void(^)(void))rlmSync_clientResetBlock NS_REFINED_FOR_SWIFT; - -/** - Given a Realm Object Server client reset error, return the path where the - backup copy of the Realm will be placed once the client reset process is - complete. - */ -- (nullable NSString *)rlmSync_clientResetBackedUpRealmPath NS_SWIFT_UNAVAILABLE(""); - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMAccessor.h b/Pods/Realm/include/RLMAccessor.h deleted file mode 100644 index f70039b9..00000000 --- a/Pods/Realm/include/RLMAccessor.h +++ /dev/null @@ -1,63 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - - -@class RLMObjectSchema, RLMProperty, RLMObjectBase, RLMProperty; - -#ifdef __cplusplus -typedef NSUInteger RLMCreationOptions; -#else -typedef NS_OPTIONS(NSUInteger, RLMCreationOptions); -#endif - -NS_ASSUME_NONNULL_BEGIN - -// -// Accessors Class Creation/Caching -// - -// get accessor classes for an object class - generates classes if not cached -Class RLMAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema, NSString *prefix); -Class RLMUnmanagedAccessorClassForObjectClass(Class objectClass, RLMObjectSchema *schema); - -// Check if a given class is a generated accessor class -bool RLMIsGeneratedClass(Class cls); - -// -// Dynamic getters/setters -// -FOUNDATION_EXTERN void RLMDynamicValidatedSet(RLMObjectBase *obj, NSString *propName, id __nullable val); -FOUNDATION_EXTERN id __nullable RLMDynamicGet(RLMObjectBase *obj, RLMProperty *prop); -FOUNDATION_EXTERN id __nullable RLMDynamicGetByName(RLMObjectBase *obj, NSString *propName, bool asList); - -// by property/column -void RLMDynamicSet(RLMObjectBase *obj, RLMProperty *prop, id val, RLMCreationOptions options); - -// -// Class modification -// - -// Replace className method for the given class -void RLMReplaceClassNameMethod(Class accessorClass, NSString *className); - -// Replace sharedSchema method for the given class -void RLMReplaceSharedSchemaMethod(Class accessorClass, RLMObjectSchema * __nullable schema); - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMAnalytics.hpp b/Pods/Realm/include/RLMAnalytics.hpp deleted file mode 100644 index 76bc4294..00000000 --- a/Pods/Realm/include/RLMAnalytics.hpp +++ /dev/null @@ -1,55 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -// Asynchronously submits build information to Realm if running in an iOS -// simulator or on OS X if a debugger is attached. Does nothing if running on an -// iOS / watchOS device or if a debugger is *not* attached. -// -// To be clear: this does *not* run when your app is in production or on -// your end-user’s devices; it will only run in the simulator or when a debugger -// is attached. -// -// Why are we doing this? In short, because it helps us build a better product -// for you. None of the data personally identifies you, your employer or your -// app, but it *will* help us understand what language you use, what iOS -// versions you target, etc. Having this info will help prioritizing our time, -// adding new features and deprecating old features. Collecting an anonymized -// bundle & anonymized MAC is the only way for us to count actual usage of the -// other metrics accurately. If we don’t have a way to deduplicate the info -// reported, it will be useless, as a single developer building their Swift app -// 10 times would report 10 times more than a single Objective-C developer that -// only builds once, making the data all but useless. -// No one likes sharing data unless it’s necessary, we get it, and we’ve -// debated adding this for a long long time. Since Realm is a free product -// without an email signup, we feel this is a necessary step so we can collect -// relevant data to build a better product for you. If you truly, absolutely -// feel compelled to not send this data back to Realm, then you can set an env -// variable named REALM_DISABLE_ANALYTICS. Since Realm is free we believe -// letting these analytics run is a small price to pay for the product & support -// we give you. -// -// Currently the following information is reported: -// - What version of Realm is being used, and from which language (obj-c or Swift). -// - What version of OS X it's running on (in case Xcode aggressively drops -// support for older versions again, we need to know what we need to support). -// - The minimum iOS/OS X version that the application is targeting (again, to -// help us decide what versions we need to support). -// - An anonymous MAC address and bundle ID to aggregate the other information on. -// - What version of Swift is being used (if applicable). - -void RLMSendAnalytics(); diff --git a/Pods/Realm/include/RLMArray.h b/Pods/Realm/include/RLMArray.h deleted file mode 100644 index c6c4e966..00000000 --- a/Pods/Realm/include/RLMArray.h +++ /dev/null @@ -1,380 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RLMObject, RLMRealm, RLMResults, RLMNotificationToken; - -/** - `RLMArray` is the container type in Realm used to define to-many relationships. - - Unlike an `NSArray`, `RLMArray`s hold a single type, specified by the `objectClassName` property. - This is referred to in these docs as the “type” of the array. - - When declaring an `RLMArray` property, the type must be marked as conforming to a - protocol by the same name as the objects it should contain (see the - `RLM_ARRAY_TYPE` macro). In addition, the property can be declared using Objective-C - generics for better compile-time type safety. - - RLM_ARRAY_TYPE(ObjectType) - ... - @property RLMArray *arrayOfObjectTypes; - - `RLMArray`s can be queried with the same predicates as `RLMObject` and `RLMResult`s. - - `RLMArray`s cannot be created directly. `RLMArray` properties on `RLMObject`s are - lazily created when accessed, or can be obtained by querying a Realm. - - ### Key-Value Observing - - `RLMArray` supports array key-value observing on `RLMArray` properties on `RLMObject` - subclasses, and the `invalidated` property on `RLMArray` instances themselves is - key-value observing compliant when the `RLMArray` is attached to a managed - `RLMObject` (`RLMArray`s on unmanaged `RLMObject`s will never become invalidated). - - Because `RLMArray`s are attached to the object which they are a property of, they - do not require using the mutable collection proxy objects from - `-mutableArrayValueForKey:` or KVC-compatible mutation methods on the containing - object. Instead, you can call the mutation methods on the `RLMArray` directly. - */ - -@interface RLMArray : NSObject - -#pragma mark - Properties - -/** - The number of objects in the array. - */ -@property (nonatomic, readonly, assign) NSUInteger count; - -/** - The class name (i.e. type) of the `RLMObject`s contained in the array. - */ -@property (nonatomic, readonly, copy) NSString *objectClassName; - -/** - The Realm which manages the array. Returns `nil` for unmanaged arrays. - */ -@property (nonatomic, readonly, nullable) RLMRealm *realm; - -/** - Indicates if the array can no longer be accessed. - */ -@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated; - -#pragma mark - Accessing Objects from an Array - -/** - Returns the object at the index specified. - - @param index The index to look up. - - @return An `RLMObject` of the type contained in the array. - */ -- (RLMObjectType)objectAtIndex:(NSUInteger)index; - -/** - Returns the first object in the array. - - Returns `nil` if called on an empty array. - - @return An `RLMObject` of the type contained in the array. - */ -- (nullable RLMObjectType)firstObject; - -/** - Returns the last object in the array. - - Returns `nil` if called on an empty array. - - @return An `RLMObject` of the type contained in the array. - */ -- (nullable RLMObjectType)lastObject; - - - -#pragma mark - Adding, Removing, and Replacing Objects in an Array - -/** - Adds an object to the end of the array. - - @warning This method may only be called during a write transaction. - - @param object An `RLMObject` of the type contained in the array. - */ -- (void)addObject:(RLMObjectType)object; - -/** - Adds an array of objects to the end of the array. - - @warning This method may only be called during a write transaction. - - @param objects An enumerable object such as `NSArray` or `RLMResults` which contains objects of the - same class as the array. - */ -- (void)addObjects:(id)objects; - -/** - Inserts an object at the given index. - - Throws an exception if the index exceeds the bounds of the array. - - @warning This method may only be called during a write transaction. - - @param anObject An `RLMObject` of the type contained in the array. - @param index The index at which to insert the object. - */ -- (void)insertObject:(RLMObjectType)anObject atIndex:(NSUInteger)index; - -/** - Removes an object at the given index. - - Throws an exception if the index exceeds the bounds of the array. - - @warning This method may only be called during a write transaction. - - @param index The array index identifying the object to be removed. - */ -- (void)removeObjectAtIndex:(NSUInteger)index; - -/** - Removes the last object in the array. - - @warning This method may only be called during a write transaction. -*/ -- (void)removeLastObject; - -/** - Removes all objects from the array. - - @warning This method may only be called during a write transaction. - */ -- (void)removeAllObjects; - -/** - Replaces an object at the given index with a new object. - - Throws an exception if the index exceeds the bounds of the array. - - @warning This method may only be called during a write transaction. - - @param index The index of the object to be replaced. - @param anObject An object (of the same type as returned from the `objectClassName` selector). - */ -- (void)replaceObjectAtIndex:(NSUInteger)index withObject:(RLMObjectType)anObject; - -/** - Moves the object at the given source index to the given destination index. - - Throws an exception if the index exceeds the bounds of the array. - - @warning This method may only be called during a write transaction. - - @param sourceIndex The index of the object to be moved. - @param destinationIndex The index to which the object at `sourceIndex` should be moved. - */ -- (void)moveObjectAtIndex:(NSUInteger)sourceIndex toIndex:(NSUInteger)destinationIndex; - -/** - Exchanges the objects in the array at given indices. - - Throws an exception if either index exceeds the bounds of the array. - - @warning This method may only be called during a write transaction. - - @param index1 The index of the object which should replace the object at index `index2`. - @param index2 The index of the object which should replace the object at index `index1`. - */ -- (void)exchangeObjectAtIndex:(NSUInteger)index1 withObjectAtIndex:(NSUInteger)index2; - -#pragma mark - Querying an Array - -/** - Returns the index of an object in the array. - - Returns `NSNotFound` if the object is not found in the array. - - @param object An object (of the same type as returned from the `objectClassName` selector). - */ -- (NSUInteger)indexOfObject:(RLMObjectType)object; - -/** - Returns the index of the first object in the array matching the predicate. - - @param predicateFormat A predicate format string, optionally followed by a variable number of arguments. - - @return The index of the object, or `NSNotFound` if the object is not found in the array. - */ -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...; - -/// :nodoc: -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args; - -/** - Returns the index of the first object in the array matching the predicate. - - @param predicate The predicate with which to filter the objects. - - @return The index of the object, or `NSNotFound` if the object is not found in the array. - */ -- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate; - -/** - Returns all the objects matching the given predicate in the array. - - @param predicateFormat A predicate format string, optionally followed by a variable number of arguments. - - @return An `RLMResults` of objects that match the given predicate. - */ -- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...; - -/// :nodoc: -- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args; - -/** - Returns all the objects matching the given predicate in the array. - - @param predicate The predicate with which to filter the objects. - - @return An `RLMResults` of objects that match the given predicate - */ -- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate; - -/** - Returns a sorted `RLMResults` from the array. - - @param keyPath The key path to sort by. - @param ascending The direction to sort in. - - @return An `RLMResults` sorted by the specified key path. - */ -- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending; - -/** - Returns a sorted `RLMResults` from the array. - - @param property The property name to sort by. - @param ascending The direction to sort in. - - @return An `RLMResults` sorted by the specified property. - */ -- (RLMResults *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascending - __deprecated_msg("Use `-sortedResultsUsingKeyPath:ascending:`"); - -/** - Returns a sorted `RLMResults` from the array. - - @param properties An array of `RLMSortDescriptor`s to sort by. - - @return An `RLMResults` sorted by the specified properties. - */ -- (RLMResults *)sortedResultsUsingDescriptors:(NSArray *)properties; - -/// :nodoc: -- (RLMObjectType)objectAtIndexedSubscript:(NSUInteger)index; - -/// :nodoc: -- (void)setObject:(RLMObjectType)newValue atIndexedSubscript:(NSUInteger)index; - -#pragma mark - Notifications - -/** - Registers a block to be called each time the array changes. - - The block will be asynchronously called with the initial array, and then - called again after each write transaction which changes any of the objects in - the array, which objects are in the results, or the order of the objects in the - array. - - The `changes` parameter will be `nil` the first time the block is called. - For each call after that, it will contain information about - which rows in the array were added, removed or modified. If a write transaction - did not modify any objects in the array, the block is not called at all. - See the `RLMCollectionChange` documentation for information on how the changes - are reported and an example of updating a `UITableView`. - - If an error occurs the block will be called with `nil` for the results - parameter and a non-`nil` error. Currently the only errors that can occur are - when opening the Realm on the background worker thread. - - Notifications are delivered via the standard run loop, and so can't be - delivered while the run loop is blocked by other activity. When - notifications can't be delivered instantly, multiple notifications may be - coalesced into a single notification. This can include the notification - with the initial results. For example, the following code performs a write - transaction immediately after adding the notification block, so there is no - opportunity for the initial notification to be delivered first. As a - result, the initial notification will reflect the state of the Realm after - the write transaction. - - Person *person = [[Person allObjectsInRealm:realm] firstObject]; - NSLog(@"person.dogs.count: %zu", person.dogs.count); // => 0 - self.token = [person.dogs addNotificationBlock(RLMArray *dogs, - RLMCollectionChange *changes, - NSError *error) { - // Only fired once for the example - NSLog(@"dogs.count: %zu", dogs.count) // => 1 - }]; - [realm transactionWithBlock:^{ - Dog *dog = [[Dog alloc] init]; - dog.name = @"Rex"; - [person.dogs addObject:dog]; - }]; - // end of run loop execution context - - You must retain the returned token for as long as you want updates to continue - to be sent to the block. To stop receiving updates, call `-stop` on the token. - - @warning This method cannot be called during a write transaction, or when the - containing Realm is read-only. - @warning This method may only be called on a managed array. - - @param block The block to be called each time the array changes. - @return A token which must be held for as long as you want updates to be delivered. - */ -- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMArray *__nullable array, - RLMCollectionChange *__nullable changes, - NSError *__nullable error))block __attribute__((warn_unused_result)); - -#pragma mark - Unavailable Methods - -/** - `-[RLMArray init]` is not available because `RLMArray`s cannot be created directly. - `RLMArray` properties on `RLMObject`s are lazily created when accessed, or can be obtained by querying a Realm. - */ -- (instancetype)init __attribute__((unavailable("RLMArrays cannot be created directly"))); - -/** - `+[RLMArray new]` is not available because `RLMArray`s cannot be created directly. - `RLMArray` properties on `RLMObject`s are lazily created when accessed, or can be obtained by querying a Realm. - */ -+ (instancetype)new __attribute__((unavailable("RLMArrays cannot be created directly"))); - -@end - -/// :nodoc: -@interface RLMArray (Swift) -// for use only in Swift class definitions -- (instancetype)initWithObjectClassName:(NSString *)objectClassName; -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMArray_Private.h b/Pods/Realm/include/RLMArray_Private.h deleted file mode 100644 index 5e15e2d0..00000000 --- a/Pods/Realm/include/RLMArray_Private.h +++ /dev/null @@ -1,28 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMArray () -- (instancetype)initWithObjectClassName:(NSString *)objectClassName; -- (NSString *)descriptionWithMaxDepth:(NSUInteger)depth; -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMArray_Private.hpp b/Pods/Realm/include/RLMArray_Private.hpp deleted file mode 100644 index 5db9abe9..00000000 --- a/Pods/Realm/include/RLMArray_Private.hpp +++ /dev/null @@ -1,70 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMArray_Private.h" - -#import "RLMCollection_Private.hpp" - -#import - -#import - -namespace realm { - class Results; -} - -@class RLMObjectBase, RLMObjectSchema, RLMProperty; -class RLMClassInfo; -class RLMObservationInfo; - -@interface RLMArray () { -@protected - NSString *_objectClassName; -@public - // The name of the property which this RLMArray represents - NSString *_key; - __weak RLMObjectBase *_parentObject; -} -@end - -// -// LinkView backed RLMArray subclass -// -@interface RLMArrayLinkView : RLMArray -- (instancetype)initWithParent:(RLMObjectBase *)parentObject property:(RLMProperty *)property; - -// deletes all objects in the RLMArray from their containing realms -- (void)deleteObjectsFromRealm; -@end - -void RLMValidateArrayObservationKey(NSString *keyPath, RLMArray *array); - -// Initialize the observation info for an array if needed -void RLMEnsureArrayObservationInfo(std::unique_ptr& info, - NSString *keyPath, RLMArray *array, id observed); - - -// -// RLMResults private methods -// -@interface RLMResults () -+ (instancetype)resultsWithObjectInfo:(RLMClassInfo&)info - results:(realm::Results)results; - -- (void)deleteObjectsFromRealm; -@end diff --git a/Pods/Realm/include/RLMAuthResponseModel.h b/Pods/Realm/include/RLMAuthResponseModel.h deleted file mode 100644 index 0cbf68ea..00000000 --- a/Pods/Realm/include/RLMAuthResponseModel.h +++ /dev/null @@ -1,52 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -/** - An internal class representing a valid JSON response to an auth request. - - ``` - { - "access_token": { ... } // (optional), - "refresh_token": { ... } // (optional) - } - ``` - */ -@class RLMTokenModel; - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMAuthResponseModel : NSObject - -@property (nonatomic, readonly, nullable) RLMTokenModel *accessToken; -@property (nonatomic, readonly, nullable) RLMTokenModel *refreshToken; - -- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary - requireAccessToken:(BOOL)requireAccessToken - requireRefreshToken:(BOOL)requireRefreshToken; - -/// :nodoc: -- (instancetype)init __attribute__((unavailable("RLMTokenModel cannot be created directly"))); - -/// :nodoc: -+ (instancetype)new __attribute__((unavailable("RLMTokenModel cannot be created directly"))); - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMClassInfo.hpp b/Pods/Realm/include/RLMClassInfo.hpp deleted file mode 100644 index ea4610aa..00000000 --- a/Pods/Realm/include/RLMClassInfo.hpp +++ /dev/null @@ -1,107 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import -#import - -namespace realm { - class ObjectSchema; - class Schema; - class Table; - struct Property; -} - -class RLMObservationInfo; -@class RLMRealm, RLMSchema, RLMObjectSchema, RLMProperty; - -NS_ASSUME_NONNULL_BEGIN - -namespace std { -// Add specializations so that NSString can be used as the key for hash containers -template<> struct hash { - size_t operator()(__unsafe_unretained NSString *const str) const { - return [str hash]; - } -}; -template<> struct equal_to { - bool operator()(__unsafe_unretained NSString * lhs, __unsafe_unretained NSString *rhs) const { - return [lhs isEqualToString:rhs]; - } -}; -} - -// The per-RLMRealm object schema information which stores the cached table -// reference, handles table column lookups, and tracks observed objects -class RLMClassInfo { -public: - RLMClassInfo(RLMRealm *, RLMObjectSchema *, const realm::ObjectSchema *); - - __unsafe_unretained RLMRealm *const realm; - __unsafe_unretained RLMObjectSchema *const rlmObjectSchema; - const realm::ObjectSchema *const objectSchema; - - // Storage for the functionality in RLMObservation for handling indirect - // changes to KVO-observed things - std::vector observedObjects; - - // Get the table for this object type. Will return nullptr only if it's a - // read-only Realm that is missing the table entirely. - realm::Table *_Nullable table() const; - - // Get the RLMProperty for a given table column, or `nil` if it is a column - // not used by the current schema - RLMProperty *_Nullable propertyForTableColumn(NSUInteger) const noexcept; - - // Get the RLMProperty that's used as the primary key, or `nil` if there is - // no primary key for the current schema - RLMProperty *_Nullable propertyForPrimaryKey() const noexcept; - - // Get the table column for the given property. The property must be a valid - // persisted property. - NSUInteger tableColumn(NSString *propertyName) const; - NSUInteger tableColumn(RLMProperty *property) const; - - RLMClassInfo &linkTargetType(size_t index); - - void releaseTable() { m_table = nullptr; } - -private: - mutable realm::Table *_Nullable m_table = nullptr; - std::vector m_linkTargets; -}; - -// A per-RLMRealm object schema map which stores RLMClassInfo keyed on the name -class RLMSchemaInfo { - using impl = std::unordered_map; -public: - RLMSchemaInfo() = default; - RLMSchemaInfo(RLMRealm *realm, RLMSchema *rlmSchema, realm::Schema const& schema); - - // Look up by name, throwing if it's not present - RLMClassInfo& operator[](NSString *name); - - impl::iterator begin() noexcept; - impl::iterator end() noexcept; - impl::const_iterator begin() const noexcept; - impl::const_iterator end() const noexcept; -private: - std::unordered_map m_objects; -}; - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMCollection.h b/Pods/Realm/include/RLMCollection.h deleted file mode 100644 index 4a66053c..00000000 --- a/Pods/Realm/include/RLMCollection.h +++ /dev/null @@ -1,351 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import "RLMThreadSafeReference.h" - -NS_ASSUME_NONNULL_BEGIN - -@class RLMRealm, RLMResults, RLMObject, RLMSortDescriptor, RLMNotificationToken, RLMCollectionChange; - -/** - A homogenous collection of `RLMObject` instances. Examples of conforming types include `RLMArray`, - `RLMResults`, and `RLMLinkingObjects`. - */ -@protocol RLMCollection - -@required - -#pragma mark - Properties - -/** - The number of objects in the collection. - */ -@property (nonatomic, readonly, assign) NSUInteger count; - -/** - The class name (i.e. type) of the `RLMObject`s contained in the collection. - */ -@property (nonatomic, readonly, copy) NSString *objectClassName; - -/** - The Realm which manages the collection, or `nil` for unmanaged collections. - */ -@property (nonatomic, readonly) RLMRealm *realm; - -#pragma mark - Accessing Objects from a Collection - -/** - Returns the object at the index specified. - - @param index The index to look up. - - @return An `RLMObject` of the type contained in the collection. - */ -- (id)objectAtIndex:(NSUInteger)index; - -/** - Returns the first object in the collection. - - Returns `nil` if called on an empty collection. - - @return An `RLMObject` of the type contained in the collection. - */ -- (nullable id)firstObject; - -/** - Returns the last object in the collection. - - Returns `nil` if called on an empty collection. - - @return An `RLMObject` of the type contained in the collection. - */ -- (nullable id)lastObject; - -#pragma mark - Querying a Collection - -/** - Returns the index of an object in the collection. - - Returns `NSNotFound` if the object is not found in the collection. - - @param object An object (of the same type as returned from the `objectClassName` selector). - */ -- (NSUInteger)indexOfObject:(RLMObject *)object; - -/** - Returns the index of the first object in the collection matching the predicate. - - @param predicateFormat A predicate format string, optionally followed by a variable number of arguments. - - @return The index of the object, or `NSNotFound` if the object is not found in the collection. - */ -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...; - -/// :nodoc: -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args; - -/** - Returns the index of the first object in the collection matching the predicate. - - @param predicate The predicate with which to filter the objects. - - @return The index of the object, or `NSNotFound` if the object is not found in the collection. - */ -- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate; - -/** - Returns all objects matching the given predicate in the collection. - - @param predicateFormat A predicate format string, optionally followed by a variable number of arguments. - - @return An `RLMResults` containing objects that match the given predicate. - */ -- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...; - -/// :nodoc: -- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args; - -/** - Returns all objects matching the given predicate in the collection. - - @param predicate The predicate with which to filter the objects. - - @return An `RLMResults` containing objects that match the given predicate. - */ -- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate; - -/** - Returns a sorted `RLMResults` from the collection. - - @param keyPath The keyPath to sort by. - @param ascending The direction to sort in. - - @return An `RLMResults` sorted by the specified key path. - */ -- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending; - -/** - Returns a sorted `RLMResults` from the collection. - - @param property The property name to sort by. - @param ascending The direction to sort in. - - @return An `RLMResults` sorted by the specified property. - */ -- (RLMResults *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascending - __deprecated_msg("Use `-sortedResultsUsingKeyPath:ascending:`"); - -/** - Returns a sorted `RLMResults` from the collection. - - @param properties An array of `RLMSortDescriptor`s to sort by. - - @return An `RLMResults` sorted by the specified properties. - */ -- (RLMResults *)sortedResultsUsingDescriptors:(NSArray *)properties; - -/// :nodoc: -- (id)objectAtIndexedSubscript:(NSUInteger)index; - -/** - Returns an `NSArray` containing the results of invoking `valueForKey:` using `key` on each of the collection's objects. - - @param key The name of the property. - - @return An `NSArray` containing results. - */ -- (nullable id)valueForKey:(NSString *)key; - -/** - Invokes `setValue:forKey:` on each of the collection's objects using the specified `value` and `key`. - - @warning This method may only be called during a write transaction. - - @param value The object value. - @param key The name of the property. - */ -- (void)setValue:(nullable id)value forKey:(NSString *)key; - -#pragma mark - Notifications - -/** - Registers a block to be called each time the collection changes. - - The block will be asynchronously called with the initial collection, and then - called again after each write transaction which changes either any of the - objects in the collection, or which objects are in the collection. - - The `change` parameter will be `nil` the first time the block is called. - For each call after that, it will contain information about - which rows in the collection were added, removed or modified. If a write transaction - did not modify any objects in this collection, the block is not called at all. - See the `RLMCollectionChange` documentation for information on how the changes - are reported and an example of updating a `UITableView`. - - If an error occurs the block will be called with `nil` for the collection - parameter and a non-`nil` error. Currently the only errors that can occur are - when opening the Realm on the background worker thread. - - At the time when the block is called, the collection object will be fully - evaluated and up-to-date, and as long as you do not perform a write transaction - on the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will - never perform blocking work. - - Notifications are delivered via the standard run loop, and so can't be - delivered while the run loop is blocked by other activity. When - notifications can't be delivered instantly, multiple notifications may be - coalesced into a single notification. This can include the notification - with the initial collection. For example, the following code performs a write - transaction immediately after adding the notification block, so there is no - opportunity for the initial notification to be delivered first. As a - result, the initial notification will reflect the state of the Realm after - the write transaction. - - id collection = [Dog allObjects]; - NSLog(@"dogs.count: %zu", dogs.count); // => 0 - self.token = [collection addNotificationBlock:^(id dogs, - RLMCollectionChange *changes, - NSError *error) { - // Only fired once for the example - NSLog(@"dogs.count: %zu", dogs.count); // => 1 - }]; - [realm transactionWithBlock:^{ - Dog *dog = [[Dog alloc] init]; - dog.name = @"Rex"; - [realm addObject:dog]; - }]; - // end of run loop execution context - - You must retain the returned token for as long as you want updates to continue - to be sent to the block. To stop receiving updates, call `-stop` on the token. - - @warning This method cannot be called during a write transaction, or when the - containing Realm is read-only. - - @param block The block to be called each time the collection changes. - @return A token which must be held for as long as you want collection notifications to be delivered. - */ -- (RLMNotificationToken *)addNotificationBlock:(void (^)(id __nullable collection, - RLMCollectionChange *__nullable change, - NSError *__nullable error))block __attribute__((warn_unused_result)); - -@end - -/** - An `RLMSortDescriptor` stores a property name and a sort order for use with - `sortedResultsUsingDescriptors:`. It is similar to `NSSortDescriptor`, but supports - only the subset of functionality which can be efficiently run by Realm's query - engine. - - `RLMSortDescriptor` instances are immutable. - */ -@interface RLMSortDescriptor : NSObject - -#pragma mark - Properties - -/** - The key path which the sort descriptor orders results by. - */ -@property (nonatomic, readonly) NSString *keyPath; - -/** - Whether the descriptor sorts in ascending or descending order. - */ -@property (nonatomic, readonly) BOOL ascending; - -#pragma mark - Methods - -/** - Returns a new sort descriptor for the given key path and sort direction. - */ -+ (instancetype)sortDescriptorWithKeyPath:(NSString *)keyPath ascending:(BOOL)ascending; - -/** - Returns a copy of the receiver with the sort direction reversed. - */ -- (instancetype)reversedSortDescriptor; - -#pragma mark - Deprecated - -/** - The name of the property which the sort descriptor orders results by. - */ -@property (nonatomic, readonly) NSString *property __deprecated_msg("Use `-keyPath`"); - -/** - Returns a new sort descriptor for the given property name and sort direction. - */ -+ (instancetype)sortDescriptorWithProperty:(NSString *)propertyName ascending:(BOOL)ascending - __deprecated_msg("Use `+sortDescriptorWithKeyPath:ascending:`"); - -@end - -/** - A `RLMCollectionChange` object encapsulates information about changes to collections - that are reported by Realm notifications. - - `RLMCollectionChange` is passed to the notification blocks registered with - `-addNotificationBlock` on `RLMArray` and `RLMResults`, and reports what rows in the - collection changed since the last time the notification block was called. - - The change information is available in two formats: a simple array of row - indices in the collection for each type of change, and an array of index paths - in a requested section suitable for passing directly to `UITableView`'s batch - update methods. A complete example of updating a `UITableView` named `tv`: - - [tv beginUpdates]; - [tv deleteRowsAtIndexPaths:[changes deletionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic]; - [tv insertRowsAtIndexPaths:[changes insertionsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic]; - [tv reloadRowsAtIndexPaths:[changes modificationsInSection:0] withRowAnimation:UITableViewRowAnimationAutomatic]; - [tv endUpdates]; - - All of the arrays in an `RLMCollectionChange` are always sorted in ascending order. - */ -@interface RLMCollectionChange : NSObject -/// The indices of objects in the previous version of the collection which have -/// been removed from this one. -@property (nonatomic, readonly) NSArray *deletions; - -/// The indices in the new version of the collection which were newly inserted. -@property (nonatomic, readonly) NSArray *insertions; - -/** - The indices in the new version of the collection which were modified. - - For `RLMResults`, this means that one or more of the properties of the object at - that index were modified (or an object linked to by that object was - modified). - - For `RLMArray`, the array itself being modified to contain a - different object at that index will also be reported as a modification. - */ -@property (nonatomic, readonly) NSArray *modifications; - -/// Returns the index paths of the deletion indices in the given section. -- (NSArray *)deletionsInSection:(NSUInteger)section; - -/// Returns the index paths of the insertion indices in the given section. -- (NSArray *)insertionsInSection:(NSUInteger)section; - -/// Returns the index paths of the modification indices in the given section. -- (NSArray *)modificationsInSection:(NSUInteger)section; -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMCollection_Private.hpp b/Pods/Realm/include/RLMCollection_Private.hpp deleted file mode 100644 index 9f58c976..00000000 --- a/Pods/Realm/include/RLMCollection_Private.hpp +++ /dev/null @@ -1,77 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import - -namespace realm { - class List; - class Results; - class TableView; - struct CollectionChangeSet; - struct NotificationToken; -} -class RLMClassInfo; - -@protocol RLMFastEnumerable -@property (nonatomic, readonly) RLMRealm *realm; -@property (nonatomic, readonly) RLMClassInfo *objectInfo; -@property (nonatomic, readonly) NSUInteger count; - -- (NSUInteger)indexInSource:(NSUInteger)index; -- (realm::TableView)tableView; -@end - -// An object which encapulates the shared logic for fast-enumerating RLMArray -// and RLMResults, and has a buffer to store strong references to the current -// set of enumerated items -@interface RLMFastEnumerator : NSObject -- (instancetype)initWithCollection:(id)collection - objectSchema:(RLMClassInfo&)objectSchema; - -// Detach this enumerator from the source collection. Must be called before the -// source collection is changed. -- (void)detach; - -- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state - count:(NSUInteger)len; -@end - -@interface RLMNotificationToken () -- (void)suppressNextNotification; -- (RLMRealm *)realm; -@end - -@interface RLMCancellationToken : RLMNotificationToken -- (instancetype)initWithToken:(realm::NotificationToken)token realm:(RLMRealm *)realm; -@end - -@interface RLMCollectionChange () -- (instancetype)initWithChanges:(realm::CollectionChangeSet)indices; -@end - -template -RLMNotificationToken *RLMAddNotificationBlock(id objcCollection, - Collection& collection, - void (^block)(id, RLMCollectionChange *, NSError *), - bool suppressInitialChange=false); - -NSArray *RLMCollectionValueForKey(id collection, NSString *key); -void RLMCollectionSetValueForKey(id collection, NSString *key, id value); -NSString *RLMDescriptionWithMaxDepth(NSString *name, id collection, NSUInteger depth); diff --git a/Pods/Realm/include/RLMConstants.h b/Pods/Realm/include/RLMConstants.h deleted file mode 100644 index bf3b2e78..00000000 --- a/Pods/Realm/include/RLMConstants.h +++ /dev/null @@ -1,204 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -NS_ASSUME_NONNULL_BEGIN - -// For compatibility with Xcode 7, before extensible string enums were introduced, -#ifdef NS_EXTENSIBLE_STRING_ENUM -#define RLM_EXTENSIBLE_STRING_ENUM NS_EXTENSIBLE_STRING_ENUM -#define RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(_, extensible_string_enum) NS_SWIFT_NAME(extensible_string_enum) -#else -#define RLM_EXTENSIBLE_STRING_ENUM -#define RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(fully_qualified, _) NS_SWIFT_NAME(fully_qualified) -#endif - -#if __has_attribute(ns_error_domain) && (!defined(__cplusplus) || !__cplusplus || __cplusplus >= 201103L) -#define RLM_ERROR_ENUM(type, name, domain) \ - _Pragma("clang diagnostic push") \ - _Pragma("clang diagnostic ignored \"-Wignored-attributes\"") \ - NS_ENUM(type, __attribute__((ns_error_domain(domain))) name) \ - _Pragma("clang diagnostic pop") -#else -#define RLM_ERROR_ENUM(type, name, domain) NS_ENUM(type, name) -#endif - - -#pragma mark - Enums - -/** - `RLMPropertyType` is an enumeration describing all property types supported in Realm models. - - For more information, see [Realm Models](https://realm.io/docs/objc/latest/#models). - */ -// Make sure numbers match those in -typedef NS_ENUM(int32_t, RLMPropertyType) { - -#pragma mark - Primitive types - - /** Integers: `NSInteger`, `int`, `long`, `Int` (Swift) */ - RLMPropertyTypeInt = 0, - /** Booleans: `BOOL`, `bool`, `Bool` (Swift) */ - RLMPropertyTypeBool = 1, - /** Floating-point numbers: `float`, `Float` (Swift) */ - RLMPropertyTypeFloat = 9, - /** Double-precision floating-point numbers: `double`, `Double` (Swift) */ - RLMPropertyTypeDouble = 10, - -#pragma mark - Object types - - /** Strings: `NSString`, `String` (Swift) */ - RLMPropertyTypeString = 2, - /** Binary data: `NSData` */ - RLMPropertyTypeData = 4, - /** - Any object: `id`. - - This property type is no longer supported for new models. However, old models with any-typed properties are still - supported for migration purposes. - */ - RLMPropertyTypeAny = 6, - /** Dates: `NSDate` */ - RLMPropertyTypeDate = 8, - -#pragma mark - Array/Linked object types - - /** Realm model objects. See [Realm Models](https://realm.io/docs/objc/latest/#models) for more information. */ - RLMPropertyTypeObject = 12, - /** Realm arrays. See [Realm Models](https://realm.io/docs/objc/latest/#models) for more information. */ - RLMPropertyTypeArray = 13, - /** Realm linking objects. See [Realm Models](https://realm.io/docs/objc/latest/#models) for more information. */ - RLMPropertyTypeLinkingObjects = 14, -}; - -/** An error domain identifying Realm-specific errors. */ -extern NSString * const RLMErrorDomain; - -/** An error domain identifying non-specific system errors. */ -extern NSString * const RLMUnknownSystemErrorDomain; - -/** - `RLMError` is an enumeration representing all recoverable errors. It is associated with the - Realm error domain specified in `RLMErrorDomain`. - */ -typedef RLM_ERROR_ENUM(NSInteger, RLMError, RLMErrorDomain) { - /** Denotes a general error that occurred when trying to open a Realm. */ - RLMErrorFail = 1, - - /** Denotes a file I/O error that occurred when trying to open a Realm. */ - RLMErrorFileAccess = 2, - - /** - Denotes a file permission error that ocurred when trying to open a Realm. - - This error can occur if the user does not have permission to open or create - the specified file in the specified access mode when opening a Realm. - */ - RLMErrorFilePermissionDenied = 3, - - /** Denotes an error where a file was to be written to disk, but another file with the same name already exists. */ - RLMErrorFileExists = 4, - - /** - Denotes an error that occurs if a file could not be found. - - This error may occur if a Realm file could not be found on disk when trying to open a - Realm as read-only, or if the directory part of the specified path was not found when - trying to write a copy. - */ - RLMErrorFileNotFound = 5, - - /** - Denotes an error that occurs if a file format upgrade is required to open the file, - but upgrades were explicitly disabled. - */ - RLMErrorFileFormatUpgradeRequired = 6, - - /** - Denotes an error that occurs if the database file is currently open in another - process which cannot share with the current process due to an - architecture mismatch. - - This error may occur if trying to share a Realm file between an i386 (32-bit) iOS - Simulator and the Realm Browser application. In this case, please use the 64-bit - version of the iOS Simulator. - */ - RLMErrorIncompatibleLockFile = 8, - - /** Denotes an error that occurs when there is insufficient available address space. */ - RLMErrorAddressSpaceExhausted = 9, - - /** Denotes an error that occurs if there is a schema version mismatch, so that a migration is required. */ - RLMErrorSchemaMismatch = 10, -}; - -#pragma mark - Constants - -#pragma mark - Notification Constants - -/** - A notification indicating that changes were made to a Realm. -*/ -typedef NSString * RLMNotification RLM_EXTENSIBLE_STRING_ENUM; - -/** - This notification is posted by a Realm when the data in that Realm has changed. - - More specifically, this notification is posted after a Realm has been refreshed to - reflect a write transaction. This can happen when an autorefresh occurs, when - `-[RLMRealm refresh]` is called, after an implicit refresh from `-[RLMRealm beginWriteTransaction]`, - or after a local write transaction is completed. - */ -extern RLMNotification const RLMRealmRefreshRequiredNotification -RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(RLMRealmRefreshRequiredNotification, RefreshRequired); - -/** - This notification is posted by a Realm when a write transaction has been - committed to a Realm on a different thread for the same file. - - It is not posted if `-[RLMRealm autorefresh]` is enabled, or if the Realm is - refreshed before the notification has a chance to run. - - Realms with autorefresh disabled should normally install a handler for this - notification which calls `-[RLMRealm refresh]` after doing some work. Refreshing - the Realm is optional, but not refreshing the Realm may lead to large Realm - files. This is because Realm must keep an extra copy of the data for the stale - Realm. - */ -extern RLMNotification const RLMRealmDidChangeNotification -RLM_EXTENSIBLE_STRING_ENUM_CASE_SWIFT_NAME(RLMRealmDidChangeNotification, DidChange); - -#pragma mark - Other Constants - -/** The schema version used for uninitialized Realms */ -extern const uint64_t RLMNotVersioned; - -/** The corresponding value is the name of an exception thrown by Realm. */ -extern NSString * const RLMExceptionName; - -/** The corresponding value is a Realm file version. */ -extern NSString * const RLMRealmVersionKey; - -/** The corresponding key is the version of the underlying database engine. */ -extern NSString * const RLMRealmCoreVersionKey; - -/** The corresponding key is the Realm invalidated property name. */ -extern NSString * const RLMInvalidatedKey; - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMListBase.h b/Pods/Realm/include/RLMListBase.h deleted file mode 100644 index 0151cfb7..00000000 --- a/Pods/Realm/include/RLMListBase.h +++ /dev/null @@ -1,33 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -@class RLMArray; - -NS_ASSUME_NONNULL_BEGIN - -// A base class for Swift generic Lists to make it possible to interact with -// them from obj-c -@interface RLMListBase : NSObject -@property (nonatomic, strong) RLMArray *_rlmArray; - -- (instancetype)initWithArray:(RLMArray *)array; -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMMigration.h b/Pods/Realm/include/RLMMigration.h deleted file mode 100644 index d3da9ffb..00000000 --- a/Pods/Realm/include/RLMMigration.h +++ /dev/null @@ -1,127 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RLMSchema; -@class RLMArray; -@class RLMObject; - -/** - A block type which provides both the old and new versions of an object in the Realm. Object - properties can only be accessed using keyed subscripting. - - @see `-[RLMMigration enumerateObjects:block:]` - - @param oldObject The object from the original Realm (read-only). - @param newObject The object from the migrated Realm (read-write). -*/ -typedef void (^RLMObjectMigrationBlock)(RLMObject * __nullable oldObject, RLMObject * __nullable newObject); - -/** - `RLMMigration` instances encapsulate information intended to facilitate a schema migration. - - A `RLMMigration` instance is passed into a user-defined `RLMMigrationBlock` block when updating - the version of a Realm. This instance provides access to the old and new database schemas, the - objects in the Realm, and provides functionality for modifying the Realm during the migration. - */ -@interface RLMMigration : NSObject - -#pragma mark - Properties - -/** - Returns the old `RLMSchema`. This is the schema which describes the Realm before the - migration is applied. - */ -@property (nonatomic, readonly) RLMSchema *oldSchema; - -/** - Returns the new `RLMSchema`. This is the schema which describes the Realm after the - migration is applied. - */ -@property (nonatomic, readonly) RLMSchema *newSchema; - - -#pragma mark - Altering Objects during a Migration - -/** - Enumerates all the objects of a given type in the Realm, providing both the old and new versions - of each object. Within the block, object properties can only be accessed using keyed subscripting. - - @param className The name of the `RLMObject` class to enumerate. - - @warning All objects returned are of a type specific to the current migration and should not be cast - to `className`. Instead, treat them as `RLMObject`s and use keyed subscripting to access - properties. - */ -- (void)enumerateObjects:(NSString *)className block:(__attribute__((noescape)) RLMObjectMigrationBlock)block; - -/** - Creates and returns an `RLMObject` instance of type `className` in the Realm being migrated. - - The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or - dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed - property. An exception will be thrown if any required properties are not present and those properties were not defined - with default values. - - When passing in an `NSArray` as the `value` argument, all properties must be present, valid and in the same order as - the properties defined in the model. - - @param className The name of the `RLMObject` class to create. - @param value The value used to populate the object. - */ -- (RLMObject *)createObject:(NSString *)className withValue:(id)value; - -/** - Deletes an object from a Realm during a migration. - - It is permitted to call this method from within the block passed to `-[enumerateObjects:block:]`. - - @param object Object to be deleted from the Realm being migrated. - */ -- (void)deleteObject:(RLMObject *)object; - -/** - Deletes the data for the class with the given name. - - All objects of the given class will be deleted. If the `RLMObject` subclass no longer exists in your program, - any remaining metadata for the class will be removed from the Realm file. - - @param name The name of the `RLMObject` class to delete. - - @return A Boolean value indicating whether there was any data to delete. - */ -- (BOOL)deleteDataForClassName:(NSString *)name; - -/** - Renames a property of the given class from `oldName` to `newName`. - - @param className The name of the class whose property should be renamed. This class must be present - in both the old and new Realm schemas. - @param oldName The old name for the property to be renamed. There must not be a property with this name in the - class as defined by the new Realm schema. - @param newName The new name for the property to be renamed. There must not be a property with this name in the - class as defined by the old Realm schema. - */ -- (void)renamePropertyForClass:(NSString *)className oldName:(NSString *)oldName newName:(NSString *)newName; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMMigration_Private.h b/Pods/Realm/include/RLMMigration_Private.h deleted file mode 100644 index 99699e5c..00000000 --- a/Pods/Realm/include/RLMMigration_Private.h +++ /dev/null @@ -1,40 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import -#import - -namespace realm { - class Schema; -} - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMMigration () - -@property (nonatomic, strong) RLMRealm *oldRealm; -@property (nonatomic, strong) RLMRealm *realm; - -- (instancetype)initWithRealm:(RLMRealm *)realm oldRealm:(RLMRealm *)oldRealm schema:(realm::Schema &)schema; - -- (void)execute:(RLMMigrationBlock)block; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMNetworkClient.h b/Pods/Realm/include/RLMNetworkClient.h deleted file mode 100644 index bde6ecfb..00000000 --- a/Pods/Realm/include/RLMNetworkClient.h +++ /dev/null @@ -1,57 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import "RLMSyncUtil_Private.h" - -/** - An enum describing all possible endpoints on the Realm Object Server. - */ -typedef NS_ENUM(NSUInteger, RLMServerEndpoint) { - RLMServerEndpointAuth, - RLMServerEndpointLogout, - RLMServerEndpointAddCredentials, - RLMServerEndpointRemoveCredentials, -}; - -/** - A simple Realm Object Server network client that wraps `NSURLSession`. - */ -@interface RLMNetworkClient : NSObject - -NS_ASSUME_NONNULL_BEGIN - -+ (void)postRequestToEndpoint:(RLMServerEndpoint)endpoint - server:(NSURL *)serverURL - JSON:(NSDictionary *)jsonDictionary - completion:(RLMSyncCompletionBlock)completionBlock; - -/** - Post some JSON data to the authentication server, and asynchronously call a completion block with a JSON response - and/or error. - */ -+ (void)postRequestToEndpoint:(RLMServerEndpoint)endpoint - server:(NSURL *)serverURL - JSON:(NSDictionary *)jsonDictionary - timeout:(NSTimeInterval)timeout - completion:(RLMSyncCompletionBlock)completionBlock; - -NS_ASSUME_NONNULL_END - -@end diff --git a/Pods/Realm/include/RLMObject.h b/Pods/Realm/include/RLMObject.h deleted file mode 100644 index fe723240..00000000 --- a/Pods/Realm/include/RLMObject.h +++ /dev/null @@ -1,535 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RLMNotificationToken; -@class RLMObjectSchema; -@class RLMPropertyChange; -@class RLMPropertyDescriptor; -@class RLMRealm; -@class RLMResults; - -/** - `RLMObject` is a base class for model objects representing data stored in Realms. - - Define your model classes by subclassing `RLMObject` and adding properties to be managed. - Then instantiate and use your custom subclasses instead of using the `RLMObject` class directly. - - // Dog.h - @interface Dog : RLMObject - @property NSString *name; - @property BOOL adopted; - @end - - // Dog.m - @implementation Dog - @end //none needed - - ### Supported property types - - - `NSString` - - `NSInteger`, `int`, `long`, `float`, and `double` - - `BOOL` or `bool` - - `NSDate` - - `NSData` - - `NSNumber`, where `X` is one of `RLMInt`, `RLMFloat`, `RLMDouble` or `RLMBool`, for optional number properties - - `RLMObject` subclasses, to model many-to-one relationships. - - `RLMArray`, where `X` is an `RLMObject` subclass, to model many-to-many relationships. - - ### Querying - - You can initiate queries directly via the class methods: `allObjects`, `objectsWhere:`, and `objectsWithPredicate:`. - These methods allow you to easily query a custom subclass for instances of that class in the default Realm. - - To search in a Realm other than the default Realm, use the `allObjectsInRealm:`, `objectsInRealm:where:`, - and `objectsInRealm:withPredicate:` class methods. - - @see `RLMRealm` - - ### Relationships - - See our [Cocoa guide](https://realm.io/docs/objc/latest#relationships) for more details. - - ### Key-Value Observing - - All `RLMObject` properties (including properties you create in subclasses) are - [Key-Value Observing compliant](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html), - except for `realm` and `objectSchema`. - - Keep the following tips in mind when observing Realm objects: - - 1. Unlike `NSMutableArray` properties, `RLMArray` properties do not require - using the proxy object returned from `-mutableArrayValueForKey:`, or defining - KVC mutation methods on the containing class. You can simply call methods on - the `RLMArray` directly; any changes will be automatically observed by the containing - object. - 2. Unmanaged `RLMObject` instances cannot be added to a Realm while they have any - observed properties. - 3. Modifying managed `RLMObject`s within `-observeValueForKeyPath:ofObject:change:context:` - is not recommended. Properties may change even when the Realm is not in a write - transaction (for example, when `-[RLMRealm refresh]` is called after changes - are made on a different thread), and notifications sent prior to the change - being applied (when `NSKeyValueObservingOptionPrior` is used) may be sent at - times when you *cannot* begin a write transaction. - */ - -@interface RLMObject : RLMObjectBase - -#pragma mark - Creating & Initializing Objects - -/** - Creates an unmanaged instance of a Realm object. - - Call `addObject:` on an `RLMRealm` instance to add an unmanaged object into that Realm. - - @see `[RLMRealm addObject:]` - */ -- (instancetype)init NS_DESIGNATED_INITIALIZER; - - -/** - Creates an unmanaged instance of a Realm object. - - Pass in an `NSArray` or `NSDictionary` instance to set the values of the object's properties. - - Call `addObject:` on an `RLMRealm` instance to add an unmanaged object into that Realm. - - @see `[RLMRealm addObject:]` - */ -- (instancetype)initWithValue:(id)value NS_DESIGNATED_INITIALIZER; - - -/** - Returns the class name for a Realm object subclass. - - @warning Do not override. Realm relies on this method returning the exact class - name. - - @return The class name for the model class. - */ -+ (NSString *)className; - -/** - Creates an instance of a Realm object with a given value, and adds it to the default Realm. - - If nested objects are included in the argument, `createInDefaultRealmWithValue:` will be recursively called - on them. - - The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in - `NSJSONSerialization`, or an array containing one element for each managed property. An exception will be thrown if - any required properties are not present and those properties were not defined with default values. - - When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the - properties defined in the model. - - @param value The value used to populate the object. - - @see `defaultPropertyValues` - */ -+ (instancetype)createInDefaultRealmWithValue:(id)value; - -/** - Creates an instance of a Realm object with a given value, and adds it to the specified Realm. - - If nested objects are included in the argument, `createInRealm:withValue:` will be recursively called - on them. - - The `value` argument can be a key-value coding compliant object, an array or dictionary returned from the methods in - `NSJSONSerialization`, or an array containing one element for each managed property. An exception will be thrown if any - required properties are not present and those properties were not defined with default values. - - When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the - properties defined in the model. - - @param realm The Realm which should manage the newly-created object. - @param value The value used to populate the object. - - @see `defaultPropertyValues` - */ -+ (instancetype)createInRealm:(RLMRealm *)realm withValue:(id)value; - -/** - Creates or updates a Realm object within the default Realm. - - This method may only be called on Realm object types with a primary key defined. If there is already - an object with the same primary key value in the default Realm, its values are updated and the object - is returned. Otherwise, this method creates and populates a new instance of the object in the default Realm. - - If nested objects are included in the argument, `createOrUpdateInDefaultRealmWithValue:` will be - recursively called on them if they have primary keys, `createInDefaultRealmWithValue:` if they do not. - - If the argument is a Realm object already managed by the default Realm, the argument's type is the same - as the receiver, and the objects have identical values for their managed properties, this method does nothing. - - The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or - dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed - property. An exception will be thrown if any required properties are not present and those properties were not defined - with default values. - - When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the - properties defined in the model. - - @param value The value used to populate the object. - - @see `defaultPropertyValues`, `primaryKey` - */ -+ (instancetype)createOrUpdateInDefaultRealmWithValue:(id)value; - -/** - Creates or updates an Realm object within a specified Realm. - - This method may only be called on Realm object types with a primary key defined. If there is already - an object with the same primary key value in the given Realm, its values are updated and the object - is returned. Otherwise this method creates and populates a new instance of this object in the given Realm. - - If nested objects are included in the argument, `createOrUpdateInRealm:withValue:` will be - recursively called on them if they have primary keys, `createInRealm:withValue:` if they do not. - - If the argument is a Realm object already managed by the given Realm, the argument's type is the same - as the receiver, and the objects have identical values for their managed properties, this method does nothing. - - The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or - dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed - property. An exception will be thrown if any required properties are not present and those properties were not defined - with default values. - - When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the - properties defined in the model. - - @param realm The Realm which should own the object. - @param value The value used to populate the object. - - @see `defaultPropertyValues`, `primaryKey` - */ -+ (instancetype)createOrUpdateInRealm:(RLMRealm *)realm withValue:(id)value; - -#pragma mark - Properties - -/** - The Realm which manages the object, or `nil` if the object is unmanaged. - */ -@property (nonatomic, readonly, nullable) RLMRealm *realm; - -/** - The object schema which lists the managed properties for the object. - */ -@property (nonatomic, readonly) RLMObjectSchema *objectSchema; - -/** - Indicates if the object can no longer be accessed because it is now invalid. - - An object can no longer be accessed if the object has been deleted from the Realm that manages it, or - if `invalidate` is called on that Realm. - */ -@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated; - - -#pragma mark - Customizing your Objects - -/** - Returns an array of property names for properties which should be indexed. - - Only string, integer, boolean, and `NSDate` properties are supported. - - @return An array of property names. - */ -+ (NSArray *)indexedProperties; - -/** - Override this method to specify the default values to be used for each property. - - @return A dictionary mapping property names to their default values. - */ -+ (nullable NSDictionary *)defaultPropertyValues; - -/** - Override this method to specify the name of a property to be used as the primary key. - - Only properties of types `RLMPropertyTypeString` and `RLMPropertyTypeInt` can be designated as the primary key. - Primary key properties enforce uniqueness for each value whenever the property is set, which incurs minor overhead. - Indexes are created automatically for primary key properties. - - @return The name of the property designated as the primary key. - */ -+ (nullable NSString *)primaryKey; - -/** - Override this method to specify the names of properties to ignore. These properties will not be managed by the Realm - that manages the object. - - @return An array of property names to ignore. - */ -+ (nullable NSArray *)ignoredProperties; - -/** - Override this method to specify the names of properties that are non-optional (i.e. cannot be assigned a `nil` value). - - By default, all properties of a type whose values can be set to `nil` are considered optional properties. - To require that an object in a Realm always store a non-`nil` value for a property, - add the name of the property to the array returned from this method. - - Properties of `RLMObject` type cannot be non-optional. Array and `NSNumber` properties - can be non-optional, but there is no reason to do so: arrays do not support storing nil, and - if you want a non-optional number you should instead use the primitive type. - - @return An array of property names that are required. - */ -+ (NSArray *)requiredProperties; - -/** - Override this method to provide information related to properties containing linking objects. - - Each property of type `RLMLinkingObjects` must have a key in the dictionary returned by this method consisting - of the property name. The corresponding value must be an instance of `RLMPropertyDescriptor` that describes the class - and property that the property is linked to. - - return @{ @"owners": [RLMPropertyDescriptor descriptorWithClass:Owner.class propertyName:@"dogs"] }; - - @return A dictionary mapping property names to `RLMPropertyDescriptor` instances. - */ -+ (NSDictionary *)linkingObjectsProperties; - - -#pragma mark - Getting & Querying Objects from the Default Realm - -/** - Returns all objects of this object type from the default Realm. - - @return An `RLMResults` containing all objects of this type in the default Realm. - */ -+ (RLMResults *)allObjects; - -/** - Returns all objects of this object type matching the given predicate from the default Realm. - - @param predicateFormat A predicate format string, optionally followed by a variable number of arguments. - - @return An `RLMResults` containing all objects of this type in the default Realm that match the given predicate. - */ -+ (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...; - -/// :nodoc: -+ (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args; - - -/** - Returns all objects of this object type matching the given predicate from the default Realm. - - @param predicate The predicate with which to filter the objects. - - @return An `RLMResults` containing all objects of this type in the default Realm that match the given predicate. - */ -+ (RLMResults *)objectsWithPredicate:(nullable NSPredicate *)predicate; - -/** - Retrieves the single instance of this object type with the given primary key from the default Realm. - - Returns the object from the default Realm which has the given primary key, or - `nil` if the object does not exist. This is slightly faster than the otherwise - equivalent `[[SubclassName objectsWhere:@"primaryKeyPropertyName = %@", key] firstObject]`. - - This method requires that `primaryKey` be overridden on the receiving subclass. - - @return An object of this object type, or `nil` if an object with the given primary key does not exist. - @see `-primaryKey` - */ -+ (nullable instancetype)objectForPrimaryKey:(nullable id)primaryKey; - - -#pragma mark - Querying Specific Realms - -/** - Returns all objects of this object type from the specified Realm. - - @param realm The Realm to query. - - @return An `RLMResults` containing all objects of this type in the specified Realm. - */ -+ (RLMResults *)allObjectsInRealm:(RLMRealm *)realm; - -/** - Returns all objects of this object type matching the given predicate from the specified Realm. - - @param predicateFormat A predicate format string, optionally followed by a variable number of arguments. - @param realm The Realm to query. - - @return An `RLMResults` containing all objects of this type in the specified Realm that match the given predicate. - */ -+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat, ...; - -/// :nodoc: -+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat args:(va_list)args; - -/** - Returns all objects of this object type matching the given predicate from the specified Realm. - - @param predicate A predicate to use to filter the elements. - @param realm The Realm to query. - - @return An `RLMResults` containing all objects of this type in the specified Realm that match the given predicate. - */ -+ (RLMResults *)objectsInRealm:(RLMRealm *)realm withPredicate:(nullable NSPredicate *)predicate; - -/** - Retrieves the single instance of this object type with the given primary key from the specified Realm. - - Returns the object from the specified Realm which has the given primary key, or - `nil` if the object does not exist. This is slightly faster than the otherwise - equivalent `[[SubclassName objectsInRealm:realm where:@"primaryKeyPropertyName = %@", key] firstObject]`. - - This method requires that `primaryKey` be overridden on the receiving subclass. - - @return An object of this object type, or `nil` if an object with the given primary key does not exist. - @see `-primaryKey` - */ -+ (nullable instancetype)objectInRealm:(RLMRealm *)realm forPrimaryKey:(nullable id)primaryKey; - -#pragma mark - Notifications - -/** - A callback block for RLMObject notifications. - - If the object is deleted from the managing Realm, the block is called with - `deleted` set to `YES` and the other two arguments are `nil`. The block will - never be called again after this. - - If the object is modified, the block will be called with `deleted` set to - `NO`, a `nil` `error, and an array of `RLMPropertyChange` objects which - indicate which properties of the objects were modified. - - If an error occurs, `deleted` will be `NO`, `changes` will be `nil`, and - `error` will include information about the error. The block will never be - called again after an error occurs. - */ -typedef void (^RLMObjectChangeBlock)(BOOL deleted, - NSArray *_Nullable changes, - NSError *_Nullable error); - -/** - Registers a block to be called each time the object changes. - - The block will be asynchronously called after each write transaction which - deletes the object or modifies any of the managed properties of the object, - including self-assignments that set a property to its existing value. - - For write transactions performed on different threads or in differen - processes, the block will be called when the managing Realm is - (auto)refreshed to a version including the changes, while for local write - transactions it will be called at some point in the future after the write - transaction is committed. - - Notifications are delivered via the standard run loop, and so can't be - delivered while the run loop is blocked by other activity. When notifications - can't be delivered instantly, multiple notifications may be coalesced into a - single notification. - - Unlike with `RLMArray` and `RLMResults`, there is no "initial" callback made - after you add a new notification block. - - Only objects which are managed by a Realm can be observed in this way. You - must retain the returned token for as long as you want updates to be sent to - the block. To stop receiving updates, call `stop` on the token. - - It is safe to capture a strong reference to the observed object within the - callback block. There is no retain cycle due to that the callback is retained - by the returned token and not by the object itself. - - @warning This method cannot be called during a write transaction, when the - containing Realm is read-only, or on an unmanaged object. - - @param block The block to be called whenever a change occurs. - @return A token which must be held for as long as you want updates to be delivered. - */ -- (RLMNotificationToken *)addNotificationBlock:(RLMObjectChangeBlock)block; - -#pragma mark - Other Instance Methods - -/** - Returns YES if another Realm object instance points to the same object as the receiver in the Realm managing - the receiver. - - For object types with a primary, key, `isEqual:` is overridden to use this method (along with a corresponding - implementation for `hash`). - - @param object The object to compare the receiver to. - - @return Whether the object represents the same object as the receiver. - */ -- (BOOL)isEqualToObject:(RLMObject *)object; - -#pragma mark - Dynamic Accessors - -/// :nodoc: -- (nullable id)objectForKeyedSubscript:(NSString *)key; - -/// :nodoc: -- (void)setObject:(nullable id)obj forKeyedSubscript:(NSString *)key; - -@end - -/** - Information about a specific property which changed in an `RLMObject` change notification. - */ -@interface RLMPropertyChange : NSObject - -/** - The name of the property which changed. - */ -@property (nonatomic, readonly, strong) NSString *name; - -/** - The value of the property before the change occurred. This will always be `nil` - if the change happened on the same thread as the notification and for `RLMArray` - properties. - - For object properties this will give the object which was previously linked to, - but that object will have its new values and not the values it had before the - changes. This means that `previousValue` may be a deleted object, and you will - need to check `invalidated` before accessing any of its properties. - */ -@property (nonatomic, readonly, strong, nullable) id previousValue; - -/** - The value of the property after the change occurred. This will always be `nil` - for `RLMArray` properties. - */ -@property (nonatomic, readonly, strong, nullable) id value; -@end - -#pragma mark - RLMArray Property Declaration - -/** - Properties on `RLMObject`s of type `RLMArray` must have an associated type. A type is associated - with an `RLMArray` property by defining a protocol for the object type that the array should contain. - To define the protocol for an object, you can use the macro RLM_ARRAY_TYPE: - - RLM_ARRAY_TYPE(ObjectType) - ... - @property RLMArray *arrayOfObjectTypes; - */ -#define RLM_ARRAY_TYPE(RLM_OBJECT_SUBCLASS)\ -@protocol RLM_OBJECT_SUBCLASS \ -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMObjectBase.h b/Pods/Realm/include/RLMObjectBase.h deleted file mode 100644 index 6b3271fd..00000000 --- a/Pods/Realm/include/RLMObjectBase.h +++ /dev/null @@ -1,43 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RLMRealm; -@class RLMSchema; -@class RLMObjectSchema; - -/// :nodoc: -@interface RLMObjectBase : NSObject - -@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated; - -- (instancetype)init NS_DESIGNATED_INITIALIZER; - -+ (NSString *)className; - -// Returns whether the class is included in the default set of classes managed by a Realm. -+ (BOOL)shouldIncludeInDefaultSchema; - -+ (nullable NSString *)_realmObjectName; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMObjectBase_Dynamic.h b/Pods/Realm/include/RLMObjectBase_Dynamic.h deleted file mode 100644 index 08f25d58..00000000 --- a/Pods/Realm/include/RLMObjectBase_Dynamic.h +++ /dev/null @@ -1,82 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -@class RLMObjectSchema, RLMRealm; - -NS_ASSUME_NONNULL_BEGIN - -/** - Returns the Realm that manages the object, if one exists. - - @warning This function is useful only in specialized circumstances, for example, when building components - that integrate with Realm. If you are simply building an app on Realm, it is - recommended to retrieve the Realm that manages the object via `RLMObject`. - - @param object An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`. - - @return The Realm which manages this object. Returns `nil `for unmanaged objects. - */ -FOUNDATION_EXTERN RLMRealm * _Nullable RLMObjectBaseRealm(RLMObjectBase * _Nullable object); - -/** - Returns an `RLMObjectSchema` which describes the managed properties of the object. - - @warning This function is useful only in specialized circumstances, for example, when building components - that integrate with Realm. If you are simply building an app on Realm, it is - recommended to retrieve `objectSchema` via `RLMObject`. - - @param object An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`. - - @return The object schema which lists the managed properties for the object. - */ -FOUNDATION_EXTERN RLMObjectSchema * _Nullable RLMObjectBaseObjectSchema(RLMObjectBase * _Nullable object); - -/** - Returns the object corresponding to a key value. - - @warning This function is useful only in specialized circumstances, for example, when building components - that integrate with Realm. If you are simply building an app on Realm, it is - recommended to retrieve key values via `RLMObject`. - - @warning Will throw an `NSUndefinedKeyException` if `key` is not present on the object. - - @param object An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`. - @param key The name of the property. - - @return The object for the property requested. - */ -FOUNDATION_EXTERN id _Nullable RLMObjectBaseObjectForKeyedSubscript(RLMObjectBase * _Nullable object, NSString *key); - -/** - Sets a value for a key on the object. - - @warning This function is useful only in specialized circumstances, for example, when building components - that integrate with Realm. If you are simply building an app on Realm, it is - recommended to set key values via `RLMObject`. - - @warning Will throw an `NSUndefinedKeyException` if `key` is not present on the object. - - @param object An `RLMObjectBase` obtained via a Swift `Object` or `RLMObject`. - @param key The name of the property. - @param obj The object to set as the value of the key. - */ -FOUNDATION_EXTERN void RLMObjectBaseSetObjectForKeyedSubscript(RLMObjectBase * _Nullable object, NSString *key, id _Nullable obj); - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMObjectSchema.h b/Pods/Realm/include/RLMObjectSchema.h deleted file mode 100644 index 808cdfab..00000000 --- a/Pods/Realm/include/RLMObjectSchema.h +++ /dev/null @@ -1,72 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RLMProperty; - -/** - This class represents Realm model object schemas. - - When using Realm, `RLMObjectSchema` instances allow performing migrations and - introspecting the database's schema. - - Object schemas map to tables in the core database. - */ -@interface RLMObjectSchema : NSObject - -#pragma mark - Properties - -/** - An array of `RLMProperty` instances representing the managed properties of a class described by the schema. - - @see `RLMProperty` - */ -@property (nonatomic, readonly, copy) NSArray *properties; - -/** - The name of the class the schema describes. - */ -@property (nonatomic, readonly) NSString *className; - -/** - The property which serves as the primary key for the class the schema describes, if any. - */ -@property (nonatomic, readonly, nullable) RLMProperty *primaryKeyProperty; - -#pragma mark - Methods - -/** - Retrieves an `RLMProperty` object by the property name. - - @param propertyName The property's name. - - @return An `RLMProperty` object, or `nil` if there is no property with the given name. - */ -- (nullable RLMProperty *)objectForKeyedSubscript:(NSString *)propertyName; - -/** - Returns whether two `RLMObjectSchema` instances are equal. - */ -- (BOOL)isEqualToObjectSchema:(RLMObjectSchema *)objectSchema; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMObjectSchema_Private.h b/Pods/Realm/include/RLMObjectSchema_Private.h deleted file mode 100644 index c2968cc5..00000000 --- a/Pods/Realm/include/RLMObjectSchema_Private.h +++ /dev/null @@ -1,71 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -// RLMObjectSchema private -@interface RLMObjectSchema () { -@public - bool _isSwiftClass; -} - -/// The object type name reported to the object store and core. -@property (nonatomic, readonly) NSString *objectName; - -// writable redeclaration -@property (nonatomic, readwrite, copy) NSArray *properties; -@property (nonatomic, readwrite, assign) bool isSwiftClass; - -// class used for this object schema -@property (nonatomic, readwrite, assign) Class objectClass; -@property (nonatomic, readwrite, assign) Class accessorClass; -@property (nonatomic, readwrite, assign) Class unmanagedClass; - -@property (nonatomic, readwrite, nullable) RLMProperty *primaryKeyProperty; - -@property (nonatomic, copy) NSArray *computedProperties; -@property (nonatomic, readonly) NSArray *swiftGenericProperties; - -// returns a cached or new schema for a given object class -+ (instancetype)schemaForObjectClass:(Class)objectClass; -@end - -@interface RLMObjectSchema (Dynamic) -/** - This method is useful only in specialized circumstances, for example, when accessing objects - in a Realm produced externally. If you are simply building an app on Realm, it is not recommended - to use this method as an [RLMObjectSchema](RLMObjectSchema) is generated automatically for every [RLMObject](RLMObject) subclass. - - Initialize an RLMObjectSchema with classname, objectClass, and an array of properties - - @warning This method is useful only in specialized circumstances. - - @param objectClassName The name of the class used to refer to objects of this type. - @param objectClass The Objective-C class used when creating instances of this type. - @param properties An array of RLMProperty instances describing the managed properties for this type. - - @return An initialized instance of RLMObjectSchema. - */ -- (instancetype)initWithClassName:(NSString *)objectClassName objectClass:(Class)objectClass properties:(NSArray *)properties; -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMObjectSchema_Private.hpp b/Pods/Realm/include/RLMObjectSchema_Private.hpp deleted file mode 100644 index 3d93be24..00000000 --- a/Pods/Realm/include/RLMObjectSchema_Private.hpp +++ /dev/null @@ -1,29 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMObjectSchema_Private.h" - -#import "object_schema.hpp" - -@interface RLMObjectSchema () -// create realm::ObjectSchema copy -- (realm::ObjectSchema)objectStoreCopy; - -// initialize with realm::ObjectSchema -+ (instancetype)objectSchemaForObjectStoreSchema:(realm::ObjectSchema const&)objectSchema; -@end diff --git a/Pods/Realm/include/RLMObjectStore.h b/Pods/Realm/include/RLMObjectStore.h deleted file mode 100644 index 3d7f1942..00000000 --- a/Pods/Realm/include/RLMObjectStore.h +++ /dev/null @@ -1,104 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#ifdef __cplusplus -extern "C" { -#endif - -@class RLMRealm, RLMSchema, RLMObjectBase, RLMResults, RLMProperty; - -NS_ASSUME_NONNULL_BEGIN - -// -// Accessor Creation -// - -// create or get cached accessors for the given schema -void RLMRealmCreateAccessors(RLMSchema *schema); - - -// -// Options for object creation -// -typedef NS_OPTIONS(NSUInteger, RLMCreationOptions) { - // Normal object creation - RLMCreationOptionsNone = 0, - // If the property is a link or array property, upsert the linked objects - // if they have a primary key, and insert them otherwise. - RLMCreationOptionsCreateOrUpdate = 1 << 0, - // Allow unmanaged objects to be promoted to managed objects - // if false objects are copied during object creation - RLMCreationOptionsPromoteUnmanaged = 1 << 1, - // Use the SetDefault instruction. - RLMCreationOptionsSetDefault = 1 << 2, -}; - - -// -// Adding, Removing, Getting Objects -// - -// add an object to the given realm -void RLMAddObjectToRealm(RLMObjectBase *object, RLMRealm *realm, bool createOrUpdate); - -// delete an object from its realm -void RLMDeleteObjectFromRealm(RLMObjectBase *object, RLMRealm *realm); - -// deletes all objects from a realm -void RLMDeleteAllObjectsFromRealm(RLMRealm *realm); - -// get objects of a given class -RLMResults *RLMGetObjects(RLMRealm *realm, NSString *objectClassName, NSPredicate * _Nullable predicate) -NS_RETURNS_RETAINED; - -// get an object with the given primary key -id _Nullable RLMGetObject(RLMRealm *realm, NSString *objectClassName, id _Nullable key) NS_RETURNS_RETAINED; - -// create object from array or dictionary -RLMObjectBase *RLMCreateObjectInRealmWithValue(RLMRealm *realm, NSString *className, id _Nullable value, bool createOrUpdate) -NS_RETURNS_RETAINED; - - -// -// Accessor Creation -// - - -// switch List<> properties from being backed by unmanaged RLMArrays to RLMArrayLinkView -void RLMInitializeSwiftAccessorGenerics(RLMObjectBase *object); - -#ifdef __cplusplus -} - -namespace realm { - class Table; - template class BasicRowExpr; - using RowExpr = BasicRowExpr
; -} -class RLMClassInfo; - -// Create accessors -RLMObjectBase *RLMCreateObjectAccessor(RLMRealm *realm, RLMClassInfo& info, - NSUInteger index) NS_RETURNS_RETAINED; -RLMObjectBase *RLMCreateObjectAccessor(RLMRealm *realm, RLMClassInfo& info, - realm::RowExpr row) NS_RETURNS_RETAINED; -#endif - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMObject_Private.h b/Pods/Realm/include/RLMObject_Private.h deleted file mode 100644 index cdb087f8..00000000 --- a/Pods/Realm/include/RLMObject_Private.h +++ /dev/null @@ -1,104 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -NS_ASSUME_NONNULL_BEGIN - -// RLMObject accessor and read/write realm -@interface RLMObjectBase () { -@public - RLMRealm *_realm; - __unsafe_unretained RLMObjectSchema *_objectSchema; -} - -// unmanaged initializer -- (instancetype)initWithValue:(id)value schema:(RLMSchema *)schema NS_DESIGNATED_INITIALIZER; - -// live accessor initializer -- (instancetype)initWithRealm:(__unsafe_unretained RLMRealm *const)realm - schema:(RLMObjectSchema *)schema NS_DESIGNATED_INITIALIZER; - -// shared schema for this class -+ (nullable RLMObjectSchema *)sharedSchema; - -// provide injection point for alternative Swift object util class -+ (Class)objectUtilClass:(BOOL)isSwift; - -@end - -@interface RLMObject () - -// unmanaged initializer -- (instancetype)initWithValue:(id)value schema:(RLMSchema *)schema NS_DESIGNATED_INITIALIZER; - -// live accessor initializer -- (instancetype)initWithRealm:(__unsafe_unretained RLMRealm *const)realm - schema:(RLMObjectSchema *)schema NS_DESIGNATED_INITIALIZER; - -@end - -@interface RLMDynamicObject : RLMObject - -@end - -// A reference to an object's row that doesn't keep the object accessor alive. -// Used by some Swift property types, such as LinkingObjects, to avoid retain cycles -// with their containing object. -@interface RLMWeakObjectHandle : NSObject - -- (instancetype)initWithObject:(RLMObjectBase *)object; - -// Consumes the row, so can only usefully be called once. -@property (nonatomic, readonly) RLMObjectBase *object; - -@end - -// Calls valueForKey: and re-raises NSUndefinedKeyExceptions -FOUNDATION_EXTERN id _Nullable RLMValidatedValueForProperty(id object, NSString *key, NSString *className); - -// Compare two RLObjectBases -FOUNDATION_EXTERN BOOL RLMObjectBaseAreEqual(RLMObjectBase * _Nullable o1, RLMObjectBase * _Nullable o2); - -typedef void (^RLMObjectNotificationCallback)(NSArray *_Nullable propertyNames, - NSArray *_Nullable oldValues, - NSArray *_Nullable newValues, - NSError *_Nullable error); -FOUNDATION_EXTERN RLMNotificationToken *RLMObjectAddNotificationBlock(RLMObjectBase *obj, RLMObjectNotificationCallback block); - -// Get ObjectUil class for objc or swift -FOUNDATION_EXTERN Class RLMObjectUtilClass(BOOL isSwift); - -FOUNDATION_EXTERN const NSUInteger RLMDescriptionMaxDepth; - -@class RLMProperty, RLMArray; -@interface RLMObjectUtil : NSObject - -+ (nullable NSArray *)ignoredPropertiesForClass:(Class)cls; -+ (nullable NSArray *)indexedPropertiesForClass:(Class)cls; -+ (nullable NSDictionary *> *)linkingObjectsPropertiesForClass:(Class)cls; - -+ (nullable NSArray *)getGenericListPropertyNames:(id)obj; -+ (nullable NSDictionary *)getLinkingObjectsProperties:(id)object; - -+ (nullable NSDictionary *)getOptionalProperties:(id)obj; -+ (nullable NSArray *)requiredPropertiesForClass:(Class)cls; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMObject_Private.hpp b/Pods/Realm/include/RLMObject_Private.hpp deleted file mode 100644 index 7f79dd6d..00000000 --- a/Pods/Realm/include/RLMObject_Private.hpp +++ /dev/null @@ -1,58 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMObject_Private.h" - -#import "RLMRealm_Private.hpp" -#import "RLMUtil.hpp" - -#import // required by row.hpp -#import - -class RLMObservationInfo; - -// RLMObject accessor and read/write realm -@interface RLMObjectBase () { - @public - realm::Row _row; - RLMObservationInfo *_observationInfo; - RLMClassInfo *_info; -} -@end - -// FIXME-2.0: This should be folded into initWithRealm:schema:, but changing the -// signature of that is a breaking change for Swift -id RLMCreateManagedAccessor(Class cls, RLMRealm *realm, RLMClassInfo *info) NS_RETURNS_RETAINED; - -// throw an exception if the object is invalidated or on the wrong thread -static inline void RLMVerifyAttached(__unsafe_unretained RLMObjectBase *const obj) { - if (!obj->_row.is_attached()) { - @throw RLMException(@"Object has been deleted or invalidated."); - } - [obj->_realm verifyThread]; -} - -// throw an exception if the object can't be modified for any reason -static inline void RLMVerifyInWriteTransaction(__unsafe_unretained RLMObjectBase *const obj) { - // first verify is attached - RLMVerifyAttached(obj); - - if (!obj->_realm.inWriteTransaction) { - @throw RLMException(@"Attempting to modify object outside of a write transaction - call beginWriteTransaction on an RLMRealm instance first."); - } -} diff --git a/Pods/Realm/include/RLMObservation.hpp b/Pods/Realm/include/RLMObservation.hpp deleted file mode 100644 index 0f5b2150..00000000 --- a/Pods/Realm/include/RLMObservation.hpp +++ /dev/null @@ -1,153 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import "binding_context.hpp" - -#import -#import - -#import - -@class RLMObjectBase, RLMRealm, RLMSchema, RLMProperty, RLMObjectSchema; -class RLMClassInfo; -class RLMSchemaInfo; - -namespace realm { - class History; - class SharedGroup; -} - -// RLMObservationInfo stores all of the KVO-related data for RLMObjectBase and -// RLMArray. There is a one-to-one relationship between observed objects and -// RLMObservationInfo instances, so it could be folded into RLMObjectBase, and -// is a separate class mostly to avoid making all accessor objects far larger. -// -// RLMClassInfo stores a vector of pointers to the first observation info -// created for each row. If there are multiple observation infos for a single -// row (such as if there are multiple observed objects backed by a single row, -// or if both an object and an array property of that object are observed), -// they're stored in an intrusive doubly-linked-list in the `next` and `prev` -// members. This is done primarily to make it simpler and faster to loop over -// all of the observed objects for a single row, as that needs to be done for -// every change. -class RLMObservationInfo { -public: - RLMObservationInfo(id object); - RLMObservationInfo(RLMClassInfo &objectSchema, std::size_t row, id object); - ~RLMObservationInfo(); - - realm::Row const& getRow() const { - return row; - } - - NSString *columnName(size_t col) const noexcept; - - // Send willChange/didChange notifications to all observers for this object/row - // Sends the array versions if indexes is non-nil, normal versions otherwise - void willChange(NSString *key, NSKeyValueChange kind=NSKeyValueChangeSetting, NSIndexSet *indexes=nil) const; - void didChange(NSString *key, NSKeyValueChange kind=NSKeyValueChangeSetting, NSIndexSet *indexes=nil) const; - - bool isForRow(size_t ndx) const { - return row && row.get_index() == ndx; - } - - void recordObserver(realm::Row& row, RLMClassInfo *objectInfo, RLMObjectSchema *objectSchema, NSString *keyPath); - void removeObserver(); - bool hasObservers() const { return observerCount > 0; } - - // valueForKey: on observed object and array properties needs to return the - // same object each time for KVO to work at all. Doing this all the time - // requires some odd semantics to avoid reference cycles, so instead we do - // it only to the extent specifically required by KVO. In addition, we - // need to continue to return the same object even if this row is deleted, - // or deleting an object with active observers will explode horribly. - // Once prepareForInvalidation() is called, valueForKey() will always return - // the cached value for object and array properties without checking the - // backing row to verify it's up-to-date. - // - // prepareForInvalidation() must be called on the head of the linked list - // (i.e. on the object pointed to directly by the object schema) - id valueForKey(NSString *key); - - void prepareForInvalidation(); - -private: - // Doubly-linked-list of observed objects for the same row as this - RLMObservationInfo *next = nullptr; - RLMObservationInfo *prev = nullptr; - - // Row being observed - realm::Row row; - RLMClassInfo *objectSchema = nullptr; - - // Object doing the observing - __unsafe_unretained id object = nil; - - // valueForKey: hack - bool invalidated = false; - size_t observerCount = 0; - NSString *lastKey = nil; - __unsafe_unretained RLMProperty *lastProp = nil; - - // objects returned from valueForKey() to keep them alive in case observers - // are added and so that they can still be accessed after row is detached - NSMutableDictionary *cachedObjects; - - void setRow(realm::Table &table, size_t newRow); - - template - void forEach(F&& f) const { - // The user's observation handler may release their last reference to - // the object being observed, which will result in the RLMObservationInfo - // being destroyed. As a result, we need to retain the object which owns - // both `this` and the current info we're looking at. - __attribute__((objc_precise_lifetime)) id self = object, current; - for (auto info = prev; info; info = info->prev) { - current = info->object; - f(info->object); - } - for (auto info = this; info; info = info->next) { - current = info->object; - f(info->object); - } - } - - // Default move/copy constructors don't work due to the intrusive linked - // list and we don't need them - RLMObservationInfo(RLMObservationInfo const&) = delete; - RLMObservationInfo(RLMObservationInfo&&) = delete; - RLMObservationInfo& operator=(RLMObservationInfo const&) = delete; - RLMObservationInfo& operator=(RLMObservationInfo&&) = delete; -}; - -// Get the the observation info chain for the given row -// Will simply return info if it's non-null, and will search ojectSchema's array -// for a matching one otherwise, and return null if there are none -RLMObservationInfo *RLMGetObservationInfo(RLMObservationInfo *info, size_t row, RLMClassInfo& objectSchema); - -// delete all objects from a single table with change notifications -void RLMClearTable(RLMClassInfo &realm); - -// invoke the block, sending notifications for cascading deletes/link nullifications -void RLMTrackDeletions(RLMRealm *realm, dispatch_block_t block); - -std::vector RLMGetObservedRows(RLMSchemaInfo const& schema); -void RLMWillChange(std::vector const& observed, std::vector const& invalidated); -void RLMDidChange(std::vector const& observed, std::vector const& invalidated); diff --git a/Pods/Realm/include/RLMOptionalBase.h b/Pods/Realm/include/RLMOptionalBase.h deleted file mode 100644 index 5ee261e0..00000000 --- a/Pods/Realm/include/RLMOptionalBase.h +++ /dev/null @@ -1,38 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RLMObjectBase, RLMProperty; - -@interface RLMOptionalBase : NSProxy - -- (instancetype)init; - -@property (nonatomic, weak) RLMObjectBase *object; - -@property (nonatomic, unsafe_unretained) RLMProperty *property; - -@property (nonatomic, strong, nullable) id underlyingValue; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMPlatform.h b/Pods/Realm/include/RLMPlatform.h deleted file mode 100644 index e69de29b..00000000 diff --git a/Pods/Realm/include/RLMPredicateUtil.hpp b/Pods/Realm/include/RLMPredicateUtil.hpp deleted file mode 100644 index 71426de4..00000000 --- a/Pods/Realm/include/RLMPredicateUtil.hpp +++ /dev/null @@ -1,22 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -#import -#import - -using ExpressionVisitor = std::function; -NSPredicate *transformPredicate(NSPredicate *, ExpressionVisitor); diff --git a/Pods/Realm/include/RLMPrefix.h b/Pods/Realm/include/RLMPrefix.h deleted file mode 100644 index df08ce9e..00000000 --- a/Pods/Realm/include/RLMPrefix.h +++ /dev/null @@ -1,35 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#ifdef __OBJC__ -#import -#endif - -#ifdef __cplusplus -#import -#import -#import -#import -#import - -#import -#import -#import -#import -#import -#endif diff --git a/Pods/Realm/include/RLMProperty.h b/Pods/Realm/include/RLMProperty.h deleted file mode 100644 index f19c592b..00000000 --- a/Pods/Realm/include/RLMProperty.h +++ /dev/null @@ -1,121 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/// :nodoc: -@protocol RLMInt -@end - -/// :nodoc: -@protocol RLMBool -@end - -/// :nodoc: -@protocol RLMDouble -@end - -/// :nodoc: -@protocol RLMFloat -@end - -/// :nodoc: -@interface NSNumber () -@end - -/** - `RLMProperty` instances represent properties managed by a Realm in the context of an object schema. Such properties may - be persisted to a Realm file or computed from other data from the Realm. - - When using Realm, `RLMProperty` instances allow performing migrations and introspecting the database's schema. - - These property instances map to columns in the core database. - */ -@interface RLMProperty : NSObject - -#pragma mark - Properties - -/** - The name of the property. - */ -@property (nonatomic, readonly) NSString *name; - -/** - The type of the property. - - @see `RLMPropertyType` - */ -@property (nonatomic, readonly) RLMPropertyType type; - -/** - Indicates whether this property is indexed. - - @see `RLMObject` - */ -@property (nonatomic, readonly) BOOL indexed; - -/** - For `RLMObject` and `RLMArray` properties, the name of the class of object stored in the property. - */ -@property (nonatomic, readonly, copy, nullable) NSString *objectClassName; - -/** - For linking objects properties, the property name of the property the linking objects property is linked to. - */ -@property (nonatomic, readonly, copy, nullable) NSString *linkOriginPropertyName; - -/** - Indicates whether this property is optional. - */ -@property (nonatomic, readonly) BOOL optional; - -#pragma mark - Methods - -/** - Returns whether a given property object is equal to the receiver. - */ -- (BOOL)isEqualToProperty:(RLMProperty *)property; - -@end - - -/** - An `RLMPropertyDescriptor` instance represents a specific property on a given class. - */ -@interface RLMPropertyDescriptor : NSObject - -/** - Creates and returns a property descriptor. - - @param objectClass The class of this property descriptor. - @param propertyName The name of this property descriptor. - */ -+ (instancetype)descriptorWithClass:(Class)objectClass propertyName:(NSString *)propertyName; - -/// The class of the property. -@property (nonatomic, readonly) Class objectClass; - -/// The name of the property. -@property (nonatomic, readonly) NSString *propertyName; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMProperty_Private.h b/Pods/Realm/include/RLMProperty_Private.h deleted file mode 100644 index d36f9787..00000000 --- a/Pods/Realm/include/RLMProperty_Private.h +++ /dev/null @@ -1,111 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import - -@class RLMObjectBase; - -NS_ASSUME_NONNULL_BEGIN - -BOOL RLMPropertyTypeIsNullable(RLMPropertyType propertyType); -BOOL RLMPropertyTypeIsComputed(RLMPropertyType propertyType); - -// private property interface -@interface RLMProperty () { -@public - RLMPropertyType _type; - Ivar _swiftIvar; -} - -- (instancetype)initWithName:(NSString *)name - indexed:(BOOL)indexed - linkPropertyDescriptor:(nullable RLMPropertyDescriptor *)linkPropertyDescriptor - property:(objc_property_t)property; - -- (instancetype)initSwiftPropertyWithName:(NSString *)name - indexed:(BOOL)indexed - linkPropertyDescriptor:(nullable RLMPropertyDescriptor *)linkPropertyDescriptor - property:(objc_property_t)property - instance:(RLMObjectBase *)objectInstance; - -- (instancetype)initSwiftListPropertyWithName:(NSString *)name - ivar:(Ivar)ivar - objectClassName:(nullable NSString *)objectClassName; - -- (instancetype)initSwiftOptionalPropertyWithName:(NSString *)name - indexed:(BOOL)indexed - ivar:(Ivar)ivar - propertyType:(RLMPropertyType)propertyType; - -- (instancetype)initSwiftLinkingObjectsPropertyWithName:(NSString *)name - ivar:(Ivar)ivar - objectClassName:(nullable NSString *)objectClassName - linkOriginPropertyName:(nullable NSString *)linkOriginPropertyName; - -// private setters -@property (nonatomic, readwrite) NSString *name; -@property (nonatomic, readwrite, assign) RLMPropertyType type; -@property (nonatomic, readwrite) BOOL indexed; -@property (nonatomic, readwrite) BOOL optional; -@property (nonatomic, copy, nullable) NSString *objectClassName; - -// private properties -@property (nonatomic, assign) NSUInteger index; -@property (nonatomic, assign) char objcType; -@property (nonatomic, copy) NSString *objcRawType; -@property (nonatomic, assign) BOOL isPrimary; -@property (nonatomic, assign) Ivar swiftIvar; - -// getter and setter names -@property (nonatomic, copy) NSString *getterName; -@property (nonatomic, copy) NSString *setterName; -@property (nonatomic) SEL getterSel; -@property (nonatomic) SEL setterSel; - -- (RLMProperty *)copyWithNewName:(NSString *)name; - -@end - -@interface RLMProperty (Dynamic) -/** - This method is useful only in specialized circumstances, for example, in conjunction with - +[RLMObjectSchema initWithClassName:objectClass:properties:]. If you are simply building an - app on Realm, it is not recommened to use this method. - - Initialize an RLMProperty - - @warning This method is useful only in specialized circumstances. - - @param name The property name. - @param type The property type. - @param objectClassName The object type used for Object and Array types. - @param linkOriginPropertyName The property name of the origin of a link. Used for linking objects properties. - - @return An initialized instance of RLMProperty. - */ -- (instancetype)initWithName:(NSString *)name - type:(RLMPropertyType)type - objectClassName:(nullable NSString *)objectClassName - linkOriginPropertyName:(nullable NSString *)linkOriginPropertyName - indexed:(BOOL)indexed - optional:(BOOL)optional; -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMProperty_Private.hpp b/Pods/Realm/include/RLMProperty_Private.hpp deleted file mode 100644 index 0e214d53..00000000 --- a/Pods/Realm/include/RLMProperty_Private.hpp +++ /dev/null @@ -1,29 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import "property.hpp" - -@interface RLMProperty () - -+ (instancetype)propertyForObjectStoreProperty:(const realm::Property&)property; - -- (realm::Property)objectStoreCopy; - -@end diff --git a/Pods/Realm/include/RLMQueryUtil.hpp b/Pods/Realm/include/RLMQueryUtil.hpp deleted file mode 100644 index 1be0c4ee..00000000 --- a/Pods/Realm/include/RLMQueryUtil.hpp +++ /dev/null @@ -1,42 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import - -namespace realm { - class Group; - class Query; - class SortDescriptor; -} - -@class RLMObjectSchema, RLMProperty, RLMSchema, RLMSortDescriptor; -class RLMClassInfo; - -extern NSString * const RLMPropertiesComparisonTypeMismatchException; -extern NSString * const RLMUnsupportedTypesFoundInPropertyComparisonException; - -realm::Query RLMPredicateToQuery(NSPredicate *predicate, RLMObjectSchema *objectSchema, - RLMSchema *schema, realm::Group &group); - -// return property - throw for invalid column name -RLMProperty *RLMValidatedProperty(RLMObjectSchema *objectSchema, NSString *columnName); - -// validate the array of RLMSortDescriptors and convert it to a realm::SortDescriptor -realm::SortDescriptor RLMSortDescriptorFromDescriptors(RLMClassInfo& classInfo, NSArray *descriptors); diff --git a/Pods/Realm/include/RLMRealm.h b/Pods/Realm/include/RLMRealm.h deleted file mode 100644 index 0f7ee4f1..00000000 --- a/Pods/Realm/include/RLMRealm.h +++ /dev/null @@ -1,602 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import "RLMConstants.h" - -@class RLMRealmConfiguration, RLMObject, RLMSchema, RLMMigration, RLMNotificationToken, RLMThreadSafeReference; - -NS_ASSUME_NONNULL_BEGIN - -/** - An `RLMRealm` instance (also referred to as "a Realm") represents a Realm - database. - - Realms can either be stored on disk (see `+[RLMRealm realmWithURL:]`) or in - memory (see `RLMRealmConfiguration`). - - `RLMRealm` instances are cached internally, and constructing equivalent `RLMRealm` - objects (for example, by using the same path or identifier) multiple times on a single thread - within a single iteration of the run loop will normally return the same - `RLMRealm` object. - - If you specifically want to ensure an `RLMRealm` instance is - destroyed (for example, if you wish to open a Realm, check some property, and - then possibly delete the Realm file and re-open it), place the code which uses - the Realm within an `@autoreleasepool {}` and ensure you have no other - strong references to it. - - @warning `RLMRealm` instances are not thread safe and cannot be shared across - threads or dispatch queues. Trying to do so will cause an exception to be thrown. - You must call this method on each thread you want - to interact with the Realm on. For dispatch queues, this means that you must - call it in each block which is dispatched, as a queue is not guaranteed to run - all of its blocks on the same thread. - */ - -@interface RLMRealm : NSObject - -#pragma mark - Creating & Initializing a Realm - -/** - Obtains an instance of the default Realm. - - The default Realm is used by the `RLMObject` class methods - which do not take an `RLMRealm` parameter, but is otherwise not special. The - default Realm is persisted as *default.realm* under the *Documents* directory of - your Application on iOS, and in your application's *Application Support* - directory on OS X. - - The default Realm is created using the default `RLMRealmConfiguration`, which - can be changed via `+[RLMRealmConfiguration setDefaultConfiguration:]`. - - @return The default `RLMRealm` instance for the current thread. - */ -+ (instancetype)defaultRealm; - -/** - Obtains an `RLMRealm` instance with the given configuration. - - @param configuration A configuration object to use when creating the Realm. - @param error If an error occurs, upon return contains an `NSError` object - that describes the problem. If you are not interested in - possible errors, pass in `NULL`. - - @return An `RLMRealm` instance. - */ -+ (nullable instancetype)realmWithConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error; - -/** - Obtains an `RLMRealm` instance persisted at a specified file URL. - - @param fileURL The local URL of the file the Realm should be saved at. - - @return An `RLMRealm` instance. - */ -+ (instancetype)realmWithURL:(NSURL *)fileURL; - -/** - The `RLMSchema` used by the Realm. - */ -@property (nonatomic, readonly) RLMSchema *schema; - -/** - Indicates if the Realm is currently engaged in a write transaction. - - @warning Do not simply check this property and then start a write transaction whenever an object needs to be - created, updated, or removed. Doing so might cause a large number of write transactions to be created, - degrading performance. Instead, always prefer performing multiple updates during a single transaction. - */ -@property (nonatomic, readonly) BOOL inWriteTransaction; - -/** - The `RLMRealmConfiguration` object that was used to create this `RLMRealm` instance. - */ -@property (nonatomic, readonly) RLMRealmConfiguration *configuration; - -/** - Indicates if this Realm contains any objects. - */ -@property (nonatomic, readonly) BOOL isEmpty; - -#pragma mark - Notifications - -/** - The type of a block to run whenever the data within the Realm is modified. - - @see `-[RLMRealm addNotificationBlock:]` - */ -typedef void (^RLMNotificationBlock)(RLMNotification notification, RLMRealm *realm); - -#pragma mark - Receiving Notification when a Realm Changes - -/** - Adds a notification handler for changes in this Realm, and returns a notification token. - - Notification handlers are called after each write transaction is committed, - either on the current thread or other threads. - - Handler blocks are called on the same thread that they were added on, and may - only be added on threads which are currently within a run loop. Unless you are - specifically creating and running a run loop on a background thread, this will - normally only be the main thread. - - The block has the following definition: - - typedef void(^RLMNotificationBlock)(RLMNotification notification, RLMRealm *realm); - - It receives the following parameters: - - - `NSString` \***notification**: The name of the incoming notification. See - `RLMRealmNotification` for information on what - notifications are sent. - - `RLMRealm` \***realm**: The Realm for which this notification occurred. - - @param block A block which is called to process Realm notifications. - - @return A token object which must be retained as long as you wish to continue - receiving change notifications. - */ -- (RLMNotificationToken *)addNotificationBlock:(RLMNotificationBlock)block __attribute__((warn_unused_result)); - -#pragma mark - Transactions - - -#pragma mark - Writing to a Realm - -/** - Begins a write transaction on the Realm. - - Only one write transaction can be open at a time for each Realm file. Write - transactions cannot be nested, and trying to begin a write transaction on a - Realm which is already in a write transaction will throw an exception. Calls to - `beginWriteTransaction` from `RLMRealm` instances for the same Realm file in - other threads or other processes will block until the current write transaction - completes or is cancelled. - - Before beginning the write transaction, `beginWriteTransaction` updates the - `RLMRealm` instance to the latest Realm version, as if `refresh` had been - called, and generates notifications if applicable. This has no effect if the - Realm was already up to date. - - It is rarely a good idea to have write transactions span multiple cycles of - the run loop, but if you do wish to do so you will need to ensure that the - Realm participating in the write transaction is kept alive until the write - transaction is committed. - */ -- (void)beginWriteTransaction; - -/** - Commits all write operations in the current write transaction, and ends the - transaction. - - After saving the changes, all notification blocks registered on this specific - `RLMRealm` instance are invoked synchronously. Notification blocks registered - on other threads or on collections are invoked asynchronously. If you do not - want to receive a specific notification for this write tranaction, see - `commitWriteTransactionWithoutNotifying:error:`. - - This method can fail if there is insufficient disk space available to save the - writes made, or due to unexpected i/o errors. This version of the method throws - an exception when errors occur. Use the version with a `NSError` out parameter - instead if you wish to handle errors. - - @warning This method may only be called during a write transaction. - */ -- (void)commitWriteTransaction NS_SWIFT_UNAVAILABLE(""); - -/** - Commits all write operations in the current write transaction, and ends the - transaction. - - After saving the changes, all notification blocks registered on this specific - `RLMRealm` instance are invoked synchronously. Notification blocks registered - on other threads or on collections are invoked asynchronously. If you do not - want to receive a specific notification for this write tranaction, see - `commitWriteTransactionWithoutNotifying:error:`. - - This method can fail if there is insufficient disk space available to save the - writes made, or due to unexpected i/o errors. - - @warning This method may only be called during a write transaction. - - @param error If an error occurs, upon return contains an `NSError` object - that describes the problem. If you are not interested in - possible errors, pass in `NULL`. - - @return Whether the transaction succeeded. - */ -- (BOOL)commitWriteTransaction:(NSError **)error; - -/** - Commits all write operations in the current write transaction, without - notifying specific notification blocks of the changes. - - After saving the changes, all notification blocks registered on this specific - `RLMRealm` instance are invoked synchronously. Notification blocks registered - on other threads or on collections are scheduled to be invoked asynchronously. - - You can skip notifiying specific notification blocks about the changes made - in this write transaction by passing in their associated notification tokens. - This is primarily useful when the write transaction is saving changes already - made in the UI and you do not want to have the notification block attempt to - re-apply the same changes. - - The tokens passed to this method must be for notifications for this specific - `RLMRealm` instance. Notifications for different threads cannot be skipped - using this method. - - This method can fail if there is insufficient disk space available to save the - writes made, or due to unexpected i/o errors. - - @warning This method may only be called during a write transaction. - - @param tokens An array of notification tokens which were returned from adding - callbacks which you do not want to be notified for the changes - made in this write transaction. - @param error If an error occurs, upon return contains an `NSError` object - that describes the problem. If you are not interested in - possible errors, pass in `NULL`. - - @return Whether the transaction succeeded. - */ -- (BOOL)commitWriteTransactionWithoutNotifying:(NSArray *)tokens error:(NSError **)error; - -/** - Reverts all writes made during the current write transaction and ends the transaction. - - This rolls back all objects in the Realm to the state they were in at the - beginning of the write transaction, and then ends the transaction. - - This restores the data for deleted objects, but does not revive invalidated - object instances. Any `RLMObject`s which were added to the Realm will be - invalidated rather than becoming unmanaged. - Given the following code: - - ObjectType *oldObject = [[ObjectType objectsWhere:@"..."] firstObject]; - ObjectType *newObject = [[ObjectType alloc] init]; - - [realm beginWriteTransaction]; - [realm addObject:newObject]; - [realm deleteObject:oldObject]; - [realm cancelWriteTransaction]; - - Both `oldObject` and `newObject` will return `YES` for `isInvalidated`, - but re-running the query which provided `oldObject` will once again return - the valid object. - - KVO observers on any objects which were modified during the transaction will - be notified about the change back to their initial values, but no other - notifcations are produced by a cancelled write transaction. - - @warning This method may only be called during a write transaction. - */ -- (void)cancelWriteTransaction; - -/** - Performs actions contained within the given block inside a write transaction. - - @see `[RLMRealm transactionWithBlock:error:]` - */ -- (void)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block NS_SWIFT_UNAVAILABLE(""); - -/** - Performs actions contained within the given block inside a write transaction. - - Write transactions cannot be nested, and trying to execute a write transaction - on a Realm which is already participating in a write transaction will throw an - exception. Calls to `transactionWithBlock:` from `RLMRealm` instances in other - threads will block until the current write transaction completes. - - Before beginning the write transaction, `transactionWithBlock:` updates the - `RLMRealm` instance to the latest Realm version, as if `refresh` had been called, and - generates notifications if applicable. This has no effect if the Realm - was already up to date. - - @param block The block containing actions to perform. - @param error If an error occurs, upon return contains an `NSError` object - that describes the problem. If you are not interested in - possible errors, pass in `NULL`. - - @return Whether the transaction succeeded. - */ -- (BOOL)transactionWithBlock:(__attribute__((noescape)) void(^)(void))block error:(NSError **)error; - -/** - Updates the Realm and outstanding objects managed by the Realm to point to the - most recent data. - - If the version of the Realm is actually changed, Realm and collection - notifications will be sent to reflect the changes. This may take some time, as - collection notifications are prepared on a background thread. As a result, - calling this method on the main thread is not advisable. - - @return Whether there were any updates for the Realm. Note that `YES` may be - returned even if no data actually changed. - */ -- (BOOL)refresh; - -/** - Set this property to `YES` to automatically update this Realm when changes - happen in other threads. - - If set to `YES` (the default), changes made on other threads will be reflected - in this Realm on the next cycle of the run loop after the changes are - committed. If set to `NO`, you must manually call `-refresh` on the Realm to - update it to get the latest data. - - Note that by default, background threads do not have an active run loop and you - will need to manually call `-refresh` in order to update to the latest version, - even if `autorefresh` is set to `YES`. - - Even with this property enabled, you can still call `-refresh` at any time to - update the Realm before the automatic refresh would occur. - - Write transactions will still always advance a Realm to the latest version and - produce local notifications on commit even if autorefresh is disabled. - - Disabling `autorefresh` on a Realm without any strong references to it will not - have any effect, and `autorefresh` will revert back to `YES` the next time the - Realm is created. This is normally irrelevant as it means that there is nothing - to refresh (as managed `RLMObject`s, `RLMArray`s, and `RLMResults` have strong - references to the Realm that manages them), but it means that setting - `RLMRealm.defaultRealm.autorefresh = NO` in - `application:didFinishLaunchingWithOptions:` and only later storing Realm - objects will not work. - - Defaults to `YES`. - */ -@property (nonatomic) BOOL autorefresh; - -/** - Writes a compacted and optionally encrypted copy of the Realm to the given local URL. - - The destination file cannot already exist. - - Note that if this method is called from within a write transaction, the - *current* data is written, not the data from the point when the previous write - transaction was committed. - - @param fileURL Local URL to save the Realm to. - @param key Optional 64-byte encryption key to encrypt the new file with. - @param error If an error occurs, upon return contains an `NSError` object - that describes the problem. If you are not interested in - possible errors, pass in `NULL`. - - @return `YES` if the Realm was successfully written to disk, `NO` if an error occurred. -*/ -- (BOOL)writeCopyToURL:(NSURL *)fileURL encryptionKey:(nullable NSData *)key error:(NSError **)error; - -/** - Invalidates all `RLMObject`s, `RLMResults`, `RLMLinkingObjects`, and `RLMArray`s managed by the Realm. - - A Realm holds a read lock on the version of the data accessed by it, so - that changes made to the Realm on different threads do not modify or delete the - data seen by this Realm. Calling this method releases the read lock, - allowing the space used on disk to be reused by later write transactions rather - than growing the file. This method should be called before performing long - blocking operations on a background thread on which you previously read data - from the Realm which you no longer need. - - All `RLMObject`, `RLMResults` and `RLMArray` instances obtained from this - `RLMRealm` instance on the current thread are invalidated. `RLMObject`s and `RLMArray`s - cannot be used. `RLMResults` will become empty. The Realm itself remains valid, - and a new read transaction is implicitly begun the next time data is read from the Realm. - - Calling this method multiple times in a row without reading any data from the - Realm, or before ever reading any data from the Realm, is a no-op. This method - may not be called on a read-only Realm. - */ -- (void)invalidate; - -#pragma mark - Accessing Objects - -/** - Returns the same object as the one referenced when the `RLMThreadSafeReference` was first created, - but resolved for the current Realm for this thread. Returns `nil` if this object was deleted after - the reference was created. - - @param reference The thread-safe reference to the thread-confined object to resolve in this Realm. - - @warning A `RLMThreadSafeReference` object must be resolved at most once. - Failing to resolve a `RLMThreadSafeReference` will result in the source version of the - Realm being pinned until the reference is deallocated. - An exception will be thrown if a reference is resolved more than once. - - @warning Cannot call within a write transaction. - - @note Will refresh this Realm if the source Realm was at a later version than this one. - - @see `+[RLMThreadSafeReference referenceWithThreadConfined:]` - */ -- (nullable id)resolveThreadSafeReference:(RLMThreadSafeReference *)reference -NS_REFINED_FOR_SWIFT; - -#pragma mark - Adding and Removing Objects from a Realm - -/** - Adds an object to the Realm. - - Once added, this object is considered to be managed by the Realm. It can be retrieved - using the `objectsWhere:` selectors on `RLMRealm` and on subclasses of `RLMObject`. - - When added, all child relationships referenced by this object will also be added to - the Realm if they are not already in it. - - If the object or any related objects are already being managed by a different Realm - an exception will be thrown. Use `-[RLMObject createInRealm:withObject:]` to insert a copy of a managed object - into a different Realm. - - The object to be added must be valid and cannot have been previously deleted - from a Realm (i.e. `isInvalidated` must be `NO`). - - @warning This method may only be called during a write transaction. - - @param object The object to be added to this Realm. - */ -- (void)addObject:(RLMObject *)object; - -/** - Adds all the objects in a collection to the Realm. - - This is the equivalent of calling `addObject:` for every object in a collection. - - @warning This method may only be called during a write transaction. - - @param array An enumerable object such as `NSArray` or `RLMResults` which contains objects to be added to - the Realm. - - @see `addObject:` - */ -- (void)addObjects:(id)array; - -/** - Adds or updates an existing object into the Realm. - - The object provided must have a designated primary key. If no objects exist in the Realm - with the same primary key value, the object is inserted. Otherwise, the existing object is - updated with any changed values. - - As with `addObject:`, the object cannot already be managed by a different - Realm. Use `-[RLMObject createOrUpdateInRealm:withValue:]` to copy values to - a different Realm. - - @warning This method may only be called during a write transaction. - - @param object The object to be added or updated. - */ -- (void)addOrUpdateObject:(RLMObject *)object; - -/** - Adds or updates all the objects in a collection into the Realm. - - This is the equivalent of calling `addOrUpdateObject:` for every object in a collection. - - @warning This method may only be called during a write transaction. - - @param array An `NSArray`, `RLMArray`, or `RLMResults` of `RLMObject`s (or subclasses) to be added to the Realm. - - @see `addOrUpdateObject:` - */ -- (void)addOrUpdateObjectsFromArray:(id)array; - -/** - Deletes an object from the Realm. Once the object is deleted it is considered invalidated. - - @warning This method may only be called during a write transaction. - - @param object The object to be deleted. - */ -- (void)deleteObject:(RLMObject *)object; - -/** - Deletes one or more objects from the Realm. - - This is the equivalent of calling `deleteObject:` for every object in a collection. - - @warning This method may only be called during a write transaction. - - @param array An `RLMArray`, `NSArray`, or `RLMResults` of `RLMObject`s (or subclasses) to be deleted. - - @see `deleteObject:` - */ -- (void)deleteObjects:(id)array; - -/** - Deletes all objects from the Realm. - - @warning This method may only be called during a write transaction. - - @see `deleteObject:` - */ -- (void)deleteAllObjects; - - -#pragma mark - Migrations - -/** - The type of a migration block used to migrate a Realm. - - @param migration A `RLMMigration` object used to perform the migration. The - migration object allows you to enumerate and alter any - existing objects which require migration. - - @param oldSchemaVersion The schema version of the Realm being migrated. - */ -typedef void (^RLMMigrationBlock)(RLMMigration *migration, uint64_t oldSchemaVersion); - -/** - Returns the schema version for a Realm at a given local URL. - - @param fileURL Local URL to a Realm file. - @param key 64-byte key used to encrypt the file, or `nil` if it is unencrypted. - @param error If an error occurs, upon return contains an `NSError` object - that describes the problem. If you are not interested in - possible errors, pass in `NULL`. - - @return The version of the Realm at `fileURL`, or `RLMNotVersioned` if the version cannot be read. - */ -+ (uint64_t)schemaVersionAtURL:(NSURL *)fileURL encryptionKey:(nullable NSData *)key error:(NSError **)error -NS_REFINED_FOR_SWIFT; - -/** - Performs the given Realm configuration's migration block on a Realm at the given path. - - This method is called automatically when opening a Realm for the first time and does - not need to be called explicitly. You can choose to call this method to control - exactly when and how migrations are performed. - - @param configuration The Realm configuration used to open and migrate the Realm. - @return The error that occurred while applying the migration, if any. - - @see RLMMigration - */ -+ (nullable NSError *)migrateRealm:(RLMRealmConfiguration *)configuration -__deprecated_msg("Use `performMigrationForConfiguration:error:`") NS_REFINED_FOR_SWIFT; - -/** - Performs the given Realm configuration's migration block on a Realm at the given path. - - This method is called automatically when opening a Realm for the first time and does - not need to be called explicitly. You can choose to call this method to control - exactly when and how migrations are performed. - - @param configuration The Realm configuration used to open and migrate the Realm. - @return The error that occurred while applying the migration, if any. - - @see RLMMigration - */ -+ (BOOL)performMigrationForConfiguration:(RLMRealmConfiguration *)configuration error:(NSError **)error; - -@end - -/** - A token which is returned from methods which subscribe to changes to a Realm. - - Change subscriptions in Realm return an `RLMNotificationToken` instance, - which can be used to unsubscribe from the changes. You must store a strong - reference to the token for as long as you want to continue to receive notifications. - When you wish to stop, call the `-stop` method. Notifications are also stopped if - the token is deallocated. - */ -@interface RLMNotificationToken : NSObject -/// Stops notifications for the change subscription that returned this token. -- (void)stop; -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMRealmConfiguration+Sync.h b/Pods/Realm/include/RLMRealmConfiguration+Sync.h deleted file mode 100644 index 2a7aca53..00000000 --- a/Pods/Realm/include/RLMRealmConfiguration+Sync.h +++ /dev/null @@ -1,42 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import "RLMSyncUtil.h" - -@class RLMSyncConfiguration; - -/// :nodoc: -@interface RLMRealmConfiguration (Sync) - -NS_ASSUME_NONNULL_BEGIN - -/** - A configuration object representing configuration state for Realms intended to sync with a Realm Object Server. - - This property is mutually exclusive with both `inMemoryIdentifier` and `fileURL`; setting one will nil out the other - two. - - @see `RLMSyncConfiguration` - */ -@property (nullable, nonatomic) RLMSyncConfiguration *syncConfiguration; - -NS_ASSUME_NONNULL_END - -@end diff --git a/Pods/Realm/include/RLMRealmConfiguration.h b/Pods/Realm/include/RLMRealmConfiguration.h deleted file mode 100644 index 21e163b0..00000000 --- a/Pods/Realm/include/RLMRealmConfiguration.h +++ /dev/null @@ -1,99 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - An `RLMRealmConfiguration` instance describes the different options used to - create an instance of a Realm. - - `RLMRealmConfiguration` instances are just plain `NSObject`s. Unlike `RLMRealm`s - and `RLMObject`s, they can be freely shared between threads as long as you do not - mutate them. - - Creating configuration objects for class subsets (by setting the - `objectClasses` property) can be expensive. Because of this, you will normally want to - cache and reuse a single configuration object for each distinct configuration rather than - creating a new object each time you open a Realm. - */ -@interface RLMRealmConfiguration : NSObject - -#pragma mark - Default Configuration - -/** - Returns the default configuration used to create Realms when no other - configuration is explicitly specified (i.e. `+[RLMRealm defaultRealm]`). - - @return The default Realm configuration. - */ -+ (instancetype)defaultConfiguration; - -/** - Sets the default configuration to the given `RLMRealmConfiguration`. - - @param configuration The new default Realm configuration. - */ -+ (void)setDefaultConfiguration:(RLMRealmConfiguration *)configuration; - -#pragma mark - Properties - -/// The local URL of the Realm file. Mutually exclusive with `inMemoryIdentifier`. -@property (nonatomic, copy, nullable) NSURL *fileURL; - -/// A string used to identify a particular in-memory Realm. Mutually exclusive with `fileURL`. -@property (nonatomic, copy, nullable) NSString *inMemoryIdentifier; - -/// A 64-byte key to use to encrypt the data, or `nil` if encryption is not enabled. -@property (nonatomic, copy, nullable) NSData *encryptionKey; - -/// Whether to open the Realm in read-only mode. -/// -/// This is required to be able to open Realm files which are not writeable or -/// are in a directory which is not writeable. This should only be used on files -/// which will not be modified by anyone while they are open, and not just to -/// get a read-only view of a file which may be written to by another thread or -/// process. Opening in read-only mode requires disabling Realm's reader/writer -/// coordination, so committing a write transaction from another process will -/// result in crashes. -@property (nonatomic) BOOL readOnly; - -/// The current schema version. -@property (nonatomic) uint64_t schemaVersion; - -/// The block which migrates the Realm to the current version. -@property (nonatomic, copy, nullable) RLMMigrationBlock migrationBlock; - -/** - Whether to recreate the Realm file with the provided schema if a migration is required. - This is the case when the stored schema differs from the provided schema or - the stored schema version differs from the version on this configuration. - Setting this property to `YES` deletes the file if a migration would otherwise be required or executed. - - @note Setting this property to `YES` doesn't disable file format migrations. - */ -@property (nonatomic) BOOL deleteRealmIfMigrationNeeded; - -/// The classes managed by the Realm. -@property (nonatomic, copy, nullable) NSArray *objectClasses; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMRealmConfiguration_Private.h b/Pods/Realm/include/RLMRealmConfiguration_Private.h deleted file mode 100644 index 7581af19..00000000 --- a/Pods/Realm/include/RLMRealmConfiguration_Private.h +++ /dev/null @@ -1,42 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -@class RLMSchema; - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMRealmConfiguration () - -@property (nonatomic, readwrite) bool cache; -@property (nonatomic, readwrite) bool dynamic; -@property (nonatomic, readwrite) bool disableFormatUpgrade; -@property (nonatomic, copy, nullable) RLMSchema *customSchema; - -// Get the default confiugration without copying it -+ (RLMRealmConfiguration *)rawDefaultConfiguration; - -+ (void)resetRealmConfigurationState; -@end - -// Get a path in the platform-appropriate documents directory with the given filename -FOUNDATION_EXTERN NSString *RLMRealmPathForFile(NSString *fileName); -FOUNDATION_EXTERN NSString *RLMRealmPathForFileAndBundleIdentifier(NSString *fileName, NSString *mainBundleIdentifier); - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMRealmConfiguration_Private.hpp b/Pods/Realm/include/RLMRealmConfiguration_Private.hpp deleted file mode 100644 index a89fb0fd..00000000 --- a/Pods/Realm/include/RLMRealmConfiguration_Private.hpp +++ /dev/null @@ -1,26 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMRealmConfiguration_Private.h" -#import "shared_realm.hpp" - -@interface RLMRealmConfiguration () -- (realm::Realm::Config&)config; - -@property (nonatomic) realm::SchemaMode schemaMode; -@end diff --git a/Pods/Realm/include/RLMRealmUtil.hpp b/Pods/Realm/include/RLMRealmUtil.hpp deleted file mode 100644 index 36dbc844..00000000 --- a/Pods/Realm/include/RLMRealmUtil.hpp +++ /dev/null @@ -1,38 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import -#import - -@class RLMRealm; - -namespace realm { - class BindingContext; -} - -// Add a Realm to the weak cache -void RLMCacheRealm(std::string const& path, RLMRealm *realm); -// Get a Realm for the given path which can be used on the current thread -RLMRealm *RLMGetThreadLocalCachedRealmForPath(std::string const& path); -// Get a Realm for the given path -RLMRealm *RLMGetAnyCachedRealmForPath(std::string const& path); -// Clear the weak cache of Realms -void RLMClearRealmCache(); - -std::unique_ptr RLMCreateBindingContext(RLMRealm *realm); diff --git a/Pods/Realm/include/RLMRealm_Dynamic.h b/Pods/Realm/include/RLMRealm_Dynamic.h deleted file mode 100644 index 3a26f494..00000000 --- a/Pods/Realm/include/RLMRealm_Dynamic.h +++ /dev/null @@ -1,118 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import -#import - -@class RLMResults; - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMRealm (Dynamic) - -#pragma mark - Getting Objects from a Realm - -/** - Returns all objects of a given type from the Realm. - - @warning This method is useful only in specialized circumstances, for example, when building components - that integrate with Realm. The preferred way to get objects of a single class is to use the class - methods on `RLMObject`. - - @param className The name of the `RLMObject` subclass to retrieve on (e.g. `MyClass.className`). - - @return An `RLMResults` containing all objects in the Realm of the given type. - - @see `+[RLMObject allObjects]` - */ -- (RLMResults *)allObjects:(NSString *)className; - -/** - Returns all objects matching the given predicate from the Realm. - - @warning This method is useful only in specialized circumstances, for example, when building components - that integrate with Realm. The preferred way to get objects of a single class is to use the class - methods on `RLMObject`. - - @param className The type of objects you are looking for (name of the class). - @param predicateFormat A predicate format string, optionally followed by a variable number of arguments. - - @return An `RLMResults` containing results matching the given predicate. - - @see `+[RLMObject objectsWhere:]` - */ -- (RLMResults *)objects:(NSString *)className where:(NSString *)predicateFormat, ...; - -/** - Returns all objects matching the given predicate from the Realm. - - @warning This method is useful only in specialized circumstances, for example, when building components - that integrate with Realm. The preferred way to get objects of a single class is to use the class - methods on `RLMObject`. - - @param className The type of objects you are looking for (name of the class). - @param predicate The predicate with which to filter the objects. - - @return An `RLMResults` containing results matching the given predicate. - - @see `+[RLMObject objectsWhere:]` - */ -- (RLMResults *)objects:(NSString *)className withPredicate:(NSPredicate *)predicate; - -/** - Returns the object of the given type with the given primary key from the Realm. - - @warning This method is useful only in specialized circumstances, for example, when building components - that integrate with Realm. The preferred way to get an object of a single class is to use the class - methods on `RLMObject`. - - @param className The class name for the object you are looking for. - @param primaryKey The primary key value for the object you are looking for. - - @return An object, or `nil` if an object with the given primary key does not exist. - - @see `+[RLMObject objectForPrimaryKey:]` - */ -- (nullable RLMObject *)objectWithClassName:(NSString *)className forPrimaryKey:(id)primaryKey; - -/** - Creates an `RLMObject` instance of type `className` in the Realm, and populates it using a given object. - - The `value` argument is used to populate the object. It can be a key-value coding compliant object, an array or - dictionary returned from the methods in `NSJSONSerialization`, or an array containing one element for each managed - property. An exception will be thrown if any required properties are not present and those properties were not defined - with default values. - - When passing in an array as the `value` argument, all properties must be present, valid and in the same order as the - properties defined in the model. - - @warning This method is useful only in specialized circumstances, for example, when building components - that integrate with Realm. If you are simply building an app on Realm, it is recommended to - use `[RLMObject createInDefaultRealmWithValue:]`. - - @param value The value used to populate the object. - - @return An `RLMObject` instance of type `className`. - */ --(RLMObject *)createObject:(NSString *)className withValue:(id)value; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMRealm_Private.h b/Pods/Realm/include/RLMRealm_Private.h deleted file mode 100644 index c8ca2d27..00000000 --- a/Pods/Realm/include/RLMRealm_Private.h +++ /dev/null @@ -1,52 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -@class RLMFastEnumerator; - -NS_ASSUME_NONNULL_BEGIN - -// Disable syncing files to disk. Cannot be re-enabled. Use only for tests. -FOUNDATION_EXTERN void RLMDisableSyncToDisk(); - -FOUNDATION_EXTERN NSData * _Nullable RLMRealmValidatedEncryptionKey(NSData *key); - -// Translate an in-flight exception resulting from opening a SharedGroup to -// an NSError or NSException (if error is nil) -void RLMRealmTranslateException(NSError **error); - -// RLMRealm private members -@interface RLMRealm () - -@property (nonatomic, readonly) BOOL dynamic; -@property (nonatomic, readwrite) RLMSchema *schema; - -+ (void)resetRealmState; - -- (void)registerEnumerator:(RLMFastEnumerator *)enumerator; -- (void)unregisterEnumerator:(RLMFastEnumerator *)enumerator; -- (void)detachAllEnumerators; - -- (void)sendNotifications:(RLMNotification)notification; -- (void)verifyThread; -- (void)verifyNotificationsAreSupported; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMRealm_Private.hpp b/Pods/Realm/include/RLMRealm_Private.hpp deleted file mode 100644 index a1bb294a..00000000 --- a/Pods/Realm/include/RLMRealm_Private.hpp +++ /dev/null @@ -1,36 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMRealm_Private.h" - -#import "RLMClassInfo.hpp" - -namespace realm { - class Group; - class Realm; -} - -@interface RLMRealm () { - @public - std::shared_ptr _realm; - RLMSchemaInfo _info; -} - -// FIXME - group should not be exposed -@property (nonatomic, readonly) realm::Group &group; -@end diff --git a/Pods/Realm/include/RLMResults.h b/Pods/Realm/include/RLMResults.h deleted file mode 100644 index 24fda51e..00000000 --- a/Pods/Realm/include/RLMResults.h +++ /dev/null @@ -1,343 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RLMObject, RLMRealm, RLMNotificationToken; - -/** - `RLMResults` is an auto-updating container type in Realm returned from object - queries. It represents the results of the query in the form of a collection of objects. - - `RLMResults` can be queried using the same predicates as `RLMObject` and `RLMArray`, - and you can chain queries to further filter results. - - `RLMResults` always reflect the current state of the Realm on the current thread, - including during write transactions on the current thread. The one exception to - this is when using `for...in` fast enumeration, which will always enumerate - over the objects which matched the query when the enumeration is begun, even if - some of them are deleted or modified to be excluded by the filter during the - enumeration. - - `RLMResults` are lazily evaluated the first time they are accessed; they only - run queries when the result of the query is requested. This means that - chaining several temporary `RLMResults` to sort and filter your data does not - perform any extra work processing the intermediate state. - - Once the results have been evaluated or a notification block has been added, - the results are eagerly kept up-to-date, with the work done to keep them - up-to-date done on a background thread whenever possible. - - `RLMResults` cannot be directly instantiated. - */ -@interface RLMResults : NSObject - -#pragma mark - Properties - -/** - The number of objects in the results collection. - */ -@property (nonatomic, readonly, assign) NSUInteger count; - -/** - The class name (i.e. type) of the `RLMObject`s contained in the results collection. - */ -@property (nonatomic, readonly, copy) NSString *objectClassName; - -/** - The Realm which manages this results collection. - */ -@property (nonatomic, readonly) RLMRealm *realm; - -/** - Indicates if the results collection is no longer valid. - - The results collection becomes invalid if `invalidate` is called on the containing `realm`. - An invalidated results collection can be accessed, but will always be empty. - */ -@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated; - -#pragma mark - Accessing Objects from an RLMResults - -/** - Returns the object at the index specified. - - @param index The index to look up. - - @return An `RLMObject` of the type contained in the results collection. - */ -- (RLMObjectType)objectAtIndex:(NSUInteger)index; - -/** - Returns the first object in the results collection. - - Returns `nil` if called on an empty results collection. - - @return An `RLMObject` of the type contained in the results collection. - */ -- (nullable RLMObjectType)firstObject; - -/** - Returns the last object in the results collection. - - Returns `nil` if called on an empty results collection. - - @return An `RLMObject` of the type contained in the results collection. - */ -- (nullable RLMObjectType)lastObject; - -#pragma mark - Querying Results - -/** - Returns the index of an object in the results collection. - - Returns `NSNotFound` if the object is not found in the results collection. - - @param object An object (of the same type as returned from the `objectClassName` selector). - */ -- (NSUInteger)indexOfObject:(RLMObjectType)object; - -/** - Returns the index of the first object in the results collection matching the predicate. - - @param predicateFormat A predicate format string, optionally followed by a variable number of arguments. - - @return The index of the object, or `NSNotFound` if the object is not found in the results collection. - */ -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat, ...; - -/// :nodoc: -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args; - -/** - Returns the index of the first object in the results collection matching the predicate. - - @param predicate The predicate with which to filter the objects. - - @return The index of the object, or `NSNotFound` if the object is not found in the results collection. - */ -- (NSUInteger)indexOfObjectWithPredicate:(NSPredicate *)predicate; - -/** - Returns all the objects matching the given predicate in the results collection. - - @param predicateFormat A predicate format string, optionally followed by a variable number of arguments. - - @return An `RLMResults` of objects that match the given predicate. - */ -- (RLMResults *)objectsWhere:(NSString *)predicateFormat, ...; - -/// :nodoc: -- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args; - -/** - Returns all the objects matching the given predicate in the results collection. - - @param predicate The predicate with which to filter the objects. - - @return An `RLMResults` of objects that match the given predicate. - */ -- (RLMResults *)objectsWithPredicate:(NSPredicate *)predicate; - -/** - Returns a sorted `RLMResults` from an existing results collection. - - @param keyPath The key path to sort by. - @param ascending The direction to sort in. - - @return An `RLMResults` sorted by the specified key path. - */ -- (RLMResults *)sortedResultsUsingKeyPath:(NSString *)keyPath ascending:(BOOL)ascending; - -/** - Returns a sorted `RLMResults` from an existing results collection. - - @param property The property name to sort by. - @param ascending The direction to sort in. - - @return An `RLMResults` sorted by the specified property. - */ -- (RLMResults *)sortedResultsUsingProperty:(NSString *)property ascending:(BOOL)ascending - __deprecated_msg("Use `-sortedResultsUsingKeyPath:ascending:`"); - -/** - Returns a sorted `RLMResults` from an existing results collection. - - @param properties An array of `RLMSortDescriptor`s to sort by. - - @return An `RLMResults` sorted by the specified properties. - */ -- (RLMResults *)sortedResultsUsingDescriptors:(NSArray *)properties; - -#pragma mark - Notifications - -/** - Registers a block to be called each time the results collection changes. - - The block will be asynchronously called with the initial results collection, - and then called again after each write transaction which changes either any - of the objects in the results, or which objects are in the results. - - The `change` parameter will be `nil` the first time the block is called. - For each call after that, it will contain information about - which rows in the results collection were added, removed or modified. If a - write transaction did not modify any objects in the results collection, - the block is not called at all. See the `RLMCollectionChange` documentation for - information on how the changes are reported and an example of updating a - `UITableView`. - - If an error occurs the block will be called with `nil` for the results - parameter and a non-`nil` error. Currently the only errors that can occur are - when opening the Realm on the background worker thread. - - At the time when the block is called, the `RLMResults` object will be fully - evaluated and up-to-date, and as long as you do not perform a write transaction - on the same thread or explicitly call `-[RLMRealm refresh]`, accessing it will - never perform blocking work. - - Notifications are delivered via the standard run loop, and so can't be - delivered while the run loop is blocked by other activity. When - notifications can't be delivered instantly, multiple notifications may be - coalesced into a single notification. This can include the notification - with the initial results. For example, the following code performs a write - transaction immediately after adding the notification block, so there is no - opportunity for the initial notification to be delivered first. As a - result, the initial notification will reflect the state of the Realm after - the write transaction. - - RLMResults *results = [Dog allObjects]; - NSLog(@"dogs.count: %zu", dogs.count); // => 0 - self.token = [results addNotificationBlock:^(RLMResults *dogs, - RLMCollectionChange *changes, - NSError *error) { - // Only fired once for the example - NSLog(@"dogs.count: %zu", dogs.count); // => 1 - }]; - [realm transactionWithBlock:^{ - Dog *dog = [[Dog alloc] init]; - dog.name = @"Rex"; - [realm addObject:dog]; - }]; - // end of run loop execution context - - You must retain the returned token for as long as you want updates to continue - to be sent to the block. To stop receiving updates, call `-stop` on the token. - - @warning This method cannot be called during a write transaction, or when the - containing Realm is read-only. - - @param block The block to be called whenever a change occurs. - @return A token which must be held for as long as you want updates to be delivered. - */ -- (RLMNotificationToken *)addNotificationBlock:(void (^)(RLMResults *__nullable results, - RLMCollectionChange *__nullable change, - NSError *__nullable error))block __attribute__((warn_unused_result)); - -#pragma mark - Aggregating Property Values - -/** - Returns the minimum (lowest) value of the given property among all the objects - represented by the results collection. - - NSNumber *min = [results minOfProperty:@"age"]; - - @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties. - - @param property The property whose minimum value is desired. Only properties of types `int`, `float`, `double`, and - `NSDate` are supported. - - @return The minimum value of the property. - */ -- (nullable id)minOfProperty:(NSString *)property; - -/** - Returns the maximum (highest) value of the given property among all the objects represented by the results collection. - - NSNumber *max = [results maxOfProperty:@"age"]; - - @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties. - - @param property The property whose maximum value is desired. Only properties of types `int`, `float`, `double`, and - `NSDate` are supported. - - @return The maximum value of the property. - */ -- (nullable id)maxOfProperty:(NSString *)property; - -/** - Returns the sum of the values of a given property over all the objects represented by the results collection. - - NSNumber *sum = [results sumOfProperty:@"age"]; - - @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties. - - @param property The property whose values should be summed. Only properties of types `int`, `float`, and `double` are - supported. - - @return The sum of the given property. - */ -- (NSNumber *)sumOfProperty:(NSString *)property; - -/** - Returns the average value of a given property over the objects represented by the results collection. - - NSNumber *average = [results averageOfProperty:@"age"]; - - @warning You cannot use this method on `RLMObject`, `RLMArray`, and `NSData` properties. - - @param property The property whose average value should be calculated. Only properties of types `int`, `float`, and - `double` are supported. - - @return The average value of the given property. This will be of type `double` for both `float` and `double` - properties. - */ -- (nullable NSNumber *)averageOfProperty:(NSString *)property; - -/// :nodoc: -- (RLMObjectType)objectAtIndexedSubscript:(NSUInteger)index; - -#pragma mark - Unavailable Methods - -/** - `-[RLMResults init]` is not available because `RLMResults` cannot be created directly. - `RLMResults` can be obtained by querying a Realm. - */ -- (instancetype)init __attribute__((unavailable("RLMResults cannot be created directly"))); - -/** - `+[RLMResults new]` is not available because `RLMResults` cannot be created directly. - `RLMResults` can be obtained by querying a Realm. - */ -+ (instancetype)new __attribute__((unavailable("RLMResults cannot be created directly"))); - -@end - -/** - `RLMLinkingObjects` is an auto-updating container type. It represents a collection of objects that link to its - parent object. - - For more information, please see the "Inverse Relationships" section in the - [documentation](https://realm.io/docs/objc/latest/#relationships). - */ -@interface RLMLinkingObjects : RLMResults -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMResults_Private.h b/Pods/Realm/include/RLMResults_Private.h deleted file mode 100644 index f74b4fda..00000000 --- a/Pods/Realm/include/RLMResults_Private.h +++ /dev/null @@ -1,32 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -@class RLMObjectSchema; - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMResults () -@property (nonatomic, readonly, getter=isAttached) BOOL attached; - -+ (instancetype)emptyDetachedResults; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSchema.h b/Pods/Realm/include/RLMSchema.h deleted file mode 100644 index 2b117928..00000000 --- a/Pods/Realm/include/RLMSchema.h +++ /dev/null @@ -1,77 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RLMObjectSchema; - -/** - `RLMSchema` instances represent collections of model object schemas managed by a Realm. - - When using Realm, `RLMSchema` instances allow performing migrations and - introspecting the database's schema. - - Schemas map to collections of tables in the core database. - */ -@interface RLMSchema : NSObject - -#pragma mark - Properties - -/** - An `NSArray` containing `RLMObjectSchema`s for all object types in the Realm. - - This property is intended to be used during migrations for dynamic introspection. - - @see `RLMObjectSchema` - */ -@property (nonatomic, readonly, copy) NSArray *objectSchema; - -#pragma mark - Methods - -/** - Returns an `RLMObjectSchema` for the given class name in the schema. - - @param className The object class name. - @return An `RLMObjectSchema` for the given class in the schema. - - @see `RLMObjectSchema` - */ -- (nullable RLMObjectSchema *)schemaForClassName:(NSString *)className; - -/** - Looks up and returns an `RLMObjectSchema` for the given class name in the Realm. - - If there is no object of type `className` in the schema, an exception will be thrown. - - @param className The object class name. - @return An `RLMObjectSchema` for the given class in this Realm. - - @see `RLMObjectSchema` - */ -- (RLMObjectSchema *)objectForKeyedSubscript:(NSString *)className; - -/** - Returns whether two `RLMSchema` instances are equivalent. - */ -- (BOOL)isEqualToSchema:(RLMSchema *)schema; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSchema_Private.h b/Pods/Realm/include/RLMSchema_Private.h deleted file mode 100644 index f5823d11..00000000 --- a/Pods/Realm/include/RLMSchema_Private.h +++ /dev/null @@ -1,54 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RLMRealm; - -// -// RLMSchema private interface -// -@interface RLMSchema () - -/** - Returns an `RLMSchema` containing only the given `RLMObject` subclasses. - - @param classes The classes to be included in the schema. - - @return An `RLMSchema` containing only the given classes. - */ -+ (instancetype)schemaWithObjectClasses:(NSArray *)classes; - -@property (nonatomic, readwrite, copy) NSArray *objectSchema; - -// schema based on runtime objects -+ (instancetype)sharedSchema; - -// schema based upon all currently registered object classes -+ (instancetype)partialSharedSchema; - -// class for string -+ (nullable Class)classForString:(NSString *)className; - -+ (nullable RLMObjectSchema *)sharedSchemaForClass:(Class)cls; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSchema_Private.hpp b/Pods/Realm/include/RLMSchema_Private.hpp deleted file mode 100644 index 197ddeee..00000000 --- a/Pods/Realm/include/RLMSchema_Private.hpp +++ /dev/null @@ -1,31 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSchema_Private.h" - -#import - -namespace realm { - class Schema; - class ObjectSchema; -} - -@interface RLMSchema () -+ (instancetype)dynamicSchemaFromObjectStoreSchema:(realm::Schema const&)objectStoreSchema; -- (realm::Schema)objectStoreCopy; -@end diff --git a/Pods/Realm/include/RLMSwiftBridgingHeader.h b/Pods/Realm/include/RLMSwiftBridgingHeader.h deleted file mode 100644 index 47580437..00000000 --- a/Pods/Realm/include/RLMSwiftBridgingHeader.h +++ /dev/null @@ -1,49 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import - -@interface RLMRealm (Swift) -+ (void)resetRealmState; -@end - -@interface RLMArray (Swift) - -- (instancetype)initWithObjectClassName:(NSString *)objectClassName; - -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args; -- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args; - -@end - -@interface RLMResults (Swift) - -- (NSUInteger)indexOfObjectWhere:(NSString *)predicateFormat args:(va_list)args; -- (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args; - -@end - -@interface RLMObjectBase (Swift) - -- (instancetype)initWithRealm:(RLMRealm *)realm schema:(RLMObjectSchema *)schema defaultValues:(BOOL)useDefaults; - -+ (RLMResults *)objectsWhere:(NSString *)predicateFormat args:(va_list)args; -+ (RLMResults *)objectsInRealm:(RLMRealm *)realm where:(NSString *)predicateFormat args:(va_list)args; - -@end diff --git a/Pods/Realm/include/RLMSwiftSupport.h b/Pods/Realm/include/RLMSwiftSupport.h deleted file mode 100644 index 6e45b654..00000000 --- a/Pods/Realm/include/RLMSwiftSupport.h +++ /dev/null @@ -1,30 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMSwiftSupport : NSObject - -+ (BOOL)isSwiftClassName:(NSString *)className; -+ (NSString *)demangleClassName:(NSString *)className; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncConfiguration.h b/Pods/Realm/include/RLMSyncConfiguration.h deleted file mode 100644 index 6181d91d..00000000 --- a/Pods/Realm/include/RLMSyncConfiguration.h +++ /dev/null @@ -1,60 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -@class RLMSyncUser; - -NS_ASSUME_NONNULL_BEGIN - -/** - A configuration object representing configuration state for a Realm which is intended to sync with a Realm Object - Server. - */ -@interface RLMSyncConfiguration : NSObject - -/// The user to which the remote Realm belongs. -@property (nonatomic, readonly) RLMSyncUser *user; - -/** - The URL of the remote Realm upon the Realm Object Server. - - @warning The URL cannot end with `.realm`, `.realm.lock` or `.realm.management`. - */ -@property (nonatomic, readonly) NSURL *realmURL; - -/** - Create a sync configuration instance. - - @param user A `RLMSyncUser` that owns the Realm at the given URL. - @param url The unresolved absolute URL to the Realm on the Realm Object Server, e.g. - `realm://example.org/~/path/to/realm`. "Unresolved" means the path should - contain the wildcard marker `~`, which will automatically be filled in with - the user identity by the Realm Object Server. - */ -- (instancetype)initWithUser:(RLMSyncUser *)user realmURL:(NSURL *)url; - -/// :nodoc: -- (instancetype)init __attribute__((unavailable("This type cannot be created directly"))); - -/// :nodoc: -+ (instancetype)new __attribute__((unavailable("This type cannot be created directly"))); - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncConfiguration_Private.h b/Pods/Realm/include/RLMSyncConfiguration_Private.h deleted file mode 100644 index 1001ae86..00000000 --- a/Pods/Realm/include/RLMSyncConfiguration_Private.h +++ /dev/null @@ -1,38 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -NS_ASSUME_NONNULL_BEGIN - -typedef NS_ENUM(NSUInteger, RLMSyncStopPolicy) { - RLMSyncStopPolicyImmediately, - RLMSyncStopPolicyLiveIndefinitely, - RLMSyncStopPolicyAfterChangesUploaded, -}; - -@interface RLMSyncConfiguration () - -@property (nonatomic, readwrite) RLMSyncStopPolicy stopPolicy; - -// Internal-only APIs -@property (nullable, nonatomic) NSURL *customFileURL; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncConfiguration_Private.hpp b/Pods/Realm/include/RLMSyncConfiguration_Private.hpp deleted file mode 100644 index 1a80e7f4..00000000 --- a/Pods/Realm/include/RLMSyncConfiguration_Private.hpp +++ /dev/null @@ -1,31 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncConfiguration_Private.h" - -namespace realm { -struct SyncConfig; -} - -@interface RLMSyncConfiguration () - -- (instancetype)initWithRawConfig:(realm::SyncConfig)config; - -- (realm::SyncConfig)rawConfiguration; - -@end diff --git a/Pods/Realm/include/RLMSyncCredentials.h b/Pods/Realm/include/RLMSyncCredentials.h deleted file mode 100644 index bb19fbef..00000000 --- a/Pods/Realm/include/RLMSyncCredentials.h +++ /dev/null @@ -1,106 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import "RLMSyncUtil.h" - -NS_ASSUME_NONNULL_BEGIN - -/// A token representing an identity provider's credentials. -typedef NSString *RLMSyncCredentialsToken; - -/// A type representing the unique identifier of a Realm Object Server identity provider. -typedef NSString *RLMIdentityProvider RLM_EXTENSIBLE_STRING_ENUM; - -/// The debug identity provider, which accepts any token string and creates a user associated with that token if one -/// does not yet exist. Not enabled for Realm Object Server configured for production. -extern RLMIdentityProvider const RLMIdentityProviderDebug; - -/// The username/password identity provider. User accounts are handled by the Realm Object Server directly without the -/// involvement of a third-party identity provider. -extern RLMIdentityProvider const RLMIdentityProviderUsernamePassword; - -/// A Facebook account as an identity provider. -extern RLMIdentityProvider const RLMIdentityProviderFacebook; - -/// A Google account as an identity provider. -extern RLMIdentityProvider const RLMIdentityProviderGoogle; - -/// A CloudKit account as an identity provider. -extern RLMIdentityProvider const RLMIdentityProviderCloudKit; - -/** - Opaque credentials representing a specific Realm Object Server user. - */ -@interface RLMSyncCredentials : NSObject - -/// An opaque credentials token containing information that uniquely identifies a Realm Object Server user. -@property (nonatomic, readonly) RLMSyncCredentialsToken token; - -/// The name of the identity provider which generated the credentials token. -@property (nonatomic, readonly) RLMIdentityProvider provider; - -/// A dictionary containing additional pertinent information. In most cases this is automatically configured. -@property (nonatomic, readonly) NSDictionary *userInfo; - -/** - Construct and return credentials from a Facebook account token. - */ -+ (instancetype)credentialsWithFacebookToken:(RLMSyncCredentialsToken)token; - -/** - Construct and return credentials from a Google account token. - */ -+ (instancetype)credentialsWithGoogleToken:(RLMSyncCredentialsToken)token; - -/** - Construct and return credentials from an CloudKit account token. - */ -+ (instancetype)credentialsWithCloudKitToken:(RLMSyncCredentialsToken)token; - -/** - Construct and return credentials from a Realm Object Server username and password. - */ -+ (instancetype)credentialsWithUsername:(NSString *)username - password:(NSString *)password - register:(BOOL)shouldRegister; - -/** - Construct and return special credentials representing a token that can be directly used to open a Realm. The identity - is used to uniquely identify the user across application launches. - */ -+ (instancetype)credentialsWithAccessToken:(RLMServerToken)accessToken identity:(NSString *)identity; - -/** - Construct and return credentials with a custom token string, identity provider string, and optional user info. In most - cases, the convenience initializers should be used instead. - */ -- (instancetype)initWithCustomToken:(RLMSyncCredentialsToken)token - provider:(RLMIdentityProvider)provider - userInfo:(nullable NSDictionary *)userInfo NS_DESIGNATED_INITIALIZER; - -/// :nodoc: -- (instancetype)init __attribute__((unavailable("RLMSyncCredentials cannot be created directly"))); - -/// :nodoc: -+ (instancetype)new __attribute__((unavailable("RLMSyncCredentials cannot be created directly"))); - -NS_ASSUME_NONNULL_END - -@end diff --git a/Pods/Realm/include/RLMSyncErrorResponseModel.h b/Pods/Realm/include/RLMSyncErrorResponseModel.h deleted file mode 100644 index 930a7ea6..00000000 --- a/Pods/Realm/include/RLMSyncErrorResponseModel.h +++ /dev/null @@ -1,36 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import "RLMSyncUtil_Private.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMSyncErrorResponseModel : NSObject RLM_SYNC_UNINITIALIZABLE - -@property (nonatomic, readonly, assign) NSInteger status; -@property (nonatomic, readonly, assign) NSInteger code; -@property (nonatomic, readonly, copy) NSString *title; -@property (nonatomic, readonly, copy) NSString *hint; - -- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary; - -@end - - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncManager.h b/Pods/Realm/include/RLMSyncManager.h deleted file mode 100644 index e2f559ff..00000000 --- a/Pods/Realm/include/RLMSyncManager.h +++ /dev/null @@ -1,102 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import "RLMSyncUtil.h" - -@class RLMSyncSession; - -/// An enum representing different levels of sync-related logging that can be configured. -typedef NS_ENUM(NSUInteger, RLMSyncLogLevel) { - /// Nothing will ever be logged. - RLMSyncLogLevelOff, - /// Only fatal errors will be logged. - RLMSyncLogLevelFatal, - /// Only errors will be logged. - RLMSyncLogLevelError, - /// Warnings and errors will be logged. - RLMSyncLogLevelWarn, - /// Information about sync events will be logged. Fewer events will be logged in order to avoid overhead. - RLMSyncLogLevelInfo, - /// Information about sync events will be logged. More events will be logged than with `RLMSyncLogLevelInfo`. - RLMSyncLogLevelDetail, - /// Log information that can aid in debugging. - /// - /// - warning: Will incur a measurable performance impact. - RLMSyncLogLevelDebug, - /// Log information that can aid in debugging. More events will be logged than with `RLMSyncLogLevelDebug`. - /// - /// - warning: Will incur a measurable performance impact. - RLMSyncLogLevelTrace, - /// Log information that can aid in debugging. More events will be logged than with `RLMSyncLogLevelTrace`. - /// - /// - warning: Will incur a measurable performance impact. - RLMSyncLogLevelAll -}; - -NS_ASSUME_NONNULL_BEGIN - -/// A block type representing a block which can be used to report a sync-related error to the application. If the error -/// pertains to a specific session, that session will also be passed into the block. -typedef void(^RLMSyncErrorReportingBlock)(NSError *, RLMSyncSession * _Nullable); - -/** - A singleton manager which serves as a central point for sync-related configuration. - */ -@interface RLMSyncManager : NSObject - -/** - An optional block which can be used to report sync-related errors to your application. Errors reported through this - mechanism are always fatal; they represent attempts to open sessions which are invalid (for example, using malformed - URLs). - */ -@property (nullable, nonatomic, copy) RLMSyncErrorReportingBlock errorHandler; - -/** - A reverse-DNS string uniquely identifying this application. In most cases this is automatically set by the SDK, and - does not have to be explicitly configured. - */ -@property (nonatomic, copy) NSString *appID; - -/** - Whether SSL certificate validation should be disabled. SSL certificate validation is ON by default. Setting this - property after at least one synced Realm or standalone Session has been opened is a no-op. - - @warning NEVER disable certificate validation for clients and servers in production. - */ -@property (nonatomic) BOOL disableSSLValidation; - -/** - The logging threshold which newly opened synced Realms will use. Defaults to `RLMSyncLogLevelInfo`. Set this before - any synced Realms are opened. Logging strings are output to ASL. - */ -@property (nonatomic) RLMSyncLogLevel logLevel; - -/// The sole instance of the singleton. -+ (instancetype)sharedManager NS_REFINED_FOR_SWIFT; - -/// :nodoc: -- (instancetype)init __attribute__((unavailable("RLMSyncManager cannot be created directly"))); - -/// :nodoc: -+ (instancetype)new __attribute__((unavailable("RLMSyncManager cannot be created directly"))); - -NS_ASSUME_NONNULL_END - -@end diff --git a/Pods/Realm/include/RLMSyncManager_Private.h b/Pods/Realm/include/RLMSyncManager_Private.h deleted file mode 100644 index 89fb2af5..00000000 --- a/Pods/Realm/include/RLMSyncManager_Private.h +++ /dev/null @@ -1,60 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import "RLMSyncUtil_Private.h" - -typedef NS_ENUM(NSUInteger, RLMSyncSystemErrorKind) { - // Specific - RLMSyncSystemErrorKindClientReset, - // General - RLMSyncSystemErrorKindClient, - RLMSyncSystemErrorKindConnection, - RLMSyncSystemErrorKindSession, - RLMSyncSystemErrorKindUser, - RLMSyncSystemErrorKindUnknown, -}; - -@class RLMSyncUser, RLMSyncConfiguration; - -// All private API methods are threadsafe and synchronized, unless denoted otherwise. Since they are expected to be -// called very infrequently, this should pose no issues. - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMSyncManager () - -@property (nullable, nonatomic, copy) RLMSyncBasicErrorReportingBlock sessionCompletionNotifier; - -- (void)_fireError:(NSError *)error; - -- (void)_fireErrorWithCode:(int)errorCode - message:(NSString *)message - isFatal:(BOOL)fatal - session:(RLMSyncSession *)session - userInfo:(NSDictionary *)userInfo - errorClass:(RLMSyncSystemErrorKind)errorClass; - -- (NSArray *)_allUsers; - -+ (void)resetForTesting; - -NS_ASSUME_NONNULL_END - -@end diff --git a/Pods/Realm/include/RLMSyncPermissionChange.h b/Pods/Realm/include/RLMSyncPermissionChange.h deleted file mode 100644 index 2b19da11..00000000 --- a/Pods/Realm/include/RLMSyncPermissionChange.h +++ /dev/null @@ -1,91 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@class RLMSyncUser; - -/** - This model is used for requesting changes to a Realm's permissions. - - It should be used in conjunction with an `RLMSyncUser`'s management Realm. - - See https://realm.io/docs/realm-object-server/#permissions for general - documentation. - */ -@interface RLMSyncPermissionChange : RLMObject - -/// The globally unique ID string of this permission change object. -@property (readonly) NSString *id; - -/// The date this object was initially created. -@property (readonly) NSDate *createdAt; - -/// The date this object was last modified. -@property (readonly) NSDate *updatedAt; - -/// The status code of the object that was processed by Realm Object Server. -@property (nullable, readonly) NSNumber *statusCode; - -/// An error or informational message, typically written to by the Realm Object Server. -@property (nullable, readonly) NSString *statusMessage; - -/// Sync management object status. -@property (readonly) RLMSyncManagementObjectStatus status; - -/// The remote URL to the realm. -@property (readonly) NSString *realmUrl; - -/// The identity of a user affected by this permission change. -@property (readonly) NSString *userId; - -/// Define read access. Set to `YES` or `NO` to update this value. Leave unset to preserve the existing setting. -@property (nullable, readonly) NSNumber *mayRead; -/// Define write access. Set to `YES` or `NO` to update this value. Leave unset to preserve the existing setting. -@property (nullable, readonly) NSNumber *mayWrite; -/// Define management access. Set to `YES` or `NO` to update this value. Leave unset to preserve the existing setting. -@property (nullable, readonly) NSNumber *mayManage; - -/** - Construct a permission change object used to change the access permissions for a user on a Realm. - - @param realmURL The Realm URL whose permissions settings should be changed. - Use `*` to change the permissions of all Realms managed by the management Realm's `RLMSyncUser`. - @param userID The user or users who should be granted these permission changes. - Use `*` to change the permissions for all users. - @param mayRead Define read access. Set to `YES` or `NO` to update this value. - Leave unset to preserve the existing setting. - @param mayWrite Define write access. Set to `YES` or `NO` to update this value. - Leave unset to preserve the existing setting. - @param mayManage Define management access. Set to `YES` or `NO` to update this value. - Leave unset to preserve the existing setting. - */ -+ (instancetype)permissionChangeWithRealmURL:(NSString *)realmURL - userID:(NSString *)userID - read:(nullable NSNumber *)mayRead - write:(nullable NSNumber *)mayWrite - manage:(nullable NSNumber *)mayManage; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncPermissionChange_Private.h b/Pods/Realm/include/RLMSyncPermissionChange_Private.h deleted file mode 100644 index df632bc1..00000000 --- a/Pods/Realm/include/RLMSyncPermissionChange_Private.h +++ /dev/null @@ -1,39 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncPermissionChange.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMSyncPermissionChange() - -@property (readwrite) NSString *id; -@property (readwrite) NSDate *createdAt; -@property (readwrite) NSDate *updatedAt; -@property (nullable, readwrite) NSNumber *statusCode; -@property (nullable, readwrite) NSString *statusMessage; -@property (readwrite) NSString *realmUrl; -@property (readwrite) NSString *userId; - -@property (nullable, readwrite) NSNumber *mayRead; -@property (nullable, readwrite) NSNumber *mayWrite; -@property (nullable, readwrite) NSNumber *mayManage; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncPermissionOffer.h b/Pods/Realm/include/RLMSyncPermissionOffer.h deleted file mode 100644 index 29cd3fdc..00000000 --- a/Pods/Realm/include/RLMSyncPermissionOffer.h +++ /dev/null @@ -1,91 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - This model is used for offering permission changes to other users. - - It should be used in conjunction with an `RLMSyncUser`'s management Realm. - - See https://realm.io/docs/realm-object-server/#permissions for general - documentation. - */ -@interface RLMSyncPermissionOffer : RLMObject - -/// The globally unique ID string of this permission offer object. -@property (readonly) NSString *id; - -/// The date this object was initially created. -@property (readonly) NSDate *createdAt; - -/// The date this object was last modified. -@property (readonly) NSDate *updatedAt; - -/// The status code of the object that was processed by Realm Object Server. -@property (nullable, readonly) NSNumber *statusCode; - -/// An error or informational message, typically written to by the Realm Object Server. -@property (nullable, readonly) NSString *statusMessage; - -/// Sync management object status. -@property (readonly) RLMSyncManagementObjectStatus status; - -/// A token which uniquely identifies this offer. Generated by the server. -@property (nullable, readonly) NSString *token; - -/// The remote URL to the realm. -@property (readonly) NSString *realmUrl; - -/// Whether this offer allows the receiver to read from the Realm. -@property (readonly) BOOL mayRead; - -/// Whether this offer allows the receiver to write to the Realm. -@property (readonly) BOOL mayWrite; - -/// Whether this offer allows the receiver to manage the access rights for others. -@property (readonly) BOOL mayManage; - -/// When this token will expire and become invalid. -@property (nullable, readonly) NSDate *expiresAt; - -/** - Construct a permission offer object used to offer permission changes to other users. - - @param realmURL The URL to the Realm on which to apply these permission changes - to, once the offer is accepted. - @param expiresAt When this token will expire and become invalid. - Pass `nil` if this offer should not expire. - @param mayRead Grant or revoke read access. - @param mayWrite Grant or revoked read-write access. - @param mayManage Grant or revoke administrative access. - */ -+ (instancetype)permissionOfferWithRealmURL:(NSString *)realmURL - expiresAt:(nullable NSDate *)expiresAt - read:(BOOL)mayRead - write:(BOOL)mayWrite - manage:(BOOL)mayManage; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncPermissionOfferResponse.h b/Pods/Realm/include/RLMSyncPermissionOfferResponse.h deleted file mode 100644 index 575bc1ac..00000000 --- a/Pods/Realm/include/RLMSyncPermissionOfferResponse.h +++ /dev/null @@ -1,73 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - This model is used to apply permission changes defined in the permission offer - object represented by the specified token, which was created by another user's - `RLMSyncPermissionOffer` object. - - It should be used in conjunction with an `RLMSyncUser`'s management Realm. - - See https://realm.io/docs/realm-object-server/#permissions for general - documentation. - */ -@interface RLMSyncPermissionOfferResponse : RLMObject - -/// The globally unique ID string of this permission offer response object. -@property (readonly) NSString *id; - -/// The date this object was initially created. -@property (readonly) NSDate *createdAt; - -/// The date this object was last modified. -@property (readonly) NSDate *updatedAt; - -/// The status code of the object that was processed by Realm Object Server. -@property (nullable, readonly) NSNumber *statusCode; - -/// An error or informational message, typically written to by the Realm Object Server. -@property (nullable, readonly) NSString *statusMessage; - -/// Sync management object status. -@property (readonly) RLMSyncManagementObjectStatus status; - -/// The received token which uniquely identifies another user's `RLMSyncPermissionOffer`. -@property (readonly) NSString *token; - -/// The remote URL to the realm on which these permission changes were applied. -/// Generated by the server. -@property (nullable, readonly) NSString *realmUrl; - -/** - Construct a permission offer response object used to apply permission changes - defined in the permission offer object represented by the specified token, - which was created by another user's `RLMSyncPermissionOffer` object. - - @param token The received token which uniquely identifies another user's - `RLMSyncPermissionOffer`. - */ -+ (instancetype)permissionOfferResponseWithToken:(NSString *)token; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncPermissionOfferResponse_Private.h b/Pods/Realm/include/RLMSyncPermissionOfferResponse_Private.h deleted file mode 100644 index 88e78096..00000000 --- a/Pods/Realm/include/RLMSyncPermissionOfferResponse_Private.h +++ /dev/null @@ -1,36 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncPermissionOfferResponse.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMSyncPermissionOfferResponse() - -@property (readwrite) NSString *id; -@property (readwrite) NSDate *createdAt; -@property (readwrite) NSDate *updatedAt; -@property (nullable, readwrite) NSNumber *statusCode; -@property (nullable, readwrite) NSString *statusMessage; - -@property (readwrite) NSString *token; -@property (nullable, readwrite) NSString *realmUrl; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncPermissionOffer_Private.h b/Pods/Realm/include/RLMSyncPermissionOffer_Private.h deleted file mode 100644 index 3d7b72ec..00000000 --- a/Pods/Realm/include/RLMSyncPermissionOffer_Private.h +++ /dev/null @@ -1,42 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncPermissionOffer.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMSyncPermissionOffer() - -@property (readwrite) NSString *id; -@property (readwrite) NSDate *createdAt; -@property (readwrite) NSDate *updatedAt; -@property (nullable, readwrite) NSNumber *statusCode; -@property (nullable, readwrite) NSString *statusMessage; - -@property (nullable, readwrite) NSString *token; -@property (readwrite) NSString *realmUrl; - -@property (readwrite) BOOL mayRead; -@property (readwrite) BOOL mayWrite; -@property (readwrite) BOOL mayManage; - -@property (nullable, readwrite) NSDate *expiresAt; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncSession.h b/Pods/Realm/include/RLMSyncSession.h deleted file mode 100644 index 43848c99..00000000 --- a/Pods/Realm/include/RLMSyncSession.h +++ /dev/null @@ -1,157 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import "RLMRealm.h" - -/** - The current state of the session represented by an `RLMSyncSession` object. - */ -typedef NS_ENUM(NSUInteger, RLMSyncSessionState) { - /// The sync session is bound to the Realm Object Server and communicating with it. - RLMSyncSessionStateActive, - /// The sync session is not currently communicating with the Realm Object Server. - RLMSyncSessionStateInactive, - /// The sync session encountered a fatal error and is permanently invalid; it should be discarded. - RLMSyncSessionStateInvalid -}; - -/** - The transfer direction (upload or download) tracked by a given progress notification block. - - Progress notification blocks can be registered on sessions if your app wishes to be informed - how many bytes have been uploaded or downloaded, for example to show progress indicator UIs. - */ -typedef NS_ENUM(NSUInteger, RLMSyncProgressDirection) { - /// For monitoring upload progress. - RLMSyncProgressDirectionUpload, - /// For monitoring download progress. - RLMSyncProgressDirectionDownload, -}; - -/** - The desired behavior of a progress notification block. - - Progress notification blocks can be registered on sessions if your app wishes to be informed - how many bytes have been uploaded or downloaded, for example to show progress indicator UIs. - */ -typedef NS_ENUM(NSUInteger, RLMSyncProgress) { - /** - The block will be called forever, or until it is unregistered by calling - `-[RLMProgressNotificationToken stop]`. - - Notifications will always report the latest number of transferred bytes, and the - most up-to-date number of total transferrable bytes. - */ - RLMSyncProgressReportIndefinitely, - /** - The block will, upon registration, store the total number of bytes - to be transferred. When invoked, it will always report the most up-to-date number - of transferrable bytes out of that original number of transferrable bytes. - - When the number of transferred bytes reaches or exceeds the - number of transferrable bytes, the block will be unregistered. - */ - RLMSyncProgressForCurrentlyOutstandingWork, -}; - -@class RLMSyncUser, RLMSyncConfiguration; - -/** - The type of a progress notification block intended for reporting a session's network - activity to the user. - - `transferredBytes` refers to the number of bytes that have been uploaded or downloaded. - `transferrableBytes` refers to the total number of bytes transferred, and pending transfer. - */ -typedef void(^RLMProgressNotificationBlock)(NSUInteger transferredBytes, NSUInteger transferrableBytes); - -NS_ASSUME_NONNULL_BEGIN - -/** - A token object corresponding to a progress notification block on an `RLMSyncSession`. - - To stop notifications manually, call `-stop` on it. Notifications should be stopped before - the token goes out of scope or is destroyed. - */ -@interface RLMProgressNotificationToken : RLMNotificationToken -@end - -/** - An object encapsulating a Realm Object Server "session". Sessions represent the - communication between the client (and a local Realm file on disk), and the server - (and a remote Realm at a given URL stored on a Realm Object Server). - - Sessions are always created by the SDK and vended out through various APIs. The lifespans - of sessions associated with Realms are managed automatically. - */ -@interface RLMSyncSession : NSObject - -/// The session's current state. -@property (nonatomic, readonly) RLMSyncSessionState state; - -/// The Realm Object Server URL of the remote Realm this session corresponds to. -@property (nullable, nonatomic, readonly) NSURL *realmURL; - -/// The user that owns this session. -- (nullable RLMSyncUser *)parentUser; - -/** - If the session is valid, return a sync configuration that can be used to open the Realm - associated with this session. - */ -- (nullable RLMSyncConfiguration *)configuration; - -/** - Register a progress notification block. - - Multiple blocks can be registered with the same session at once. Each block - will be invoked from the runloop of the thread on which it was registered, - creating a new runloop if none exists. If the session has already received - progress information from the synchronization subsystem, the block will be - called immediately. Otherwise, it will be called as soon as progress - information becomes available. - - The token returned by this method must be retained as long as progress - notifications are desired, and the `-stop` method should be called on it - when notifications are no longer needed and before the token is destroyed. - - If no token is returned, the notification block will never be called again. - There are a number of reasons this might be true. If the session has previously - experienced a fatal error it will not accept progress notification blocks. If - the block was configured in the `RLMSyncProgressForCurrentlyOutstandingWork` - mode but there is no additional progress to report (for example, the number - of transferrable bytes and transferred bytes are equal), the block will not be - called again. - - @param direction The transfer direction (upload or download) to track in this progress notification block. - @param mode The desired behavior of this progress notification block. - @param block The block to invoke when notifications are available. - - @return A token which must be held for as long as you want notifications to be delivered. - - @see `RLMSyncProgressDirection`, `RLMSyncProgress`, `RLMProgressNotificationBlock`, `RLMProgressNotificationToken` - */ -- (nullable RLMProgressNotificationToken *)addProgressNotificationForDirection:(RLMSyncProgressDirection)direction - mode:(RLMSyncProgress)mode - block:(RLMProgressNotificationBlock)block -NS_REFINED_FOR_SWIFT; -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncSessionRefreshHandle.h b/Pods/Realm/include/RLMSyncSessionRefreshHandle.h deleted file mode 100644 index 78a278b4..00000000 --- a/Pods/Realm/include/RLMSyncSessionRefreshHandle.h +++ /dev/null @@ -1,30 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2017 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -@class RLMSyncUser; - -/// An object that handles refreshing a session's token periodically, as long -/// as the session remains live and valid. -@interface RLMSyncSessionRefreshHandle : NSObject - -- (void)scheduleRefreshTimer:(NSDate *)dateWhenTokenExpires; -- (void)invalidate; - -@end diff --git a/Pods/Realm/include/RLMSyncSessionRefreshHandle.hpp b/Pods/Realm/include/RLMSyncSessionRefreshHandle.hpp deleted file mode 100644 index fd251b73..00000000 --- a/Pods/Realm/include/RLMSyncSessionRefreshHandle.hpp +++ /dev/null @@ -1,42 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncSessionRefreshHandle.h" - -#import "RLMSyncUtil_Private.h" - -#import - -namespace realm { -class SyncSession; -} - -@class RLMSyncUser; - -@interface RLMSyncSessionRefreshHandle () - -NS_ASSUME_NONNULL_BEGIN - -- (instancetype)initWithRealmURL:(NSURL *)realmURL - user:(RLMSyncUser *)user - session:(std::shared_ptr)session - completionBlock:(nullable RLMSyncBasicErrorReportingBlock)completionBlock; - -NS_ASSUME_NONNULL_END - -@end diff --git a/Pods/Realm/include/RLMSyncSession_Private.hpp b/Pods/Realm/include/RLMSyncSession_Private.hpp deleted file mode 100644 index 10a39ea4..00000000 --- a/Pods/Realm/include/RLMSyncSession_Private.hpp +++ /dev/null @@ -1,45 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncSession.h" - -#import "RLMSyncUtil_Private.h" -#import - -namespace realm { -class SyncSession; -} - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMSyncSession () { -@public // So it's visible to tests - std::weak_ptr _session; -} RLM_SYNC_UNINITIALIZABLE - -- (instancetype)initWithSyncSession:(std::shared_ptr)session; - -/// Wait for pending uploads to complete or the session to expire, and dispatch the callback onto the specified queue. -- (BOOL)waitForUploadCompletionOnQueue:(nullable dispatch_queue_t)queue callback:(void(^)(void))callback; - -/// Wait for pending downloads to complete or the session to expire, and dispatch the callback onto the specified queue. -- (BOOL)waitForDownloadCompletionOnQueue:(nullable dispatch_queue_t)queue callback:(void(^)(void))callback; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncUser.h b/Pods/Realm/include/RLMSyncUser.h deleted file mode 100644 index 54cc79b4..00000000 --- a/Pods/Realm/include/RLMSyncUser.h +++ /dev/null @@ -1,131 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -@class RLMSyncUser, RLMSyncCredentials, RLMSyncSession, RLMRealm; - -/** - The state of the user object. - */ -typedef NS_ENUM(NSUInteger, RLMSyncUserState) { - /// The user is logged out. Call `logInWithCredentials:...` with valid credentials to log the user back in. - RLMSyncUserStateLoggedOut, - /// The user is logged in, and any Realms associated with it are syncing with the Realm Object Server. - RLMSyncUserStateActive, - /// The user has encountered a fatal error state, and cannot be used. - RLMSyncUserStateError, -}; - -/// A block type used for APIs which asynchronously vend an `RLMSyncUser`. -typedef void(^RLMUserCompletionBlock)(RLMSyncUser * _Nullable, NSError * _Nullable); - -NS_ASSUME_NONNULL_BEGIN - -/** - A `RLMSyncUser` instance represents a single Realm Object Server user account (or just user). - - A user may have one or more credentials associated with it. These credentials uniquely identify the user to a - third-party auth provider, and are used to sign into a Realm Object Server user account. - - Note that users are only vended out via SDK APIs, and only one user instance ever exists for a given user account. - */ -@interface RLMSyncUser : NSObject - -/** - A dictionary of all valid, logged-in user identities corresponding to their `RLMSyncUser` objects. - */ -+ (NSDictionary *)allUsers NS_REFINED_FOR_SWIFT; - -/** - The logged-in user. `nil` if none exists. - - @warning Throws an exception if more than one logged-in user exists. - */ -+ (nullable RLMSyncUser *)currentUser NS_REFINED_FOR_SWIFT; - -/** - The unique Realm Object Server user ID string identifying this user. - */ -@property (nullable, nonatomic, readonly) NSString *identity; - -/** - The URL of the authentication server this user will communicate with. - */ -@property (nullable, nonatomic, readonly) NSURL *authenticationServer; - -/** - The current state of the user. - */ -@property (nonatomic, readonly) RLMSyncUserState state; - -/** - Create, log in, and asynchronously return a new user object, specifying a custom timeout for the network request. - Credentials identifying the user must be passed in. The user becomes available in the completion block, at which point - it is ready for use. - */ -+ (void)logInWithCredentials:(RLMSyncCredentials *)credentials - authServerURL:(NSURL *)authServerURL - timeout:(NSTimeInterval)timeout - onCompletion:(RLMUserCompletionBlock)completion NS_REFINED_FOR_SWIFT; - -/** - Create, log in, and asynchronously return a new user object. Credentials identifying the user must be passed in. The - user becomes available in the completion block, at which point it is ready for use. - */ -+ (void)logInWithCredentials:(RLMSyncCredentials *)credentials - authServerURL:(NSURL *)authServerURL - onCompletion:(RLMUserCompletionBlock)completion -NS_SWIFT_UNAVAILABLE("Use the full version of this API."); - -/** - Log a user out, destroying their server state, deregistering them from the SDK, and removing any synced Realms - associated with them from on-disk storage. If the user is already logged out or in an error state, this is a no-op. - - This method should be called whenever the application is committed to not using a user again unless they are recreated. - Failing to call this method may result in unused files and metadata needlessly taking up space. - */ -- (void)logOut; - -/** - Retrieve a valid session object belonging to this user for a given URL, or `nil` if no such object exists. - */ -- (nullable RLMSyncSession *)sessionForURL:(NSURL *)url; - -/** - Retrieve all the valid sessions belonging to this user. - */ -- (NSArray *)allSessions; - -/** - Returns an instance of the Management Realm owned by the user. - - This Realm can be used to control access permissions for Realms managed by the user. - This includes granting other users access to Realms. - */ -- (RLMRealm *)managementRealmWithError:(NSError **)error NS_REFINED_FOR_SWIFT; - -/// :nodoc: -- (instancetype)init __attribute__((unavailable("RLMSyncUser cannot be created directly"))); - -/// :nodoc: -+ (instancetype)new __attribute__((unavailable("RLMSyncUser cannot be created directly"))); - -NS_ASSUME_NONNULL_END - -@end diff --git a/Pods/Realm/include/RLMSyncUser_Private.hpp b/Pods/Realm/include/RLMSyncUser_Private.hpp deleted file mode 100644 index 6d9d0da8..00000000 --- a/Pods/Realm/include/RLMSyncUser_Private.hpp +++ /dev/null @@ -1,49 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncUser.h" - -#import "RLMSyncConfiguration.h" -#import "RLMSyncUtil_Private.h" - -#include "sync/sync_config.hpp" -#include "sync/impl/sync_metadata.hpp" - -@class RLMSyncConfiguration; - -using namespace realm; - -typedef void(^RLMFetchedRealmCompletionBlock)(NSError * _Nullable, RLMRealm * _Nullable, BOOL * _Nonnull); - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMSyncUser () - -- (void)_bindSessionWithConfig:(const SyncConfig&)config - session:(std::shared_ptr)session - completion:(RLMSyncBasicErrorReportingBlock)completion; - -- (instancetype)initWithSyncUser:(std::shared_ptr)user; -- (std::shared_ptr)_syncUser; -- (nullable NSString *)_refreshToken; - -- (void)_unregisterRefreshHandleForURLPath:(NSString *)path; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncUtil.h b/Pods/Realm/include/RLMSyncUtil.h deleted file mode 100644 index 71cf8e24..00000000 --- a/Pods/Realm/include/RLMSyncUtil.h +++ /dev/null @@ -1,122 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -/// A token originating from the Realm Object Server. -typedef NSString* RLMServerToken; - -NS_ASSUME_NONNULL_BEGIN - -/// A user info key for use with `RLMSyncErrorClientResetError`. -extern NSString *const kRLMSyncPathOfRealmBackupCopyKey; - -/// A user info key for use with `RLMSyncErrorClientResetError`. -extern NSString *const kRLMSyncInitiateClientResetBlockKey; - -/// The error domain string for all SDK errors related to synchronization functionality. -extern NSString *const RLMSyncErrorDomain; - -/// An error which is related to authentication to a Realm Object Server. -typedef RLM_ERROR_ENUM(NSInteger, RLMSyncAuthError, RLMSyncErrorDomain) { - /// An error that indicates that the provided credentials are invalid. - RLMSyncAuthErrorInvalidCredential = 611, - - /// An error that indicates that the user with provided credentials does not exist. - RLMSyncAuthErrorUserDoesNotExist = 612, - - /// An error that indicates that the user cannot be registered as it exists already. - RLMSyncAuthErrorUserAlreadyExists = 613, -}; - -/// An error which is related to synchronization with a Realm Object Server. -typedef RLM_ERROR_ENUM(NSInteger, RLMSyncError, RLMSyncErrorDomain) { - /// An error that indicates that the response received from the authentication server was malformed. - RLMSyncErrorBadResponse = 1, - - /// An error that indicates that the supplied Realm path was invalid, or could not be resolved by the authentication - /// server. - RLMSyncErrorBadRemoteRealmPath = 2, - - /// An error that indicates that the response received from the authentication server was an HTTP error code. The - /// `userInfo` dictionary contains the actual error code value. - RLMSyncErrorHTTPStatusCodeError = 3, - - /// An error that indicates a problem with the session (a specific Realm opened for sync). - RLMSyncErrorClientSessionError = 4, - - /// An error that indicates a problem with a specific user. - RLMSyncErrorClientUserError = 5, - - /// An error that indicates an internal, unrecoverable error with the underlying synchronization engine. - RLMSyncErrorClientInternalError = 6, - - /** - An error that indicates the Realm needs to be reset. - - A synced Realm may need to be reset because the Realm Object Server encountered an - error and had to be restored from a backup. If the backup copy of the remote Realm - is of an earlier version than the local copy of the Realm, the server will ask the - client to reset the Realm. - - The reset process is as follows: the local copy of the Realm is copied into a recovery - directory for safekeeping, and then deleted from the original location. The next time - the Realm for that URL is opened, the Realm will automatically be re-downloaded from the - Realm Object Server, and can be used as normal. - - Data written to the Realm after the local copy of the Realm diverged from the backup - remote copy will be present in the local recovery copy of the Realm file. The - re-downloaded Realm will initially contain only the data present at the time the Realm - was backed up on the server. - - The client reset process can be initiated in one of two ways. The block provided in the - `userInfo` dictionary under `kRLMSyncInitiateClientResetBlockKey` can be called to - initiate the reset process. This block can be called any time after the error is - received, but should only be called if and when your app closes and invalidates every - instance of the offending Realm on all threads (note that autorelease pools may make this - difficult to guarantee). - - If the block is not called, the client reset process will be automatically carried out - the next time the app is launched and the `RLMSyncManager` singleton is accessed. - - The value for the `kRLMSyncPathOfRealmBackupCopyKey` key in the `userInfo` dictionary - describes the path of the recovered copy of the Realm. This copy will not actually be - created until the client reset process is initiated. - - @see: `-[NSError rlmSync_clientResetBlock]`, `-[NSError rlmSync_clientResetBackedUpRealmPath]` - */ - RLMSyncErrorClientResetError = 7, -}; - -/// An enum representing the different states a sync management object can take. -typedef NS_ENUM(NSUInteger, RLMSyncManagementObjectStatus) { - /// The management object has not yet been processed by the object server. - RLMSyncManagementObjectStatusNotProcessed, - /// The operations encoded in the management object have been successfully - /// performed by the object server. - RLMSyncManagementObjectStatusSuccess, - /** - The operations encoded in the management object were not successfully - performed by the object server. - Refer to the `statusCode` and `statusMessage` properties for more details - about the error. - */ - RLMSyncManagementObjectStatusError, -}; - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMSyncUtil_Private.h b/Pods/Realm/include/RLMSyncUtil_Private.h deleted file mode 100644 index e3ac5ca2..00000000 --- a/Pods/Realm/include/RLMSyncUtil_Private.h +++ /dev/null @@ -1,102 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import -#import -#import - -@class RLMSyncUser; - -typedef void(^RLMSyncCompletionBlock)(NSError * _Nullable, NSDictionary * _Nullable); -typedef void(^RLMSyncBasicErrorReportingBlock)(NSError * _Nullable); - -typedef NSString* RLMServerPath; - -NS_ASSUME_NONNULL_BEGIN - -@interface RLMRealmConfiguration (RealmSync) -+ (instancetype)managementConfigurationForUser:(RLMSyncUser *)user; -@end - -extern RLMIdentityProvider const RLMIdentityProviderAccessToken; -extern RLMIdentityProvider const RLMIdentityProviderRealm; - -extern NSString *const kRLMSyncAppIDKey; -extern NSString *const kRLMSyncDataKey; -extern NSString *const kRLMSyncErrorJSONKey; -extern NSString *const kRLMSyncErrorStatusCodeKey; -extern NSString *const kRLMSyncIdentityKey; -extern NSString *const kRLMSyncPasswordKey; -extern NSString *const kRLMSyncPathKey; -extern NSString *const kRLMSyncProviderKey; -extern NSString *const kRLMSyncRegisterKey; -extern NSString *const kRLMSyncUnderlyingErrorKey; - -/// Convert sync management object status code (nil, 0 and others) to -/// RLMSyncManagementObjectStatus enum -FOUNDATION_EXTERN RLMSyncManagementObjectStatus RLMMakeSyncManagementObjectStatus(NSNumber * _Nullable statusCode); - -#define RLM_SYNC_UNINITIALIZABLE \ -- (instancetype)init __attribute__((unavailable("This type cannot be created directly"))); \ -+ (instancetype)new __attribute__((unavailable("This type cannot be created directly"))); - -NS_ASSUME_NONNULL_END - -/// A macro to parse a string out of a JSON dictionary, or return nil. -#define RLM_SYNC_PARSE_STRING_OR_ABORT(json_macro_val, key_macro_val, prop_macro_val) \ -{ \ -id data = json_macro_val[key_macro_val]; \ -if (![data isKindOfClass:[NSString class]]) { return nil; } \ -self.prop_macro_val = data; \ -} \ - -#define RLM_SYNC_PARSE_OPTIONAL_STRING(json_macro_val, key_macro_val, prop_macro_val) \ -{ \ -id data = json_macro_val[key_macro_val]; \ -if (![data isKindOfClass:[NSString class]]) { data = nil; } \ -self.prop_macro_val = data; \ -} \ - -/// A macro to parse a double out of a JSON dictionary, or return nil. -#define RLM_SYNC_PARSE_DOUBLE_OR_ABORT(json_macro_val, key_macro_val, prop_macro_val) \ -{ \ -id data = json_macro_val[key_macro_val]; \ -if (![data isKindOfClass:[NSNumber class]]) { return nil; } \ -self.prop_macro_val = [data doubleValue]; \ -} \ - -/// A macro to build a sub-model out of a JSON dictionary, or return nil. -#define RLM_SYNC_PARSE_MODEL_OR_ABORT(json_macro_val, key_macro_val, class_macro_val, prop_macro_val) \ -{ \ -id raw = json_macro_val[key_macro_val]; \ -if (![raw isKindOfClass:[NSDictionary class]]) { return nil; } \ -id model = [[class_macro_val alloc] initWithDictionary:raw]; \ -if (!model) { return nil; } \ -self.prop_macro_val = model; \ -} \ - -#define RLM_SYNC_PARSE_OPTIONAL_MODEL(json_macro_val, key_macro_val, class_macro_val, prop_macro_val) \ -{ \ -id model; \ -id raw = json_macro_val[key_macro_val]; \ -if (![raw isKindOfClass:[NSDictionary class]]) { model = nil; } \ -else { model = [[class_macro_val alloc] initWithDictionary:raw]; } \ -self.prop_macro_val = model; \ -} \ diff --git a/Pods/Realm/include/RLMSyncUtil_Private.hpp b/Pods/Realm/include/RLMSyncUtil_Private.hpp deleted file mode 100644 index 279207af..00000000 --- a/Pods/Realm/include/RLMSyncUtil_Private.hpp +++ /dev/null @@ -1,30 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMSyncUtil_Private.h" - -#import "RLMSyncConfiguration_Private.h" - -#import "sync/sync_manager.hpp" - -namespace realm { - -SyncSessionStopPolicy translateStopPolicy(RLMSyncStopPolicy stopPolicy); -RLMSyncStopPolicy translateStopPolicy(SyncSessionStopPolicy stop_policy); - -} diff --git a/Pods/Realm/include/RLMThreadSafeReference.h b/Pods/Realm/include/RLMThreadSafeReference.h deleted file mode 100644 index a935ebe0..00000000 --- a/Pods/Realm/include/RLMThreadSafeReference.h +++ /dev/null @@ -1,106 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -@class RLMRealm; - -NS_ASSUME_NONNULL_BEGIN - -/** - Objects of types which conform to `RLMThreadConfined` can be managed by a Realm, which will make - them bound to a thread-specific `RLMRealm` instance. Managed objects must be explicitly exported - and imported to be passed between threads. - - Managed instances of objects conforming to this protocol can be converted to a thread-safe - reference for transport between threads by passing to the - `+[RLMThreadSafeReference referenceWithThreadConfined:]` constructor. - - Note that only types defined by Realm can meaningfully conform to this protocol, and defining new - classes which attempt to conform to it will not make them work with `RLMThreadSafeReference`. - */ -@protocol RLMThreadConfined -// Conformance to the `RLMThreadConfined_Private` protocol will be enforced at runtime. - -/** - The Realm which manages the object, or `nil` if the object is unmanaged. - - Unmanaged objects are not confined to a thread and cannot be passed to methods expecting a - `RLMThreadConfined` object. - */ -@property (nonatomic, readonly, nullable) RLMRealm *realm; - -/// Indicates if the object can no longer be accessed because it is now invalid. -@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated; - -@end - -/** - An object intended to be passed between threads containing a thread-safe reference to its - thread-confined object. - - To resolve a thread-safe reference on a target Realm on a different thread, pass to - `-[RLMRealm resolveThreadSafeReference:]`. - - @warning A `RLMThreadSafeReference` object must be resolved at most once. - Failing to resolve a `RLMThreadSafeReference` will result in the source version of the - Realm being pinned until the reference is deallocated. - - @note Prefer short-lived `RLMThreadSafeReference`s as the data for the version of the source Realm - will be retained until all references have been resolved or deallocated. - - @see `RLMThreadConfined` - @see `-[RLMRealm resolveThreadSafeReference:]` - */ -@interface RLMThreadSafeReference<__covariant Confined : id> : NSObject - -/** - Create a thread-safe reference to the thread-confined object. - - @param threadConfined The thread-confined object to create a thread-safe reference to. - - @note You may continue to use and access the thread-confined object after passing it to this - constructor. - */ -+ (instancetype)referenceWithThreadConfined:(Confined)threadConfined; - -/** - Indicates if the reference can no longer be resolved because an attempt to resolve it has already - occurred. References can only be resolved once. - */ -@property (nonatomic, readonly, getter = isInvalidated) BOOL invalidated; - -#pragma mark - Unavailable Methods - -/** - `-[RLMThreadSafeReference init]` is not available because `RLMThreadSafeReference` cannot be - created directly. `RLMThreadSafeReference` instances must be obtained by calling - `-[RLMRealm resolveThreadSafeReference:]`. - */ -- (instancetype)init __attribute__((unavailable("RLMThreadSafeReference cannot be created directly"))); - -/** - `-[RLMThreadSafeReference new]` is not available because `RLMThreadSafeReference` cannot be - created directly. `RLMThreadSafeReference` instances must be obtained by calling - `-[RLMRealm resolveThreadSafeReference:]`. - */ -+ (instancetype)new __attribute__((unavailable("RLMThreadSafeReference cannot be created directly"))); - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMThreadSafeReference_Private.hpp b/Pods/Realm/include/RLMThreadSafeReference_Private.hpp deleted file mode 100644 index 5cf78edd..00000000 --- a/Pods/Realm/include/RLMThreadSafeReference_Private.hpp +++ /dev/null @@ -1,44 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import "RLMThreadSafeReference.h" -#import "thread_safe_reference.hpp" - -NS_ASSUME_NONNULL_BEGIN - -@protocol RLMThreadConfined_Private - -// Constructs a new `ThreadSafeReference` -- (std::unique_ptr)makeThreadSafeReference; - -// The extra information needed to construct an instance of this type from the Object Store type -@property (nonatomic, readonly, nullable) id objectiveCMetadata; - -// Constructs an new instance of this type -+ (nullable instancetype)objectWithThreadSafeReference:(std::unique_ptr)reference - metadata:(nullable id)metadata - realm:(RLMRealm *)realm; -@end - -@interface RLMThreadSafeReference () - -- (nullable id)resolveReferenceInRealm:(RLMRealm *)realm; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMTokenModels.h b/Pods/Realm/include/RLMTokenModels.h deleted file mode 100644 index bd97092e..00000000 --- a/Pods/Realm/include/RLMTokenModels.h +++ /dev/null @@ -1,49 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import "RLMSyncUtil_Private.h" - -NS_ASSUME_NONNULL_BEGIN - -@class RLMTokenDataModel; - -@interface RLMTokenModel : NSObject RLM_SYNC_UNINITIALIZABLE - -@property (nonatomic, readonly) NSString *token; -@property (nonatomic, nullable, readonly) NSString *path; -@property (nonatomic, readonly) RLMTokenDataModel *tokenData; - -- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary; - -@end - -@interface RLMTokenDataModel : NSObject RLM_SYNC_UNINITIALIZABLE - -@property (nonatomic, readonly) NSString *identity; -@property (nonatomic, nullable, readonly) NSString *appID; -@property (nonatomic, nullable, readonly) NSString *path; -@property (nonatomic, readonly) NSTimeInterval expires; -//@property (nonatomic, readonly) NSArray *access; - -- (instancetype)initWithDictionary:(NSDictionary *)jsonDictionary; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Pods/Realm/include/RLMUpdateChecker.hpp b/Pods/Realm/include/RLMUpdateChecker.hpp deleted file mode 100644 index 7f01ac73..00000000 --- a/Pods/Realm/include/RLMUpdateChecker.hpp +++ /dev/null @@ -1,20 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -// Asynchronously check for updates to Realm if running on a simulator -void RLMCheckForUpdates(); diff --git a/Pods/Realm/include/RLMUtil.hpp b/Pods/Realm/include/RLMUtil.hpp deleted file mode 100644 index e0161b9b..00000000 --- a/Pods/Realm/include/RLMUtil.hpp +++ /dev/null @@ -1,204 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import -#import -#import - -#import -#import -#import -#import -#import - -namespace realm { - class Mixed; -} - -@class RLMObjectSchema; -@class RLMProperty; - -namespace realm { - class RealmFileException; -} - -__attribute__((format(NSString, 1, 2))) -NSException *RLMException(NSString *fmt, ...); -NSException *RLMException(std::exception const& exception); - -NSError *RLMMakeError(RLMError code, std::exception const& exception); -NSError *RLMMakeError(RLMError code, const realm::util::File::AccessError&); -NSError *RLMMakeError(RLMError code, const realm::RealmFileException&); -NSError *RLMMakeError(std::system_error const& exception); -NSError *RLMMakeError(NSException *exception); - -void RLMSetErrorOrThrow(NSError *error, NSError **outError); - -// returns if the object can be inserted as the given type -BOOL RLMIsObjectValidForProperty(id obj, RLMProperty *prop); - -// gets default values for the given schema (+defaultPropertyValues) -// merges with native property defaults if Swift class -NSDictionary *RLMDefaultValuesForObjectSchema(RLMObjectSchema *objectSchema); - -BOOL RLMIsDebuggerAttached(); -BOOL RLMIsRunningInPlayground(); - -// C version of isKindOfClass -static inline BOOL RLMIsKindOfClass(Class class1, Class class2) { - while (class1) { - if (class1 == class2) return YES; - class1 = class_getSuperclass(class1); - } - return NO; -} - -// Returns whether the class is a descendent of RLMObjectBase -BOOL RLMIsObjectOrSubclass(Class klass); - -// Returns whether the class is an indirect descendant of RLMObjectBase -BOOL RLMIsObjectSubclass(Class klass); - -template -static inline T *RLMDynamicCast(__unsafe_unretained id obj) { - if ([obj isKindOfClass:[T class]]) { - return obj; - } - return nil; -} - -template -static inline T RLMCoerceToNil(__unsafe_unretained T obj) { - if (static_cast(obj) == NSNull.null) { - return nil; - } - else if (__unsafe_unretained auto optional = RLMDynamicCast(obj)) { - return RLMCoerceToNil(optional.underlyingValue); - } - return obj; -} - -// Translate an rlmtype to a string representation -static inline NSString *RLMTypeToString(RLMPropertyType type) { - switch (type) { - case RLMPropertyTypeString: - return @"string"; - case RLMPropertyTypeInt: - return @"int"; - case RLMPropertyTypeBool: - return @"bool"; - case RLMPropertyTypeDate: - return @"date"; - case RLMPropertyTypeData: - return @"data"; - case RLMPropertyTypeDouble: - return @"double"; - case RLMPropertyTypeFloat: - return @"float"; - case RLMPropertyTypeAny: - return @"any"; - case RLMPropertyTypeObject: - return @"object"; - case RLMPropertyTypeArray: - return @"array"; - case RLMPropertyTypeLinkingObjects: - return @"linking objects"; - } - return @"Unknown"; -} - -// String conversion utilities -static inline NSString * RLMStringDataToNSString(realm::StringData stringData) { - static_assert(sizeof(NSUInteger) >= sizeof(size_t), - "Need runtime overflow check for size_t to NSUInteger conversion"); - if (stringData.is_null()) { - return nil; - } - else { - return [[NSString alloc] initWithBytes:stringData.data() - length:stringData.size() - encoding:NSUTF8StringEncoding]; - } -} - -static inline realm::StringData RLMStringDataWithNSString(__unsafe_unretained NSString *const string) { - static_assert(sizeof(size_t) >= sizeof(NSUInteger), - "Need runtime overflow check for NSUInteger to size_t conversion"); - return realm::StringData(string.UTF8String, - [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); -} - -// Binary conversion utilities -static inline NSData *RLMBinaryDataToNSData(realm::BinaryData binaryData) { - return binaryData ? [NSData dataWithBytes:binaryData.data() length:binaryData.size()] : nil; -} - -static inline realm::BinaryData RLMBinaryDataForNSData(__unsafe_unretained NSData *const data) { - // this is necessary to ensure that the empty NSData isn't treated by core as the null realm::BinaryData - // because data.bytes == 0 when data.length == 0 - // the casting bit ensures that we create a data with a non-null pointer - auto bytes = static_cast(data.bytes) ?: static_cast((__bridge void *)data); - return realm::BinaryData(bytes, data.length); -} - -// Date conversion utilities -// These use the reference date and shift the seconds rather than just getting -// the time interval since the epoch directly to avoid losing sub-second precision -static inline NSDate *RLMTimestampToNSDate(realm::Timestamp ts) NS_RETURNS_RETAINED { - if (ts.is_null()) - return nil; - auto timeInterval = ts.get_seconds() - NSTimeIntervalSince1970 + ts.get_nanoseconds() / 1'000'000'000.0; - return [[NSDate alloc] initWithTimeIntervalSinceReferenceDate:timeInterval]; -} - -static inline realm::Timestamp RLMTimestampForNSDate(__unsafe_unretained NSDate *const date) { - auto timeInterval = date.timeIntervalSinceReferenceDate; - if (isnan(timeInterval)) - return {0, 0}; // Arbitrary choice - - // Clamp dates that we can't represent as a Timestamp to the maximum value - if (timeInterval >= std::numeric_limits::max() - NSTimeIntervalSince1970) - return {std::numeric_limits::max(), 1'000'000'000 - 1}; - if (timeInterval - NSTimeIntervalSince1970 < std::numeric_limits::min()) - return {std::numeric_limits::min(), -1'000'000'000 + 1}; - - auto seconds = static_cast(timeInterval); - auto nanoseconds = static_cast((timeInterval - seconds) * 1'000'000'000.0); - seconds += static_cast(NSTimeIntervalSince1970); - - // Seconds and nanoseconds have to have the same sign - if (nanoseconds < 0 && seconds > 0) { - nanoseconds += 1'000'000'000; - --seconds; - } - return {seconds, nanoseconds}; -} - -static inline NSUInteger RLMConvertNotFound(size_t index) { - return index == realm::not_found ? NSNotFound : index; -} - -id RLMMixedToObjc(realm::Mixed const& value); - -// For unit testing purposes, allow an Objective-C class named FakeObject to also be used -// as the base class of managed objects. This allows for testing invalid schemas. -void RLMSetTreatFakeObjectAsRLMObject(BOOL flag); - -// Given a bundle identifier, return the base directory on the disk within which Realm database and support files should -// be stored. -NSString *RLMDefaultDirectoryForBundleIdentifier(NSString *bundleIdentifier); diff --git a/Pods/Realm/include/Realm.h b/Pods/Realm/include/Realm.h deleted file mode 100644 index 4514a954..00000000 --- a/Pods/Realm/include/Realm.h +++ /dev/null @@ -1,41 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2014 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#import - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import diff --git a/Pods/Realm/include/binding_context.hpp b/Pods/Realm/include/binding_context.hpp deleted file mode 100644 index 5fc59eb5..00000000 --- a/Pods/Realm/include/binding_context.hpp +++ /dev/null @@ -1,169 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2015 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#ifndef BINDING_CONTEXT_HPP -#define BINDING_CONTEXT_HPP - -#include "index_set.hpp" - -#include -#include -#include - -namespace realm { -// BindingContext is the extension point for adding binding-specific behavior to -// a SharedRealm. It can be used to store additonal data associated with the -// Realm which is needed by the binding, and there are several methods which -// can be overridden to receive notifications of state changes within the Realm. -// -// A simple implementation which lets the user register functions to be -// called on refresh could look like the following: -// -// class BindingContextImplementation : public BindingContext { -// public: -// // A token returned from add_notification that can be used to remove the -// // notification later -// struct token : private std::list>::iterator { -// token(std::list>::iterator it) : std::list>::iterator(it) { } -// friend class DelegateImplementation; -// }; -// -// token add_notification(std::function func) -// { -// m_registered_notifications.push_back(std::move(func)); -// return token(std::prev(m_registered_notifications.end())); -// } -// -// void remove_notification(token entry) -// { -// m_registered_notifications.erase(entry); -// } -// -// // Override the did_change method to call each registered notification -// void did_change(std::vector const&, std::vector const&, bool) override -// { -// // Loop oddly so that unregistering a notification from within the -// // registered function works -// for (auto it = m_registered_notifications.begin(); it != m_registered_notifications.end(); ) { -// (*it++)(); -// } -// } -// -// private: -// std::list> m_registered_notifications; -// }; -class Realm; -class BindingContext { -public: - virtual ~BindingContext() = default; - - std::weak_ptr realm; - - // If the user adds a notification handler to the Realm, will it ever - // actually be called? - virtual bool can_deliver_notifications() const noexcept { return true; } - - // Called by the Realm when refresh called or a notification arrives which - // is triggered through write transaction committed by itself or a different - // Realm instance. - virtual void before_notify() { } - - // Called by the Realm when a write transaction is committed to the file by - // a different Realm instance (possibly in a different process) - virtual void changes_available() { } - - struct ObserverState; - - // Override this function if you want to receive detailed information about - // external changes to a specific set of objects. - // This is called before each operation which may advance the read - // transaction to include - // ObserverStates for each row for which detailed change information is - // desired. - virtual std::vector get_observed_rows() { return {}; } - - // Called immediately before the read transaction is advanced if detailed - // change information was requested (by returning a non-empty array from - // get_observed_rows()). - // The observers vector is the vector returned by get_observed_row(), - // updated with change information. The invalidated vector is a list of the - // `info` fields of observed rows which will be deleted. - virtual void will_change(std::vector const& observers, - std::vector const& invalidated); - - // Called immediately after the read transaction version is advanced. Unlike - // will_change(), this is called even if detailed change information was not - // requested or if the Realm is not actually in a read transaction, although - // both vectors will be empty in that case. - virtual void did_change(std::vector const& observers, - std::vector const& invalidated, - bool version_changed=true); - - // Change information for a single field of a row - struct ColumnInfo { - // The index of this column prior to the changes in the tracked - // transaction, or -1 for newly inserted columns. - size_t initial_column_index = -1; - // What kind of change occurred? - // Always Set or None for everything but LinkList columns. - enum class Kind { - None, // No change - Set, // The value or entries at `indices` were assigned to - Insert, // New values were inserted at each of the indices given - Remove, // Values were removed at each of the indices given - SetAll // The entire LinkList has been replaced with a new set of values - } kind = Kind::None; - // The indices where things happened for Set, Insert and Remove on - // LinkList columns. Not used for other types or for None or SetAll. - IndexSet indices; - }; - - // Information about an observed row in a table - // - // Each object which needs detailed change information should have an - // ObserverState entry in the vector returned from get_observed_rows(), with - // the initial table and row indexes set (and optionally the info field). - // The Realm parses the transaction log, and populates the `changes` vector - // in each ObserverState with information about what changes were made. - struct ObserverState { - // Initial table and row which is observed - // May be updated by row insertions and removals - size_t table_ndx; - size_t row_ndx; - - // Opaque userdata for the delegate's use - void* info; - - // Populated with information about which columns were changed - // May be shorter than the actual number of columns if the later columns - // are not modified - std::vector changes; - - // Simple lexographic ordering - friend bool operator<(ObserverState const& lft, ObserverState const& rgt) - { - return std::tie(lft.table_ndx, lft.row_ndx) < std::tie(rgt.table_ndx, rgt.row_ndx); - } - }; -}; - -inline void BindingContext::will_change(std::vector const&, std::vector const&) { } -inline void BindingContext::did_change(std::vector const&, std::vector const&, bool) { } -} // namespace realm - -#endif /* BINDING_CONTEXT_HPP */ diff --git a/Pods/Realm/include/collection_notifications.hpp b/Pods/Realm/include/collection_notifications.hpp deleted file mode 100644 index c1be7be5..00000000 --- a/Pods/Realm/include/collection_notifications.hpp +++ /dev/null @@ -1,181 +0,0 @@ -//////////////////////////////////////////////////////////////////////////// -// -// Copyright 2016 Realm Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////// - -#ifndef REALM_COLLECTION_NOTIFICATIONS_HPP -#define REALM_COLLECTION_NOTIFICATIONS_HPP - -#include "index_set.hpp" -#include "util/atomic_shared_ptr.hpp" - -#include -#include -#include -#include - -namespace realm { -namespace _impl { - class CollectionNotifier; -} - -// A token which keeps an asynchronous query alive -struct NotificationToken { - NotificationToken() = default; - NotificationToken(std::shared_ptr<_impl::CollectionNotifier> notifier, size_t token); - ~NotificationToken(); - - NotificationToken(NotificationToken&&); - NotificationToken& operator=(NotificationToken&&); - - NotificationToken(NotificationToken const&) = delete; - NotificationToken& operator=(NotificationToken const&) = delete; - - void suppress_next(); - -private: - util::AtomicSharedPtr<_impl::CollectionNotifier> m_notifier; - size_t m_token; -}; - -struct CollectionChangeSet { - struct Move { - size_t from; - size_t to; - - bool operator==(Move m) const { return from == m.from && to == m.to; } - }; - - // Indices which were removed from the _old_ collection - IndexSet deletions; - - // Indices in the _new_ collection which are new insertions - IndexSet insertions; - - // Indices of objects in the _old_ collection which were modified - IndexSet modifications; - - // Indices in the _new_ collection which were modified. This will always - // have the same number of indices as `modifications` and conceptually - // represents the same entries, just in different versions of the collection. - // It exists for the sake of code which finds it easier to process - // modifications after processing deletions and insertions rather than before. - IndexSet modifications_new; - - // Rows in the collection which moved. - // - // Every `from` index will also be present in `deletions` and every `to` - // index will be present in `insertions`. - // - // This is currently not reliably calculated for all types of collections. A - // reported move will always actually be a move, but there may also be - // unreported moves which show up only as a delete/insert pair. - std::vector moves; - - // Per-column version of `modifications` - std::vector columns; - - bool empty() const - { - return deletions.empty() && insertions.empty() && modifications.empty() - && modifications_new.empty() && moves.empty(); - } -}; - -// A type-erasing wrapper for the callback for collection notifications. Can be -// constructed with either any callable compatible with the signature -// `void (CollectionChangeSet, std::exception_ptr)`, an object with member -// functions `void before(CollectionChangeSet)`, `void after(CollectionChangeSet)`, -// `void error(std::exception_ptr)`, or a pointer to such an object. If a pointer -// is given, the caller is responsible for ensuring that the pointed-to object -// outlives the collection. -class CollectionChangeCallback { -public: - CollectionChangeCallback(std::nullptr_t={}) { } - - template - CollectionChangeCallback(Callback cb) : m_impl(make_impl(std::move(cb))) { } - template - CollectionChangeCallback& operator=(Callback cb) { m_impl = make_impl(std::move(cb)); return *this; } - - // Explicitly default the copy/move constructors as otherwise they'll use - // the above ones and add an extra layer of wrapping - CollectionChangeCallback(CollectionChangeCallback&&) = default; - CollectionChangeCallback(CollectionChangeCallback const&) = default; - CollectionChangeCallback& operator=(CollectionChangeCallback&&) = default; - CollectionChangeCallback& operator=(CollectionChangeCallback const&) = default; - - void before(CollectionChangeSet const& c) { m_impl->before(c); } - void after(CollectionChangeSet const& c) { m_impl->after(c); } - void error(std::exception_ptr e) { m_impl->error(e); } - - explicit operator bool() const { return !!m_impl; } - -private: - struct Base { - virtual void before(CollectionChangeSet const&)=0; - virtual void after(CollectionChangeSet const&)=0; - virtual void error(std::exception_ptr)=0; - }; - - template()(CollectionChangeSet(), std::exception_ptr()))> - std::shared_ptr make_impl(Callback cb) - { - return std::make_shared>(std::move(cb)); - } - - template().after(CollectionChangeSet())), typename = void> - std::shared_ptr make_impl(Callback cb) - { - return std::make_shared>(std::move(cb)); - } - - template().after(CollectionChangeSet())), typename = void> - std::shared_ptr make_impl(Callback* cb) - { - return std::make_shared>(cb); - } - - template - struct Impl : public Base { - T impl; - Impl(T impl) : impl(std::move(impl)) { } - void before(CollectionChangeSet const&) override { } - void after(CollectionChangeSet const& change) override { impl(change, {}); } - void error(std::exception_ptr error) override { impl({}, error); } - }; - template - struct Impl2 : public Base { - T impl; - Impl2(T impl) : impl(std::move(impl)) { } - void before(CollectionChangeSet const& c) override { impl.before(c); } - void after(CollectionChangeSet const& c) override { impl.after(c); } - void error(std::exception_ptr error) override { impl.error(error); } - }; - template - struct Impl3 : public Base { - T* impl; - Impl3(T* impl) : impl(impl) { } - void before(CollectionChangeSet const& c) override { impl->before(c); } - void after(CollectionChangeSet const& c) override { impl->after(c); } - void error(std::exception_ptr error) override { impl->error(error); } - }; - - std::shared_ptr m_impl; -}; -} // namespace realm - -#endif // REALM_COLLECTION_NOTIFICATIONS_HPP diff --git a/Pods/Realm/include/core/realm.hpp b/Pods/Realm/include/core/realm.hpp deleted file mode 100644 index 29e48449..00000000 --- a/Pods/Realm/include/core/realm.hpp +++ /dev/null @@ -1,27 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_HPP -#define REALM_HPP - -#include -#include -#include -#include - -#endif // REALM_HPP diff --git a/Pods/Realm/include/core/realm/alloc.hpp b/Pods/Realm/include/core/realm/alloc.hpp deleted file mode 100644 index 86eb04a5..00000000 --- a/Pods/Realm/include/core/realm/alloc.hpp +++ /dev/null @@ -1,455 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ALLOC_HPP -#define REALM_ALLOC_HPP - -#include -#include -#include - -#include -#include -#include -#include - -namespace realm { - -class Allocator; - -class Replication; - -using ref_type = size_t; - -int_fast64_t from_ref(ref_type) noexcept; -ref_type to_ref(int_fast64_t) noexcept; -int64_t to_int64(size_t value) noexcept; - -class MemRef { -public: - MemRef() noexcept; - ~MemRef() noexcept; - - MemRef(char* addr, ref_type ref, Allocator& alloc) noexcept; - MemRef(ref_type ref, Allocator& alloc) noexcept; - - char* get_addr(); - ref_type get_ref(); - void set_ref(ref_type ref); - void set_addr(char* addr); - -private: - char* m_addr; - ref_type m_ref; -#if REALM_ENABLE_MEMDEBUG - // Allocator that created m_ref. Used to verify that the ref is valid whenever you call - // get_ref()/get_addr and that it e.g. has not been free'ed - const Allocator* m_alloc = nullptr; -#endif -}; - - -/// The common interface for Realm allocators. -/// -/// A Realm allocator must associate a 'ref' to each allocated -/// object and be able to efficiently map any 'ref' to the -/// corresponding memory address. The 'ref' is an integer and it must -/// always be divisible by 8. Also, a value of zero is used to -/// indicate a null-reference, and must therefore never be returned by -/// Allocator::alloc(). -/// -/// The purpose of the 'refs' is to decouple the memory reference from -/// the actual address and thereby allowing objects to be relocated in -/// memory without having to modify stored references. -/// -/// \sa SlabAlloc -class Allocator { -public: - static constexpr int CURRENT_FILE_FORMAT_VERSION = 6; - - /// The specified size must be divisible by 8, and must not be - /// zero. - /// - /// \throw std::bad_alloc If insufficient memory was available. - MemRef alloc(size_t size); - - /// Calls do_realloc(). - /// - /// Note: The underscore has been added because the name `realloc` - /// would conflict with a macro on the Windows platform. - MemRef realloc_(ref_type, const char* addr, size_t old_size, size_t new_size); - - /// Calls do_free(). - /// - /// Note: The underscore has been added because the name `free - /// would conflict with a macro on the Windows platform. - void free_(ref_type, const char* addr) noexcept; - - /// Shorthand for free_(mem.get_ref(), mem.get_addr()). - void free_(MemRef mem) noexcept; - - /// Calls do_translate(). - char* translate(ref_type ref) const noexcept; - - /// Returns true if, and only if the object at the specified 'ref' - /// is in the immutable part of the memory managed by this - /// allocator. The method by which some objects become part of the - /// immuatble part is entirely up to the class that implements - /// this interface. - bool is_read_only(ref_type) const noexcept; - - /// Returns a simple allocator that can be used with free-standing - /// Realm objects (such as a free-standing table). A - /// free-standing object is one that is not part of a Group, and - /// therefore, is not part of an actual database. - static Allocator& get_default() noexcept; - - virtual ~Allocator() noexcept; - - virtual void verify() const = 0; - -#ifdef REALM_DEBUG - /// Terminate the program precisely when the specified 'ref' is - /// freed (or reallocated). You can use this to detect whether the - /// ref is freed (or reallocated), and even to get a stacktrace at - /// the point where it happens. Call watch(0) to stop watching - /// that ref. - void watch(ref_type ref) - { - m_debug_watch = ref; - } -#endif - - Replication* get_replication() noexcept; - - /// \brief The version of the format of the the node structure (in file or - /// in memory) in use by Realm objects associated with this allocator. - /// - /// Every allocator contains a file format version field, which is returned - /// by this function. In some cases (as mentioned below) the file format can - /// change. - /// - /// A value of zero means the the file format is not yet decided. This is - /// only possible for empty Realms where top-ref is zero. - /// - /// For the default allocator (get_default()), the file format version field - /// can never change, is never zero, and is set to whatever - /// Group::get_target_file_format_version_for_session() would return if the - /// original file format version was undecided and the request history type - /// was Replication::hist_None. - /// - /// For the slab allocator (AllocSlab), the file format version field is set - /// to the file format version specified by the attached file (or attached - /// memory buffer) at the time of attachment. If no file (or buffer) is - /// currently attached, the returned value has no meaning. If the Realm file - /// format is later upgraded, the file format version filed must be updated - /// to reflect that fact. - /// - /// In shared mode (when a Realm file is opened via a SharedGroup instance) - /// it can happen that the file format is upgraded asyncronously (via - /// another SharedGroup instance), and in that case the file format version - /// field of the allocator can get out of date, but only for a short - /// while. It is always garanteed to be, and remain up to date after the - /// opening process completes (when SharedGroup::do_open() returns). - /// - /// An empty Realm file (one whose top-ref is zero) may specify a file - /// format version of zero to indicate that the format is not yet - /// decided. In that case, this function will return zero immediately after - /// AllocSlab::attach_file() returns. It shall be guaranteed, however, that - /// the zero is changed to a proper file format version before the opening - /// process completes (Group::open() or SharedGroup::open()). It is the duty - /// of the caller of AllocSlab::attach_file() to ensure this. - /// - /// File format versions: - /// - /// 1 Initial file format version - /// - /// 2 Various changes. - /// - /// 3 Supporting null on string columns broke the file format in following - /// way: Index appends an 'X' character to all strings except the null - /// string, to be able to distinguish between null and empty - /// string. Bumped to 3 because of null support of String columns and - /// because of new format of index. - /// - /// 4 Introduction of optional in-Realm history of changes (additional - /// entries in Group::m_top). Since this change is not forward - /// compatible, the file format version had to be bumped. This change is - /// implemented in a way that achieves backwards compatibility with - /// version 3 (and in turn with version 2). - /// - /// 5 Introduced the new Timestamp column type that replaces DateTime. - /// When opening an older database file, all DateTime columns will be - /// automatically upgraded Timestamp columns. - /// - /// 6 Introduced a new structure for the StringIndex. Moved the commit - /// logs into the Realm file. Changes to the transaction log format - /// including reshuffling instructions. This is the format used in - /// milestone 2.0.0. - /// - /// IMPORTANT: When introducing a new file format version, be sure to review - /// the file validity checks in AllocSlab::validate_buffer(), the file - /// format selection logic in - /// Group::get_target_file_format_version_for_session(), and the file format - /// upgrade logic in Group::upgrade_file_format(). - int get_file_format_version() const noexcept; - -protected: - size_t m_baseline = 0; // Separation line between immutable and mutable refs. - - Replication* m_replication = nullptr; - - /// See get_file_format_version(). - int m_file_format_version = 0; - - ref_type m_debug_watch = 0; - - /// The specified size must be divisible by 8, and must not be - /// zero. - /// - /// \throw std::bad_alloc If insufficient memory was available. - virtual MemRef do_alloc(const size_t size) = 0; - - /// The specified size must be divisible by 8, and must not be - /// zero. - /// - /// The default version of this function simply allocates a new - /// chunk of memory, copies over the old contents, and then frees - /// the old chunk. - /// - /// \throw std::bad_alloc If insufficient memory was available. - virtual MemRef do_realloc(ref_type, const char* addr, size_t old_size, size_t new_size) = 0; - - /// Release the specified chunk of memory. - virtual void do_free(ref_type, const char* addr) noexcept = 0; - - /// Map the specified \a ref to the corresponding memory - /// address. Note that if is_read_only(ref) returns true, then the - /// referenced object is to be considered immutable, and it is - /// then entirely the responsibility of the caller that the memory - /// is not modified by way of the returned memory pointer. - virtual char* do_translate(ref_type ref) const noexcept = 0; - - Allocator() noexcept; - - // FIXME: This really doesn't belong in an allocator, but it is the best - // place for now, because every table has a pointer leading here. It would - // be more obvious to place it in Group, but that would add a runtime overhead, - // and access is time critical. - // - // This means that multiple threads that allocate Realm objects through the - // default allocator will share this variable, which is a logical design flaw - // that can make sync_if_needed() re-run queries even though it is not required. - // It must be atomic because it's shared. - std::atomic m_table_versioning_counter; - - /// Bump the global version counter. This method should be called when - /// version bumping is initiated. Then following calls to should_propagate_version() - /// can be used to prune the version bumping. - uint_fast64_t bump_global_version() noexcept; - - /// Determine if the "local_version" is out of sync, so that it should - /// be updated. In that case: also update it. Called from Table::bump_version - /// to control propagation of version updates on tables within the group. - bool should_propagate_version(uint_fast64_t& local_version) noexcept; - - friend class Table; - friend class Group; -}; - -inline uint_fast64_t Allocator::bump_global_version() noexcept -{ - ++m_table_versioning_counter; - return m_table_versioning_counter; -} - - -inline bool Allocator::should_propagate_version(uint_fast64_t& local_version) noexcept -{ - if (local_version != m_table_versioning_counter) { - local_version = m_table_versioning_counter; - return true; - } - else { - return false; - } -} - - -// Implementation: - -inline int_fast64_t from_ref(ref_type v) noexcept -{ - // Check that v is divisible by 8 (64-bit aligned). - REALM_ASSERT_DEBUG(v % 8 == 0); - - static_assert(std::is_same::value, - "If ref_type changes, from_ref and to_ref should probably be updated"); - - // Make sure that we preserve the bit pattern of the ref_type (without sign extension). - return util::from_twos_compl(uint_fast64_t(v)); -} - -inline ref_type to_ref(int_fast64_t v) noexcept -{ - // Check that v is divisible by 8 (64-bit aligned). - REALM_ASSERT_DEBUG(v % 8 == 0); - - // C++11 standard, paragraph 4.7.2 [conv.integral]: - // If the destination type is unsigned, the resulting value is the least unsigned integer congruent to the source - // integer (modulo 2n where n is the number of bits used to represent the unsigned type). [ Note: In a two’s - // complement representation, this conversion is conceptual and there is no change in the bit pattern (if there is - // no truncation). — end note ] - static_assert(std::is_unsigned::value, - "If ref_type changes, from_ref and to_ref should probably be updated"); - return ref_type(v); -} - -inline int64_t to_int64(size_t value) noexcept -{ - // FIXME: Enable once we get clang warning flags correct - // REALM_ASSERT_DEBUG(value <= std::numeric_limits::max()); - return static_cast(value); -} - - -inline MemRef::MemRef() noexcept - : m_addr(nullptr) - , m_ref(0) -{ -} - -inline MemRef::~MemRef() noexcept -{ -} - -inline MemRef::MemRef(char* addr, ref_type ref, Allocator& alloc) noexcept - : m_addr(addr) - , m_ref(ref) -{ - static_cast(alloc); -#if REALM_ENABLE_MEMDEBUG - m_alloc = &alloc; -#endif -} - -inline MemRef::MemRef(ref_type ref, Allocator& alloc) noexcept - : m_addr(alloc.translate(ref)) - , m_ref(ref) -{ - static_cast(alloc); -#if REALM_ENABLE_MEMDEBUG - m_alloc = &alloc; -#endif -} - -inline char* MemRef::get_addr() -{ -#if REALM_ENABLE_MEMDEBUG - // Asserts if the ref has been freed - m_alloc->translate(m_ref); -#endif - return m_addr; -} - -inline ref_type MemRef::get_ref() -{ -#if REALM_ENABLE_MEMDEBUG - // Asserts if the ref has been freed - m_alloc->translate(m_ref); -#endif - return m_ref; -} - -inline void MemRef::set_ref(ref_type ref) -{ -#if REALM_ENABLE_MEMDEBUG - // Asserts if the ref has been freed - m_alloc->translate(ref); -#endif - m_ref = ref; -} - -inline void MemRef::set_addr(char* addr) -{ - m_addr = addr; -} - -inline MemRef Allocator::alloc(size_t size) -{ - return do_alloc(size); -} - -inline MemRef Allocator::realloc_(ref_type ref, const char* addr, size_t old_size, size_t new_size) -{ -#ifdef REALM_DEBUG - if (ref == m_debug_watch) - REALM_TERMINATE("Allocator watch: Ref was reallocated"); -#endif - return do_realloc(ref, addr, old_size, new_size); -} - -inline void Allocator::free_(ref_type ref, const char* addr) noexcept -{ -#ifdef REALM_DEBUG - if (ref == m_debug_watch) - REALM_TERMINATE("Allocator watch: Ref was freed"); -#endif - return do_free(ref, addr); -} - -inline void Allocator::free_(MemRef mem) noexcept -{ - free_(mem.get_ref(), mem.get_addr()); -} - -inline char* Allocator::translate(ref_type ref) const noexcept -{ - return do_translate(ref); -} - -inline bool Allocator::is_read_only(ref_type ref) const noexcept -{ - REALM_ASSERT_DEBUG(ref != 0); - REALM_ASSERT_DEBUG(m_baseline != 0); // Attached SlabAlloc - return ref < m_baseline; -} - -inline Allocator::Allocator() noexcept -{ - m_table_versioning_counter = 0; -} - -inline Allocator::~Allocator() noexcept -{ -} - -inline Replication* Allocator::get_replication() noexcept -{ - return m_replication; -} - -inline int Allocator::get_file_format_version() const noexcept -{ - return m_file_format_version; -} - - -} // namespace realm - -#endif // REALM_ALLOC_HPP diff --git a/Pods/Realm/include/core/realm/alloc_slab.hpp b/Pods/Realm/include/core/realm/alloc_slab.hpp deleted file mode 100644 index 0d67f603..00000000 --- a/Pods/Realm/include/core/realm/alloc_slab.hpp +++ /dev/null @@ -1,592 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ALLOC_SLAB_HPP -#define REALM_ALLOC_SLAB_HPP - -#include // unint8_t etc -#include -#include -#include - -#include -#include -#include -#include - -namespace realm { - -// Pre-declarations -class Group; -class GroupWriter; - - -/// Thrown by Group and SharedGroup constructors if the specified file -/// (or memory buffer) does not appear to contain a valid Realm -/// database. -struct InvalidDatabase; - - -/// The allocator that is used to manage the memory of a Realm -/// group, i.e., a Realm database. -/// -/// Optionally, it can be attached to an pre-existing database (file -/// or memory buffer) which then becomes an immuatble part of the -/// managed memory. -/// -/// To attach a slab allocator to a pre-existing database, call -/// attach_file() or attach_buffer(). To create a new database -/// in-memory, call attach_empty(). -/// -/// For efficiency, this allocator manages its mutable memory as a set -/// of slabs. -class SlabAlloc : public Allocator { -public: - ~SlabAlloc() noexcept override; - SlabAlloc(); - - /// \struct Config - /// \brief Storage for combining setup flags for initialization to - /// the SlabAlloc. - /// - /// \var Config::is_shared - /// Must be true if, and only if we are called on behalf of SharedGroup. - /// - /// \var Config::read_only - /// Open the file in read-only mode. This implies \a Config::no_create. - /// - /// \var Config::no_create - /// Fail if the file does not already exist. - /// - /// \var Config::skip_validate - /// Skip validation of file header. In a - /// set of overlapping SharedGroups, only the first one (the one - /// that creates/initlializes the coordination file) may validate - /// the header, otherwise it will result in a race condition. - /// - /// \var Config::encryption_key - /// 32-byte key to use to encrypt and decrypt the backing storage, - /// or nullptr to disable encryption. - /// - /// \var Config::session_initiator - /// If set, the caller is the session initiator and - /// guarantees exclusive access to the file. If attaching in - /// read/write mode, the file is modified: files on streaming form - /// is changed to non-streaming form, and if needed the file size - /// is adjusted to match mmap boundaries. - /// Must be set to false if is_shared is false. - /// - /// \var Config::clear_file - /// Always initialize the file as if it was a newly - /// created file and ignore any pre-existing contents. Requires that - /// Config::session_initiator be true as well. - struct Config { - bool is_shared = false; - bool read_only = false; - bool no_create = false; - bool skip_validate = false; - bool session_initiator = false; - bool clear_file = false; - const char* encryption_key = nullptr; - }; - - struct Retry { - }; - - /// \brief Attach this allocator to the specified file. - /// - /// It is an error if this function is called at a time where the specified - /// Realm file (file system inode) is modified asynchronously. - /// - /// In non-shared mode (when this function is called on behalf of a - /// free-standing Group instance), it is the responsibility of the - /// application to ensure that the Realm file is not modified concurrently - /// from any other thread or process. - /// - /// In shared mode (when this function is called on behalf of a SharedGroup - /// instance), the caller (SharedGroup::do_open()) must take steps to ensure - /// cross-process mutual exclusion. - /// - /// If the attached file contains an empty Realm (one whose top-ref is - /// zero), the file format version may remain undecided upon return from - /// this function. The file format is undecided if, and only if - /// get_file_format_version() returns zero. The caller is required to check - /// for this case, and decide on a file format version. This must happen - /// before the Realm opening process completes, and the decided file format - /// must be set in the allocator by calling set_file_format_version(). - /// - /// Except for \a file_path, the parameters are passed in through a - /// configuration object. - /// - /// \return The `ref` of the root node, or zero if there is none. - /// - /// Please note that attach_file can fail to attach to a file due to a - /// collision with a writer extending the file. This can only happen if the - /// caller is *not* the session initiator. When this happens, attach_file() - /// throws SlabAlloc::Retry, and the caller must retry the call. The caller - /// should check if it has become the session initiator before retrying. - /// This can happen if the conflicting thread (or process) terminates or - /// crashes before the next retry. - /// - /// \throw util::File::AccessError - /// \throw SlabAlloc::Retry - ref_type attach_file(const std::string& file_path, Config& cfg); - - /// Get the attached file. Only valid when called on an allocator with - /// an attached file. - util::File& get_file(); - - /// Attach this allocator to the specified memory buffer. - /// - /// If the attached buffer contains an empty Realm (one whose top-ref is - /// zero), the file format version may remain undecided upon return from - /// this function. The file format is undecided if, and only if - /// get_file_format_version() returns zero. The caller is required to check - /// for this case, and decide on a file format version. This must happen - /// before the Realm opening process completes, and the decided file format - /// must be set in the allocator by calling set_file_format_version(). - /// - /// It is an error to call this function on an attached - /// allocator. Doing so will result in undefined behavor. - /// - /// \return The `ref` of the root node, or zero if there is none. - /// - /// \sa own_buffer() - /// - /// \throw InvalidDatabase - ref_type attach_buffer(const char* data, size_t size); - - /// Reads file format from file header. Must be called from within a write - /// transaction. - int get_committed_file_format_version() const noexcept; - - /// Attach this allocator to an empty buffer. - /// - /// Upon return from this function, the file format is undecided - /// (get_file_format_version() returns zero). The caller is required to - /// decide on a file format version. This must happen before the Realm - /// opening process completes, and the decided file format must be set in - /// the allocator by calling set_file_format_version(). - /// - /// It is an error to call this function on an attached - /// allocator. Doing so will result in undefined behavor. - void attach_empty(); - - /// Detach from a previously attached file or buffer. - /// - /// This function does not reset free space tracking. To - /// completely reset the allocator, you must also call - /// reset_free_space_tracking(). - /// - /// This function has no effect if the allocator is already in the - /// detached state (idempotency). - void detach() noexcept; - - class DetachGuard; - - /// If a memory buffer has been attached using attach_buffer(), - /// mark it as owned by this slab allocator. Behaviour is - /// undefined if this function is called on a detached allocator, - /// one that is not attached using attach_buffer(), or one for - /// which this function has already been called during the latest - /// attachment. - void own_buffer() noexcept; - - /// Returns true if, and only if this allocator is currently - /// in the attached state. - bool is_attached() const noexcept; - - /// Returns true if, and only if this allocator is currently in - /// the attached state and attachment was not established using - /// attach_empty(). - bool nonempty_attachment() const noexcept; - - /// Reserve disk space now to avoid allocation errors at a later - /// point in time, and to minimize on-disk fragmentation. In some - /// cases, less fragmentation translates into improved - /// performance. On flash or SSD-drives this is likely a waste. - /// - /// Note: File::prealloc() may misbehave under race conditions (see - /// documentation of File::prealloc()). For that reason, to avoid race - /// conditions, when this allocator is used in a transactional mode, this - /// function may be called only when the caller has exclusive write - /// access. In non-transactional mode it is the responsibility of the user - /// to ensure non-concurrent file mutation. - /// - /// This function will call File::sync(). - /// - /// It is an error to call this function on an allocator that is not - /// attached to a file. Doing so will result in undefined behavior. - void resize_file(size_t new_file_size); - - /// Reserve disk space now to avoid allocation errors at a later point in - /// time, and to minimize on-disk fragmentation. In some cases, less - /// fragmentation translates into improved performance. On SSD-drives - /// preallocation is likely a waste. - /// - /// When supported by the system, a call to this function will make the - /// database file at least as big as the specified size, and cause space on - /// the target device to be allocated (note that on many systems on-disk - /// allocation is done lazily by default). If the file is already bigger - /// than the specified size, the size will be unchanged, and on-disk - /// allocation will occur only for the initial section that corresponds to - /// the specified size. On systems that do not support preallocation, this - /// function has no effect. To know whether preallocation is supported by - /// Realm on your platform, call util::File::is_prealloc_supported(). - /// - /// This function will call File::sync() if it changes the size of the file. - /// - /// It is an error to call this function on an allocator that is not - /// attached to a file. Doing so will result in undefined behavior. - void reserve_disk_space(size_t size_in_bytes); - - /// Get the size of the attached database file or buffer in number - /// of bytes. This size is not affected by new allocations. After - /// attachment, it can only be modified by a call to remap(). - /// - /// It is an error to call this function on a detached allocator, - /// or one that was attached using attach_empty(). Doing so will - /// result in undefined behavior. - size_t get_baseline() const noexcept; - - /// Get the total amount of managed memory. This is the baseline plus the - /// sum of the sizes of the allocated slabs. It includes any free space. - /// - /// It is an error to call this function on a detached - /// allocator. Doing so will result in undefined behavior. - size_t get_total_size() const noexcept; - - /// Mark all mutable memory (ref-space outside the attached file) as free - /// space. - void reset_free_space_tracking(); - - /// Remap the attached file such that a prefix of the specified - /// size becomes available in memory. If sucessfull, - /// get_baseline() will return the specified new file size. - /// - /// It is an error to call this function on a detached allocator, - /// or one that was not attached using attach_file(). Doing so - /// will result in undefined behavior. - /// - /// The file_size argument must be aligned to a *section* boundary: - /// The database file is logically split into sections, each section - /// guaranteed to be mapped as a contiguous address range. The allocation - /// of memory in the file must ensure that no allocation crosses the - /// boundary between two sections. - void remap(size_t file_size); - - /// Returns true initially, and after a call to reset_free_space_tracking() - /// up until the point of the first call to SlabAlloc::alloc(). Note that a - /// call to SlabAlloc::alloc() corresponds to a mutation event. - bool is_free_space_clean() const noexcept; - - /// \brief Update the file format version field of the allocator. - /// - /// This must be done during the opening of the Realm if the stored file - /// format version is zero (empty Realm), or after the file format is - /// upgraded. - /// - /// Note that this does not modify the attached file, only the "cached" - /// value subsequenty returned by get_file_format_version(). - /// - /// \sa get_file_format_version() - void set_file_format_version(int) noexcept; - - void verify() const override; -#ifdef REALM_DEBUG - void enable_debug(bool enable) - { - m_debug_out = enable; - } - bool is_all_free() const; - void print() const; -#endif - struct MappedFile; - -protected: - MemRef do_alloc(const size_t size) override; - MemRef do_realloc(ref_type, const char*, size_t old_size, size_t new_size) override; - // FIXME: It would be very nice if we could detect an invalid free operation in debug mode - void do_free(ref_type, const char*) noexcept override; - char* do_translate(ref_type) const noexcept override; - void invalidate_cache() noexcept; - -private: - enum AttachMode { - attach_None, // Nothing is attached - attach_OwnedBuffer, // We own the buffer (m_data = nullptr for empty buffer) - attach_UsersBuffer, // We do not own the buffer - attach_SharedFile, // On behalf of SharedGroup - attach_UnsharedFile // Not on behalf of SharedGroup - }; - - // A slab is a dynamically allocated contiguous chunk of memory used to - // extend the amount of space available for database node - // storage. Inter-node references are represented as file offsets - // (a.k.a. "refs"), and each slab creates an apparently seamless extension - // of this file offset addressable space. Slabes are stored as rows in the - // Slabs table in order of ascending file offsets. - struct Slab { - ref_type ref_end; - char* addr; - }; - struct Chunk { - ref_type ref; - size_t size; - }; - - // Values of each used bit in m_flags - enum { - flags_SelectBit = 1, - }; - - // 24 bytes - struct Header { - uint64_t m_top_ref[2]; // 2 * 8 bytes - // Info-block 8-bytes - uint8_t m_mnemonic[4]; // "T-DB" - uint8_t m_file_format[2]; // See `library_file_format` - uint8_t m_reserved; - // bit 0 of m_flags is used to select between the two top refs. - uint8_t m_flags; - }; - - // 16 bytes - struct StreamingFooter { - uint64_t m_top_ref; - uint64_t m_magic_cookie; - }; - - static_assert(sizeof(Header) == 24, "Bad header size"); - static_assert(sizeof(StreamingFooter) == 16, "Bad footer size"); - - static const Header empty_file_header; - static void init_streaming_header(Header*, int file_format_version); - - static const uint_fast64_t footer_magic_cookie = 0x3034125237E526C8ULL; - - // The mappings are shared, if they are from a file - std::shared_ptr m_file_mappings; - - // We are caching local copies of all the additional mappings to allow - // for lock-free lookup during ref->address translation (we do not need - // to cache the first mapping, because it is immutable) (well, all the - // mappings are immutable, but the array holding them is not - it may - // have to be relocated) - std::unique_ptr>[]> m_local_mappings; - size_t m_num_local_mappings = 0; - - const char* m_data = nullptr; - size_t m_initial_chunk_size = 0; - size_t m_initial_section_size = 0; - int m_section_shifts = 0; - std::unique_ptr m_section_bases; - size_t m_num_section_bases = 0; - AttachMode m_attach_mode = attach_None; - bool m_file_on_streaming_form = false; - enum FeeeSpaceState { - free_space_Clean, - free_space_Dirty, - free_space_Invalid, - }; - - /// When set to free_space_Invalid, the free lists are no longer - /// up-to-date. This happens if do_free() or - /// reset_free_space_tracking() fails, presumably due to - /// std::bad_alloc being thrown during updating of the free space - /// list. In this this case, alloc(), realloc_(), and - /// get_free_read_only() must throw. This member is deliberately - /// placed here (after m_attach_mode) in the hope that it leads to - /// less padding between members due to alignment requirements. - FeeeSpaceState m_free_space_state = free_space_Clean; - - typedef std::vector slabs; - typedef std::vector chunks; - slabs m_slabs; - chunks m_free_space; - chunks m_free_read_only; - - bool m_debug_out = false; - struct hash_entry { - ref_type ref = 0; - const char* addr = nullptr; - size_t version = 0; - }; - mutable hash_entry cache[256]; - mutable size_t version = 1; - - /// Throws if free-lists are no longer valid. - void consolidate_free_read_only(); - /// Throws if free-lists are no longer valid. - const chunks& get_free_read_only() const; - - /// Throws InvalidDatabase if the file is not a Realm file, if the file is - /// corrupted, or if the specified encryption key is incorrect. This - /// function will not detect all forms of corruption, though. - void validate_buffer(const char* data, size_t len, const std::string& path, bool is_shared); - - /// Read the top_ref from the given buffer and set m_file_on_streaming_form - /// if the buffer contains a file in streaming form - ref_type get_top_ref(const char* data, size_t len); - - class ChunkRefEq; - class ChunkRefEndEq; - class SlabRefEndEq; - static bool ref_less_than_slab_ref_end(ref_type, const Slab&) noexcept; - - Replication* get_replication() const noexcept - { - return m_replication; - } - void set_replication(Replication* r) noexcept - { - m_replication = r; - } - - /// Returns the first section boundary *above* the given position. - size_t get_upper_section_boundary(size_t start_pos) const noexcept; - - /// Returns the first section boundary *at or below* the given position. - size_t get_lower_section_boundary(size_t start_pos) const noexcept; - - /// Returns true if the given position is at a section boundary - bool matches_section_boundary(size_t pos) const noexcept; - - /// Returns the index of the section holding a given address. - /// The section index is determined solely by the minimal section size, - /// and does not necessarily reflect the mapping. A mapping may - /// cover multiple sections - the initial mapping often does. - size_t get_section_index(size_t pos) const noexcept; - - /// Reverse: get the base offset of a section at a given index. Since the - /// computation is very time critical, this method just looks it up in - /// a table. The actual computation and setup of that table is done - /// during initialization with the help of compute_section_base() below. - inline size_t get_section_base(size_t index) const noexcept; - - /// Actually compute the starting offset of a section. Only used to initialize - /// a table of predefined results, which are then used by get_section_base(). - size_t compute_section_base(size_t index) const noexcept; - - /// Find a possible allocation of 'request_size' that will fit into a section - /// which is inside the range from 'start_pos' to 'start_pos'+'free_chunk_size' - /// If found return the position, if not return 0. - size_t find_section_in_range(size_t start_pos, size_t free_chunk_size, size_t request_size) const noexcept; - - friend class Group; - friend class GroupWriter; -}; - -inline void SlabAlloc::invalidate_cache() noexcept -{ - ++version; -} - -class SlabAlloc::DetachGuard { -public: - DetachGuard(SlabAlloc& alloc) noexcept - : m_alloc(&alloc) - { - } - ~DetachGuard() noexcept; - SlabAlloc* release() noexcept; - -private: - SlabAlloc* m_alloc; -}; - - -// Implementation: - -struct InvalidDatabase : util::File::AccessError { - InvalidDatabase(const std::string& msg, const std::string& path) - : util::File::AccessError(msg, path) - { - } -}; - -inline void SlabAlloc::own_buffer() noexcept -{ - REALM_ASSERT_3(m_attach_mode, ==, attach_UsersBuffer); - REALM_ASSERT(m_data); - REALM_ASSERT(m_file_mappings == nullptr); - m_attach_mode = attach_OwnedBuffer; -} - -inline bool SlabAlloc::is_attached() const noexcept -{ - return m_attach_mode != attach_None; -} - -inline bool SlabAlloc::nonempty_attachment() const noexcept -{ - return is_attached() && m_data; -} - -inline size_t SlabAlloc::get_baseline() const noexcept -{ - REALM_ASSERT_DEBUG(is_attached()); - return m_baseline; -} - -inline bool SlabAlloc::is_free_space_clean() const noexcept -{ - return m_free_space_state == free_space_Clean; -} - -inline SlabAlloc::DetachGuard::~DetachGuard() noexcept -{ - if (m_alloc) - m_alloc->detach(); -} - -inline SlabAlloc* SlabAlloc::DetachGuard::release() noexcept -{ - SlabAlloc* alloc = m_alloc; - m_alloc = nullptr; - return alloc; -} - -inline bool SlabAlloc::ref_less_than_slab_ref_end(ref_type ref, const Slab& slab) noexcept -{ - return ref < slab.ref_end; -} - -inline size_t SlabAlloc::get_upper_section_boundary(size_t start_pos) const noexcept -{ - return get_section_base(1 + get_section_index(start_pos)); -} - -inline size_t SlabAlloc::get_lower_section_boundary(size_t start_pos) const noexcept -{ - return get_section_base(get_section_index(start_pos)); -} - -inline bool SlabAlloc::matches_section_boundary(size_t pos) const noexcept -{ - return pos == get_lower_section_boundary(pos); -} - -inline size_t SlabAlloc::get_section_base(size_t index) const noexcept -{ - return m_section_bases[index]; -} - -} // namespace realm - -#endif // REALM_ALLOC_SLAB_HPP diff --git a/Pods/Realm/include/core/realm/array.hpp b/Pods/Realm/include/core/realm/array.hpp deleted file mode 100644 index 2ad7a2dd..00000000 --- a/Pods/Realm/include/core/realm/array.hpp +++ /dev/null @@ -1,3053 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -/* -Searching: The main finding function is: - template - void find(int64_t value, size_t start, size_t end, size_t baseindex, QueryState *state, Callback callback) const - - cond: One of Equal, NotEqual, Greater, etc. classes - Action: One of act_ReturnFirst, act_FindAll, act_Max, act_CallbackIdx, etc, constants - Callback: Optional function to call for each search result. Will be called if action == act_CallbackIdx - - find() will call find_action_pattern() or find_action() that again calls match() for each search result which - optionally calls callback(): - - find() -> find_action() -------> bool match() -> bool callback() - | ^ - +-> find_action_pattern()----+ - - If callback() returns false, find() will exit, otherwise it will keep searching remaining items in array. -*/ - -#ifndef REALM_ARRAY_HPP -#define REALM_ARRAY_HPP - -#include -#include // size_t -#include -#include -#include -#include - -#include // unint8_t etc - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - MMX: mmintrin.h - SSE: xmmintrin.h - SSE2: emmintrin.h - SSE3: pmmintrin.h - SSSE3: tmmintrin.h - SSE4A: ammintrin.h - SSE4.1: smmintrin.h - SSE4.2: nmmintrin.h -*/ -#ifdef REALM_COMPILER_SSE -#include // SSE2 -#include // SSE42 -#endif - -namespace realm { - -enum Action { - act_ReturnFirst, - act_Sum, - act_Max, - act_Min, - act_Count, - act_FindAll, - act_CallIdx, - act_CallbackIdx, - act_CallbackVal, - act_CallbackNone, - act_CallbackBoth, - act_Average -}; - -template -inline T no0(T v) -{ - return v == 0 ? 1 : v; -} - -/// Special index value. It has various meanings depending on -/// context. It is returned by some search functions to indicate 'not -/// found'. It is similar in function to std::string::npos. -const size_t npos = size_t(-1); - -// Maximum number of bytes that the payload of an array can be -const size_t max_array_payload = 0x00ffffffL; - -/// Alias for realm::npos. -const size_t not_found = npos; - -// Pre-definitions -class Array; -class StringColumn; -class GroupWriter; -template -class QueryState; -namespace _impl { -class ArrayWriterBase; -} - - -#ifdef REALM_DEBUG -struct MemStats { - size_t allocated = 0; - size_t used = 0; - size_t array_count = 0; -}; -template -std::basic_ostream& operator<<(std::basic_ostream& out, MemStats stats); -#endif - - -// Stores a value obtained from Array::get(). It is a ref if the least -// significant bit is clear, otherwise it is a tagged integer. A tagged interger -// is obtained from a logical integer value by left shifting by one bit position -// (multiplying by two), and then setting the least significant bit to -// one. Clearly, this means that the maximum value that can be stored as a -// tagged integer is 2**63 - 1. -class RefOrTagged { -public: - bool is_ref() const noexcept; - bool is_tagged() const noexcept; - ref_type get_as_ref() const noexcept; - uint_fast64_t get_as_int() const noexcept; - - static RefOrTagged make_ref(ref_type) noexcept; - static RefOrTagged make_tagged(uint_fast64_t) noexcept; - -private: - int_fast64_t m_value; - RefOrTagged(int_fast64_t) noexcept; - friend class Array; -}; - - -class ArrayParent { -public: - virtual ~ArrayParent() noexcept - { - } - -protected: - virtual void update_child_ref(size_t child_ndx, ref_type new_ref) = 0; - - virtual ref_type get_child_ref(size_t child_ndx) const noexcept = 0; - - // Used only by Array::to_dot(). - virtual std::pair get_to_dot_parent(size_t ndx_in_parent) const = 0; - - friend class Array; -}; - -struct TreeInsertBase { - size_t m_split_offset; - size_t m_split_size; -}; - -/// Provides access to individual array nodes of the database. -/// -/// This class serves purely as an accessor, it assumes no ownership of the -/// referenced memory. -/// -/// An array accessor can be in one of two states: attached or unattached. It is -/// in the attached state if, and only if is_attached() returns true. Most -/// non-static member functions of this class have undefined behaviour if the -/// accessor is in the unattached state. The exceptions are: is_attached(), -/// detach(), create(), init_from_ref(), init_from_mem(), init_from_parent(), -/// has_parent(), get_parent(), set_parent(), get_ndx_in_parent(), -/// set_ndx_in_parent(), adjust_ndx_in_parent(), and get_ref_from_parent(). -/// -/// An array accessor contains information about the parent of the referenced -/// array node. This 'reverse' reference is not explicitely present in the -/// underlying node hierarchy, but it is needed when modifying an array. A -/// modification may lead to relocation of the underlying array node, and the -/// parent must be updated accordingly. Since this applies recursivly all the -/// way to the root node, it is essential that the entire chain of parent -/// accessors is constructed and propperly maintained when a particular array is -/// modified. -/// -/// The parent reference (`pointer to parent`, `index in parent`) is updated -/// independently from the state of attachment to an underlying node. In -/// particular, the parent reference remains valid and is unannfected by changes -/// in attachment. These two aspects of the state of the accessor is updated -/// independently, and it is entirely the responsibility of the caller to update -/// them such that they are consistent with the underlying node hierarchy before -/// calling any method that modifies the underlying array node. -/// -/// FIXME: This class currently has fragments of ownership, in particular the -/// constructors that allocate underlying memory. On the other hand, the -/// destructor never frees the memory. This is a problematic situation, because -/// it so easily becomes an obscure source of leaks. There are three options for -/// a fix of which the third is most attractive but hardest to implement: (1) -/// Remove all traces of ownership semantics, that is, remove the constructors -/// that allocate memory, but keep the trivial copy constructor. For this to -/// work, it is important that the constness of the accessor has nothing to do -/// with the constness of the underlying memory, otherwise constness can be -/// violated simply by copying the accessor. (2) Disallov copying but associate -/// the constness of the accessor with the constness of the underlying -/// memory. (3) Provide full ownership semantics like is done for Table -/// accessors, and provide a proper copy constructor that really produces a copy -/// of the array. For this to work, the class should assume ownership if, and -/// only if there is no parent. A copy produced by a copy constructor will not -/// have a parent. Even if the original was part of a database, the copy will be -/// free-standing, that is, not be part of any database. For intra, or inter -/// database copying, one would have to also specify the target allocator. -class Array : public ArrayParent { -public: - // void state_init(int action, QueryState *state); - // bool match(int action, size_t index, int64_t value, QueryState *state); - - /// Create an array accessor in the unattached state. - explicit Array(Allocator&) noexcept; - - ~Array() noexcept override - { - } - - enum Type { - type_Normal, - - /// This array is the main array of an innner node of a B+-tree as used - /// in table columns. - type_InnerBptreeNode, - - /// This array may contain refs to subarrays. An element whose least - /// significant bit is zero, is a ref pointing to a subarray. An element - /// whose least significant bit is one, is just a value. It is the - /// responsibility of the application to ensure that non-ref values have - /// their least significant bit set. This will generally be done by - /// shifting the desired vlue to the left by one bit position, and then - /// setting the vacated bit to one. - type_HasRefs - }; - - /// Create a new integer array of the specified type and size, and filled - /// with the specified value, and attach this accessor to it. This does not - /// modify the parent reference information of this accessor. - /// - /// Note that the caller assumes ownership of the allocated underlying - /// node. It is not owned by the accessor. - void create(Type, bool context_flag = false, size_t size = 0, int_fast64_t value = 0); - - /// Reinitialize this array accessor to point to the specified new - /// underlying memory. This does not modify the parent reference information - /// of this accessor. - void init_from_ref(ref_type) noexcept; - - /// Same as init_from_ref(ref_type) but avoid the mapping of 'ref' to memory - /// pointer. - void init_from_mem(MemRef) noexcept; - - /// Same as `init_from_ref(get_ref_from_parent())`. - void init_from_parent() noexcept; - - /// Update the parents reference to this child. This requires, of course, - /// that the parent information stored in this child is up to date. If the - /// parent pointer is set to null, this function has no effect. - void update_parent(); - - /// Called in the context of Group::commit() to ensure that attached - /// accessors stay valid across a commit. Please note that this works only - /// for non-transactional commits. Accessors obtained during a transaction - /// are always detached when the transaction ends. - /// - /// Returns true if, and only if the array has changed. If the array has not - /// changed, then its children are guaranteed to also not have changed. - bool update_from_parent(size_t old_baseline) noexcept; - - /// Change the type of an already attached array node. - /// - /// The effect of calling this function on an unattached accessor is - /// undefined. - void set_type(Type); - - /// Construct a complete copy of this array (including its subarrays) using - /// the specified target allocator and return just the reference to the - /// underlying memory. - MemRef clone_deep(Allocator& target_alloc) const; - - /// Construct an empty integer array of the specified type, and return just - /// the reference to the underlying memory. - static MemRef create_empty_array(Type, bool context_flag, Allocator&); - - /// Construct an integer array of the specified type and size, and return - /// just the reference to the underlying memory. All elements will be - /// initialized to the specified value. - static MemRef create_array(Type, bool context_flag, size_t size, int_fast64_t value, Allocator&); - - /// Construct a shallow copy of the specified slice of this array using the - /// specified target allocator. Subarrays will **not** be cloned. See - /// slice_and_clone_children() for an alternative. - MemRef slice(size_t offset, size_t slice_size, Allocator& target_alloc) const; - - /// Construct a deep copy of the specified slice of this array using the - /// specified target allocator. Subarrays will be cloned. - MemRef slice_and_clone_children(size_t offset, size_t slice_size, Allocator& target_alloc) const; - - // Parent tracking - bool has_parent() const noexcept; - ArrayParent* get_parent() const noexcept; - - /// Setting a new parent affects ownership of the attached array node, if - /// any. If a non-null parent is specified, and there was no parent - /// originally, then the caller passes ownership to the parent, and vice - /// versa. This assumes, of course, that the change in parentship reflects a - /// corresponding change in the list of children in the affected parents. - void set_parent(ArrayParent* parent, size_t ndx_in_parent) noexcept; - - size_t get_ndx_in_parent() const noexcept; - void set_ndx_in_parent(size_t) noexcept; - void adjust_ndx_in_parent(int diff) noexcept; - - /// Get the ref of this array as known to the parent. The caller must ensure - /// that the parent information ('pointer to parent' and 'index in parent') - /// is correct before calling this function. - ref_type get_ref_from_parent() const noexcept; - - bool is_attached() const noexcept; - - /// Detach from the underlying array node. This method has no effect if the - /// accessor is currently unattached (idempotency). - void detach() noexcept; - - size_t size() const noexcept; - bool is_empty() const noexcept; - Type get_type() const noexcept; - - static void add_to_column(IntegerColumn* column, int64_t value); - - void insert(size_t ndx, int_fast64_t value); - void add(int_fast64_t value); - - /// This function is guaranteed to not throw if the current width is - /// sufficient for the specified value (e.g. if you have called - /// ensure_minimum_width(value)) and get_alloc().is_read_only(get_ref()) - /// returns false (noexcept:array-set). Note that for a value of zero, the - /// first criterion is trivially satisfied. - void set(size_t ndx, int64_t value); - - void set_as_ref(size_t ndx, ref_type ref); - - template - void set(size_t ndx, int64_t value); - - int64_t get(size_t ndx) const noexcept; - - template - int64_t get(size_t ndx) const noexcept; - - void get_chunk(size_t ndx, int64_t res[8]) const noexcept; - - template - void get_chunk(size_t ndx, int64_t res[8]) const noexcept; - - ref_type get_as_ref(size_t ndx) const noexcept; - - RefOrTagged get_as_ref_or_tagged(size_t ndx) const noexcept; - void set(size_t ndx, RefOrTagged); - void add(RefOrTagged); - void ensure_minimum_width(RefOrTagged); - - int64_t front() const noexcept; - int64_t back() const noexcept; - - /// Remove the element at the specified index, and move elements at higher - /// indexes to the next lower index. - /// - /// This function does **not** destroy removed subarrays. That is, if the - /// erased element is a 'ref' pointing to a subarray, then that subarray - /// will not be destroyed automatically. - /// - /// This function guarantees that no exceptions will be thrown if - /// get_alloc().is_read_only(get_ref()) would return false before the - /// call. This is automatically guaranteed if the array is used in a - /// non-transactional context, or if the array has already been successfully - /// modified within the current write transaction. - void erase(size_t ndx); - - /// Same as erase(size_t), but remove all elements in the specified - /// range. - /// - /// Please note that this function does **not** destroy removed subarrays. - /// - /// This function guarantees that no exceptions will be thrown if - /// get_alloc().is_read_only(get_ref()) would return false before the call. - void erase(size_t begin, size_t end); - - /// Reduce the size of this array to the specified number of elements. It is - /// an error to specify a size that is greater than the current size of this - /// array. The effect of doing so is undefined. This is just a shorthand for - /// calling the ranged erase() function with appropriate arguments. - /// - /// Please note that this function does **not** destroy removed - /// subarrays. See clear_and_destroy_children() for an alternative. - /// - /// This function guarantees that no exceptions will be thrown if - /// get_alloc().is_read_only(get_ref()) would return false before the call. - void truncate(size_t new_size); - - /// Reduce the size of this array to the specified number of elements. It is - /// an error to specify a size that is greater than the current size of this - /// array. The effect of doing so is undefined. Subarrays will be destroyed - /// recursively, as if by a call to `destroy_deep(subarray_ref, alloc)`. - /// - /// This function is guaranteed not to throw if - /// get_alloc().is_read_only(get_ref()) returns false. - void truncate_and_destroy_children(size_t new_size); - - /// Remove every element from this array. This is just a shorthand for - /// calling truncate(0). - /// - /// Please note that this function does **not** destroy removed - /// subarrays. See clear_and_destroy_children() for an alternative. - /// - /// This function guarantees that no exceptions will be thrown if - /// get_alloc().is_read_only(get_ref()) would return false before the call. - void clear(); - - /// Remove every element in this array. Subarrays will be destroyed - /// recursively, as if by a call to `destroy_deep(subarray_ref, - /// alloc)`. This is just a shorthand for calling - /// truncate_and_destroy_children(0). - /// - /// This function guarantees that no exceptions will be thrown if - /// get_alloc().is_read_only(get_ref()) would return false before the call. - void clear_and_destroy_children(); - - /// If neccessary, expand the representation so that it can store the - /// specified value. - void ensure_minimum_width(int_fast64_t value); - - /// This one may change the represenation of the array, so be carefull if - /// you call it after ensure_minimum_width(). - void set_all_to_zero(); - - /// Add \a diff to the element at the specified index. - void adjust(size_t ndx, int_fast64_t diff); - - /// Add \a diff to all the elements in the specified index range. - void adjust(size_t begin, size_t end, int_fast64_t diff); - - /// Add signed \a diff to all elements that are greater than, or equal to \a - /// limit. - void adjust_ge(int_fast64_t limit, int_fast64_t diff); - - //@{ - /// These are similar in spirit to std::move() and std::move_backward from - /// ``. \a dest_begin must not be in the range [`begin`,`end`), and - /// \a dest_end must not be in the range (`begin`,`end`]. - /// - /// These functions are guaranteed to not throw if - /// `get_alloc().is_read_only(get_ref())` returns false. - void move(size_t begin, size_t end, size_t dest_begin); - void move_backward(size_t begin, size_t end, size_t dest_end); - //@} - - /// move_rotate moves one element from \a from to be located at index \a to, - /// shifting all elements inbetween by one. - /// - /// If \a from is larger than \a to, the elements inbetween are shifted down. - /// If \a to is larger than \a from, the elements inbetween are shifted up. - /// - /// This function is guaranteed to not throw if - /// `get_alloc().is_read_only(get_ref())` returns false. - void move_rotate(size_t from, size_t to, size_t num_elems = 1); - - //@{ - /// Find the lower/upper bound of the specified value in a sequence of - /// integers which must already be sorted ascendingly. - /// - /// For an integer value '`v`', lower_bound_int(v) returns the index '`l`' - /// of the first element such that `get(l) ≥ v`, and upper_bound_int(v) - /// returns the index '`u`' of the first element such that `get(u) > - /// v`. In both cases, if no such element is found, the returned value is - /// the number of elements in the array. - /// - /// 3 3 3 4 4 4 5 6 7 9 9 9 - /// ^ ^ ^ ^ ^ - /// | | | | | - /// | | | | -- Lower and upper bound of 15 - /// | | | | - /// | | | -- Lower and upper bound of 8 - /// | | | - /// | | -- Upper bound of 4 - /// | | - /// | -- Lower bound of 4 - /// | - /// -- Lower and upper bound of 1 - /// - /// These functions are similar to std::lower_bound() and - /// std::upper_bound(). - /// - /// We currently use binary search. See for example - /// http://www.tbray.org/ongoing/When/200x/2003/03/22/Binary. - /// - /// FIXME: It may be worth considering if overall efficiency can be improved - /// by doing a linear search for short sequences. - size_t lower_bound_int(int64_t value) const noexcept; - size_t upper_bound_int(int64_t value) const noexcept; - //@} - - /// \brief Search the \c Array for a value greater or equal than \a target, - /// starting the search at the \a start index. If \a indirection is - /// provided, use it as a look-up table to iterate over the \c Array. - /// - /// If \a indirection is not provided, then the \c Array must be sorted in - /// ascending order. If \a indirection is provided, then its values should - /// point to indices in this \c Array in such a way that iteration happens - /// in ascending order. - /// - /// Behaviour is undefined if: - /// - a value in \a indirection is out of bounds for this \c Array; - /// - \a indirection does not contain at least as many elements as this \c - /// Array; - /// - sorting conditions are not respected; - /// - \a start is greater than the number of elements in this \c Array or - /// \a indirection (if provided). - /// - /// \param target the smallest value to search for - /// \param start the offset at which to start searching in the array - /// \param indirection an \c Array containing valid indices of values in - /// this \c Array, sorted in ascending order - /// \return the index of the value if found, or realm::not_found otherwise - size_t find_gte(const int64_t target, size_t start, size_t end = size_t(-1)) const; - - void preset(int64_t min, int64_t max, size_t num_items); - void preset(size_t bitwidth, size_t num_items); - - int64_t sum(size_t start = 0, size_t end = size_t(-1)) const; - size_t count(int64_t value) const noexcept; - - bool maximum(int64_t& result, size_t start = 0, size_t end = size_t(-1), size_t* return_ndx = nullptr) const; - - bool minimum(int64_t& result, size_t start = 0, size_t end = size_t(-1), size_t* return_ndx = nullptr) const; - - /// This information is guaranteed to be cached in the array accessor. - bool is_inner_bptree_node() const noexcept; - - /// Returns true if type is either type_HasRefs or type_InnerColumnNode. - /// - /// This information is guaranteed to be cached in the array accessor. - bool has_refs() const noexcept; - - /// This information is guaranteed to be cached in the array accessor. - /// - /// Columns and indexes can use the context bit to differentiate leaf types. - bool get_context_flag() const noexcept; - void set_context_flag(bool) noexcept; - - ref_type get_ref() const noexcept; - MemRef get_mem() const noexcept; - - /// Destroy only the array that this accessor is attached to, not the - /// children of that array. See non-static destroy_deep() for an - /// alternative. If this accessor is already in the detached state, this - /// function has no effect (idempotency). - void destroy() noexcept; - - /// Recursively destroy children (as if calling - /// clear_and_destroy_children()), then put this accessor into the detached - /// state (as if calling detach()), then free the allocated memory. If this - /// accessor is already in the detached state, this function has no effect - /// (idempotency). - void destroy_deep() noexcept; - - /// Shorthand for `destroy(MemRef(ref, alloc), alloc)`. - static void destroy(ref_type ref, Allocator& alloc) noexcept; - - /// Destroy only the specified array node, not its children. See also - /// destroy_deep(MemRef, Allocator&). - static void destroy(MemRef, Allocator&) noexcept; - - /// Shorthand for `destroy_deep(MemRef(ref, alloc), alloc)`. - static void destroy_deep(ref_type ref, Allocator& alloc) noexcept; - - /// Destroy the specified array node and all of its children, recursively. - /// - /// This is done by freeing the specified array node after calling - /// destroy_deep() for every contained 'ref' element. - static void destroy_deep(MemRef, Allocator&) noexcept; - - Allocator& get_alloc() const noexcept - { - return m_alloc; - } - - // Serialization - - /// Returns the ref (position in the target stream) of the written copy of - /// this array, or the ref of the original array if \a only_if_modified is - /// true, and this array is unmodified (Alloc::is_read_only()). - /// - /// The number of bytes that will be written by a non-recursive invocation - /// of this function is exactly the number returned by get_byte_size(). - /// - /// \param out The destination stream (writer). - /// - /// \param deep If true, recursively write out subarrays, but still subject - /// to \a only_if_modified. - /// - /// \param only_if_modified Set to `false` to always write, or to `true` to - /// only write the array if it has been modified. - ref_type write(_impl::ArrayWriterBase& out, bool deep, bool only_if_modified) const; - - /// Same as non-static write() with `deep` set to true. This is for the - /// cases where you do not already have an array accessor available. - static ref_type write(ref_type, Allocator&, _impl::ArrayWriterBase&, bool only_if_modified); - - // Main finding function - used for find_first, find_all, sum, max, min, etc. - bool find(int cond, Action action, int64_t value, size_t start, size_t end, size_t baseindex, - QueryState* state, bool nullable_array = false, bool find_null = false) const; - - // Templated find function to avoid conversion to and from integer represenation of condition - template - bool find(Action action, int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state, - bool nullable_array = false, bool find_null = false) const - { - if (action == act_ReturnFirst) { - REALM_TEMPEX3(return find, cond, act_ReturnFirst, m_width, - (value, start, end, baseindex, state, CallbackDummy(), nullable_array, find_null)) - } - else if (action == act_Sum) { - REALM_TEMPEX3(return find, cond, act_Sum, m_width, - (value, start, end, baseindex, state, CallbackDummy(), nullable_array, find_null)) - } - else if (action == act_Min) { - REALM_TEMPEX3(return find, cond, act_Min, m_width, - (value, start, end, baseindex, state, CallbackDummy(), nullable_array, find_null)) - } - else if (action == act_Max) { - REALM_TEMPEX3(return find, cond, act_Max, m_width, - (value, start, end, baseindex, state, CallbackDummy(), nullable_array, find_null)) - } - else if (action == act_Count) { - REALM_TEMPEX3(return find, cond, act_Count, m_width, - (value, start, end, baseindex, state, CallbackDummy(), nullable_array, find_null)) - } - else if (action == act_FindAll) { - REALM_TEMPEX3(return find, cond, act_FindAll, m_width, - (value, start, end, baseindex, state, CallbackDummy(), nullable_array, find_null)) - } - else if (action == act_CallbackIdx) { - REALM_TEMPEX3(return find, cond, act_CallbackIdx, m_width, - (value, start, end, baseindex, state, CallbackDummy(), nullable_array, find_null)) - } - REALM_ASSERT_DEBUG(false); - return false; - } - - - /* - bool find(int cond, Action action, null, size_t start, size_t end, size_t baseindex, - QueryState* state) const; - */ - - template - bool find(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback, bool nullable_array = false, bool find_null = false) const; - - // This is the one installed into the m_vtable->finder slots. - template - bool find(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state) const; - - template - bool find(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback, bool nullable_array = false, bool find_null = false) const; - - /* - template - bool find(null, size_t start, size_t end, size_t baseindex, - QueryState* state, Callback callback) const; - */ - - // Optimized implementation for release mode - template - bool find_optimized(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback, bool nullable_array = false, bool find_null = false) const; - - // Called for each search result - template - bool find_action(size_t index, util::Optional value, QueryState* state, - Callback callback) const; - - template - bool find_action_pattern(size_t index, uint64_t pattern, QueryState* state, Callback callback) const; - - // Wrappers for backwards compatibility and for simple use without - // setting up state initialization etc - template - size_t find_first(int64_t value, size_t start = 0, size_t end = size_t(-1)) const; - - void find_all(IntegerColumn* result, int64_t value, size_t col_offset = 0, size_t begin = 0, - size_t end = size_t(-1)) const; - - size_t find_first(int64_t value, size_t begin = 0, size_t end = size_t(-1)) const; - - // Non-SSE find for the four functions Equal/NotEqual/Less/Greater - template - bool compare(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const; - - // Non-SSE find for Equal/NotEqual - template - inline bool compare_equality(int64_t value, size_t start, size_t end, size_t baseindex, - QueryState* state, Callback callback) const; - - // Non-SSE find for Less/Greater - template - bool compare_relation(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const; - - template - bool compare_leafs_4(const Array* foreign, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const; - - template - bool compare_leafs(const Array* foreign, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const; - - template - bool compare_leafs(const Array* foreign, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const; - - template - bool compare_leafs(const Array* foreign, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const; - -// SSE find for the four functions Equal/NotEqual/Less/Greater -#ifdef REALM_COMPILER_SSE - template - bool find_sse(int64_t value, __m128i* data, size_t items, QueryState* state, size_t baseindex, - Callback callback) const; - - template - REALM_FORCEINLINE bool find_sse_intern(__m128i* action_data, __m128i* data, size_t items, - QueryState* state, size_t baseindex, Callback callback) const; - -#endif - - template - inline bool test_zero(uint64_t value) const; // Tests value for 0-elements - - template - size_t find_zero(uint64_t v) const; // Finds position of 0/non-zero element - - template - uint64_t cascade(uint64_t a) const; // Sets lowermost bits of zero or non-zero elements - - template - int64_t - find_gtlt_magic(int64_t v) const; // Compute magic constant needed for searching for value 'v' using bit hacks - - template - inline int64_t lower_bits() const; // Return chunk with lower bit set in each element - - size_t first_set_bit(unsigned int v) const; - size_t first_set_bit64(int64_t v) const; - - template - int64_t get_universal(const char* const data, const size_t ndx) const; - - // Find value greater/less in 64-bit chunk - only works for positive values - template - bool find_gtlt_fast(uint64_t chunk, uint64_t magic, QueryState* state, size_t baseindex, - Callback callback) const; - - // Find value greater/less in 64-bit chunk - no constraints - template - bool find_gtlt(int64_t v, uint64_t chunk, QueryState* state, size_t baseindex, Callback callback) const; - - ref_type bptree_leaf_insert(size_t ndx, int64_t, TreeInsertBase& state); - - /// Get the specified element without the cost of constructing an - /// array instance. If an array instance is already available, or - /// you need to get multiple values, then this method will be - /// slower. - static int_fast64_t get(const char* header, size_t ndx) noexcept; - - /// Like get(const char*, size_t) but gets two consecutive - /// elements. - static std::pair get_two(const char* header, size_t ndx) noexcept; - - static void get_three(const char* data, size_t ndx, ref_type& v0, ref_type& v1, ref_type& v2) noexcept; - - /// The meaning of 'width' depends on the context in which this - /// array is used. - size_t get_width() const noexcept - { - return m_width; - } - - static char* get_data_from_header(char*) noexcept; - static char* get_header_from_data(char*) noexcept; - static const char* get_data_from_header(const char*) noexcept; - - enum WidthType { - wtype_Bits = 0, - wtype_Multiply = 1, - wtype_Ignore = 2, - }; - - static bool get_is_inner_bptree_node_from_header(const char*) noexcept; - static bool get_hasrefs_from_header(const char*) noexcept; - static bool get_context_flag_from_header(const char*) noexcept; - static WidthType get_wtype_from_header(const char*) noexcept; - static uint_least8_t get_width_from_header(const char*) noexcept; - static size_t get_size_from_header(const char*) noexcept; - - static Type get_type_from_header(const char*) noexcept; - - /// Get the number of bytes currently in use by this array. This - /// includes the array header, but it does not include allocated - /// bytes corresponding to excess capacity. The result is - /// guaranteed to be a multiple of 8 (i.e., 64-bit aligned). - /// - /// This number is exactly the number of bytes that will be - /// written by a non-recursive invocation of write(). - size_t get_byte_size() const noexcept; - - /// Get the maximum number of bytes that can be written by a - /// non-recursive invocation of write() on an array with the - /// specified number of elements, that is, the maximum value that - /// can be returned by get_byte_size(). - static size_t get_max_byte_size(size_t num_elems) noexcept; - - /// FIXME: Belongs in IntegerArray - static size_t calc_aligned_byte_size(size_t size, int width); - -#ifdef REALM_DEBUG - void print() const; - void verify() const; - typedef size_t (*LeafVerifier)(MemRef, Allocator&); - void verify_bptree(LeafVerifier) const; - class MemUsageHandler { - public: - virtual void handle(ref_type ref, size_t allocated, size_t used) = 0; - }; - void report_memory_usage(MemUsageHandler&) const; - void stats(MemStats& stats_dest) const; - typedef void (*LeafDumper)(MemRef, Allocator&, std::ostream&, int level); - void dump_bptree_structure(std::ostream&, int level, LeafDumper) const; - void to_dot(std::ostream&, StringData title = StringData()) const; - class ToDotHandler { - public: - virtual void to_dot(MemRef leaf_mem, ArrayParent*, size_t ndx_in_parent, std::ostream&) = 0; - ~ToDotHandler() - { - } - }; - void bptree_to_dot(std::ostream&, ToDotHandler&) const; - void to_dot_parent_edge(std::ostream&) const; -#endif - - static const int header_size = 8; // Number of bytes used by header - - // The encryption layer relies on headers always fitting within a single page. - static_assert(header_size == 8, "Header must always fit in entirely on a page"); - -private: - Array& operator=(const Array&); // not allowed -protected: - typedef bool (*CallbackDummy)(int64_t); - -protected: - // Includes array header. Not necessarily 8-byte aligned. - virtual size_t calc_byte_len(size_t num_items, size_t width) const; - - virtual size_t calc_item_count(size_t bytes, size_t width) const noexcept; - - bool get_is_inner_bptree_node_from_header() const noexcept; - bool get_hasrefs_from_header() const noexcept; - bool get_context_flag_from_header() const noexcept; - WidthType get_wtype_from_header() const noexcept; - uint_least8_t get_width_from_header() const noexcept; - size_t get_size_from_header() const noexcept; - - // Undefined behavior if m_alloc.is_read_only(m_ref) returns true - size_t get_capacity_from_header() const noexcept; - - void set_header_is_inner_bptree_node(bool value) noexcept; - void set_header_hasrefs(bool value) noexcept; - void set_header_context_flag(bool value) noexcept; - void set_header_wtype(WidthType value) noexcept; - void set_header_width(int value) noexcept; - void set_header_size(size_t value) noexcept; - void set_header_capacity(size_t value) noexcept; - - static void set_header_is_inner_bptree_node(bool value, char* header) noexcept; - static void set_header_hasrefs(bool value, char* header) noexcept; - static void set_header_context_flag(bool value, char* header) noexcept; - static void set_header_wtype(WidthType value, char* header) noexcept; - static void set_header_width(int value, char* header) noexcept; - static void set_header_size(size_t value, char* header) noexcept; - static void set_header_capacity(size_t value, char* header) noexcept; - - static void init_header(char* header, bool is_inner_bptree_node, bool has_refs, bool context_flag, - WidthType width_type, int width, size_t size, size_t capacity) noexcept; - - - // This returns the minimum value ("lower bound") of the representable values - // for the given bit width. Valid widths are 0, 1, 2, 4, 8, 16, 32, and 64. - template - static int_fast64_t lbound_for_width() noexcept; - - static int_fast64_t lbound_for_width(size_t width) noexcept; - - // This returns the maximum value ("inclusive upper bound") of the representable values - // for the given bit width. Valid widths are 0, 1, 2, 4, 8, 16, 32, and 64. - template - static int_fast64_t ubound_for_width() noexcept; - - static int_fast64_t ubound_for_width(size_t width) noexcept; - - template - void set_width() noexcept; - void set_width(size_t) noexcept; - void alloc(size_t init_size, size_t width); - void copy_on_write(); - -private: - template - int64_t sum(size_t start, size_t end) const; - - template - bool minmax(int64_t& result, size_t start, size_t end, size_t* return_ndx) const; - - template - size_t find_gte(const int64_t target, size_t start, size_t end) const; - - template - size_t adjust_ge(size_t start, size_t end, int_fast64_t limit, int_fast64_t diff); - -protected: - /// The total size in bytes (including the header) of a new empty - /// array. Must be a multiple of 8 (i.e., 64-bit aligned). - static const size_t initial_capacity = 128; - - /// It is an error to specify a non-zero value unless the width - /// type is wtype_Bits. It is also an error to specify a non-zero - /// size if the width type is wtype_Ignore. - static MemRef create(Type, bool context_flag, WidthType, size_t size, int_fast64_t value, Allocator&); - - static MemRef clone(MemRef header, Allocator& alloc, Allocator& target_alloc); - - /// Get the address of the header of this array. - char* get_header() noexcept; - - /// Same as get_byte_size(). - static size_t get_byte_size_from_header(const char*) noexcept; - - // Undefined behavior if array is in immutable memory - static size_t get_capacity_from_header(const char*) noexcept; - - // Overriding method in ArrayParent - void update_child_ref(size_t, ref_type) override; - - // Overriding method in ArrayParent - ref_type get_child_ref(size_t) const noexcept override; - - void destroy_children(size_t offset = 0) noexcept; - - std::pair get_to_dot_parent(size_t ndx_in_parent) const override; - -protected: - // Getters and Setters for adaptive-packed arrays - typedef int64_t (Array::*Getter)(size_t) const; // Note: getters must not throw - typedef void (Array::*Setter)(size_t, int64_t); - typedef bool (Array::*Finder)(int64_t, size_t, size_t, size_t, QueryState*) const; - typedef void (Array::*ChunkGetter)(size_t, int64_t res[8]) const; // Note: getters must not throw - - struct VTable { - Getter getter; - ChunkGetter chunk_getter; - Setter setter; - Finder finder[cond_VTABLE_FINDER_COUNT]; // one for each active function pointer - }; - template - struct VTableForWidth; - -protected: - /// Takes a 64-bit value and returns the minimum number of bits needed - /// to fit the value. For alignment this is rounded up to nearest - /// log2. Posssible results {0, 1, 2, 4, 8, 16, 32, 64} - static size_t bit_width(int64_t value); - -#ifdef REALM_DEBUG - void report_memory_usage_2(MemUsageHandler&) const; -#endif - -private: - Getter m_getter = nullptr; // cached to avoid indirection - const VTable* m_vtable = nullptr; - -public: - // FIXME: Should not be public - char* m_data = nullptr; // Points to first byte after header - -#if REALM_ENABLE_MEMDEBUG - // If m_no_relocation is false, then copy_on_write() will always relocate this array, regardless if it's - // required or not. If it's true, then it will never relocate, which is currently only expeted inside - // GroupWriter::write_group() due to a unique chicken/egg problem (see description there). - bool m_no_relocation = false; -#endif - -protected: - int64_t m_lbound; // min number that can be stored with current m_width - int64_t m_ubound; // max number that can be stored with current m_width - - size_t m_size = 0; // Number of elements currently stored. - size_t m_capacity = 0; // Number of elements that fit inside the allocated memory. - - Allocator& m_alloc; - -private: - size_t m_ref; - ArrayParent* m_parent = nullptr; - size_t m_ndx_in_parent = 0; // Ignored if m_parent is null. - -protected: - uint_least8_t m_width = 0; // Size of an element (meaning depend on type of array). - bool m_is_inner_bptree_node; // This array is an inner node of B+-tree. - bool m_has_refs; // Elements whose first bit is zero are refs to subarrays. - bool m_context_flag; // Meaning depends on context. - -private: - ref_type do_write_shallow(_impl::ArrayWriterBase&) const; - ref_type do_write_deep(_impl::ArrayWriterBase&, bool only_if_modified) const; - static size_t calc_byte_size(WidthType wtype, size_t size, uint_least8_t width) noexcept; - - friend class SlabAlloc; - friend class GroupWriter; - friend class StringColumn; -}; - - -// Implementation: - -class QueryStateBase { - virtual void dyncast() - { - } -}; - -template <> -class QueryState : public QueryStateBase { -public: - int64_t m_state; - size_t m_match_count; - size_t m_limit; - size_t m_minmax_index; // used only for min/max, to save index of current min/max value - - template - bool uses_val() - { - if (action == act_Max || action == act_Min || action == act_Sum) - return true; - else - return false; - } - - void init(Action action, IntegerColumn* akku, size_t limit) - { - m_match_count = 0; - m_limit = limit; - m_minmax_index = not_found; - - if (action == act_Max) - m_state = -0x7fffffffffffffffLL - 1LL; - else if (action == act_Min) - m_state = 0x7fffffffffffffffLL; - else if (action == act_ReturnFirst) - m_state = not_found; - else if (action == act_Sum) - m_state = 0; - else if (action == act_Count) - m_state = 0; - else if (action == act_FindAll) - m_state = reinterpret_cast(akku); - else if (action == act_CallbackIdx) { - } - else { - REALM_ASSERT_DEBUG(false); - } - } - - template - inline bool match(size_t index, uint64_t indexpattern, int64_t value) - { - if (pattern) { - if (action == act_Count) { - // If we are close to 'limit' argument in query, we cannot count-up a complete chunk. Count up single - // elements instead - if (m_match_count + 64 >= m_limit) - return false; - - m_state += fast_popcount64(indexpattern); - m_match_count = size_t(m_state); - return true; - } - // Other aggregates cannot (yet) use bit pattern for anything. Make Array-finder call with pattern = false - // instead - return false; - } - - ++m_match_count; - - if (action == act_Max) { - if (value > m_state) { - m_state = value; - m_minmax_index = index; - } - } - else if (action == act_Min) { - if (value < m_state) { - m_state = value; - m_minmax_index = index; - } - } - else if (action == act_Sum) - m_state += value; - else if (action == act_Count) { - m_state++; - m_match_count = size_t(m_state); - } - else if (action == act_FindAll) { - Array::add_to_column(reinterpret_cast(m_state), index); - } - else if (action == act_ReturnFirst) { - m_state = index; - return false; - } - else { - REALM_ASSERT_DEBUG(false); - } - return (m_limit > m_match_count); - } - - template - inline bool match(size_t index, uint64_t indexpattern, util::Optional value) - { - // FIXME: This is a temporary hack for nullable integers. - if (value) { - return match(index, indexpattern, *value); - } - - // If value is null, the only sensible actions are count, find_all, and return first. - // Max, min, and sum should all have no effect. - if (action == act_Count) { - m_state++; - m_match_count = size_t(m_state); - } - else if (action == act_FindAll) { - Array::add_to_column(reinterpret_cast(m_state), index); - } - else if (action == act_ReturnFirst) { - m_match_count++; - m_state = index; - return false; - } - return m_limit > m_match_count; - } -}; - -// Used only for Basic-types: currently float and double -template -class QueryState : public QueryStateBase { -public: - R m_state; - size_t m_match_count; - size_t m_limit; - size_t m_minmax_index; // used only for min/max, to save index of current min/max value - - template - bool uses_val() - { - return (action == act_Max || action == act_Min || action == act_Sum || action == act_Count); - } - - void init(Action action, Array*, size_t limit) - { - REALM_ASSERT((std::is_same::value || std::is_same::value)); - m_match_count = 0; - m_limit = limit; - m_minmax_index = not_found; - - if (action == act_Max) - m_state = -std::numeric_limits::infinity(); - else if (action == act_Min) - m_state = std::numeric_limits::infinity(); - else if (action == act_Sum) - m_state = 0.0; - else { - REALM_ASSERT_DEBUG(false); - } - } - - template - inline bool match(size_t index, uint64_t /*indexpattern*/, resulttype value) - { - if (pattern) - return false; - - static_assert(action == act_Sum || action == act_Max || action == act_Min || action == act_Count, - "Search action not supported"); - - if (action == act_Count) { - ++m_match_count; - } - else if (!null::is_null_float(value)) { - ++m_match_count; - if (action == act_Max) { - if (value > m_state) { - m_state = value; - m_minmax_index = index; - } - } - else if (action == act_Min) { - if (value < m_state) { - m_state = value; - m_minmax_index = index; - } - } - else if (action == act_Sum) - m_state += value; - else { - REALM_ASSERT_DEBUG(false); - } - } - - return (m_limit > m_match_count); - } -}; - -inline bool RefOrTagged::is_ref() const noexcept -{ - return (m_value & 1) == 0; -} - -inline bool RefOrTagged::is_tagged() const noexcept -{ - return !is_ref(); -} - -inline ref_type RefOrTagged::get_as_ref() const noexcept -{ - // to_ref() is defined in - return to_ref(m_value); -} - -inline uint_fast64_t RefOrTagged::get_as_int() const noexcept -{ - // The bitwise AND is there in case uint_fast64_t is wider than 64 bits. - return (uint_fast64_t(m_value) & 0xFFFFFFFFFFFFFFFFULL) >> 1; -} - -inline RefOrTagged RefOrTagged::make_ref(ref_type ref) noexcept -{ - // from_ref() is defined in - int_fast64_t value = from_ref(ref); - return RefOrTagged(value); -} - -inline RefOrTagged RefOrTagged::make_tagged(uint_fast64_t i) noexcept -{ - REALM_ASSERT(i < (1ULL << 63)); - int_fast64_t value = util::from_twos_compl((i << 1) | 1); - return RefOrTagged(value); -} - -inline RefOrTagged::RefOrTagged(int_fast64_t value) noexcept - : m_value(value) -{ -} - -inline Array::Array(Allocator& allocator) noexcept - : m_alloc(allocator) -{ -} - -inline void Array::create(Type type, bool context_flag, size_t length, int_fast64_t value) -{ - MemRef mem = create_array(type, context_flag, length, value, m_alloc); // Throws - init_from_mem(mem); -} - - -inline void Array::init_from_ref(ref_type ref) noexcept -{ - REALM_ASSERT_DEBUG(ref); - char* header = m_alloc.translate(ref); - init_from_mem(MemRef(header, ref, m_alloc)); -} - - -inline void Array::init_from_parent() noexcept -{ - ref_type ref = get_ref_from_parent(); - init_from_ref(ref); -} - - -inline Array::Type Array::get_type() const noexcept -{ - if (m_is_inner_bptree_node) { - REALM_ASSERT_DEBUG(m_has_refs); - return type_InnerBptreeNode; - } - if (m_has_refs) - return type_HasRefs; - return type_Normal; -} - - -inline void Array::get_chunk(size_t ndx, int64_t res[8]) const noexcept -{ - REALM_ASSERT_DEBUG(ndx < m_size); - (this->*(m_vtable->chunk_getter))(ndx, res); -} - - -inline int64_t Array::get(size_t ndx) const noexcept -{ - REALM_ASSERT_DEBUG(is_attached()); - REALM_ASSERT_DEBUG(ndx < m_size); - return (this->*m_getter)(ndx); - - // Two ideas that are not efficient but may be worth looking into again: - /* - // Assume correct width is found early in REALM_TEMPEX, which is the case for B tree offsets that - // are probably either 2^16 long. Turns out to be 25% faster if found immediately, but 50-300% slower - // if found later - REALM_TEMPEX(return get, (ndx)); - */ - /* - // Slightly slower in both of the if-cases. Also needs an matchcount m_size check too, to avoid - // reading beyond array. - if (m_width >= 8 && m_size > ndx + 7) - return get<64>(ndx >> m_shift) & m_widthmask; - else - return (this->*(m_vtable->getter))(ndx); - */ -} - -inline int64_t Array::front() const noexcept -{ - return get(0); -} - -inline int64_t Array::back() const noexcept -{ - return get(m_size - 1); -} - -inline ref_type Array::get_as_ref(size_t ndx) const noexcept -{ - REALM_ASSERT_DEBUG(is_attached()); - REALM_ASSERT_DEBUG(m_has_refs); - int64_t v = get(ndx); - return to_ref(v); -} - -inline RefOrTagged Array::get_as_ref_or_tagged(size_t ndx) const noexcept -{ - REALM_ASSERT(has_refs()); - return RefOrTagged(get(ndx)); -} - -inline void Array::set(size_t ndx, RefOrTagged ref_or_tagged) -{ - REALM_ASSERT(has_refs()); - set(ndx, ref_or_tagged.m_value); // Throws -} - -inline void Array::add(RefOrTagged ref_or_tagged) -{ - REALM_ASSERT(has_refs()); - add(ref_or_tagged.m_value); // Throws -} - -inline void Array::ensure_minimum_width(RefOrTagged ref_or_tagged) -{ - REALM_ASSERT(has_refs()); - ensure_minimum_width(ref_or_tagged.m_value); // Throws -} - -inline bool Array::is_inner_bptree_node() const noexcept -{ - return m_is_inner_bptree_node; -} - -inline bool Array::has_refs() const noexcept -{ - return m_has_refs; -} - -inline bool Array::get_context_flag() const noexcept -{ - return m_context_flag; -} - -inline void Array::set_context_flag(bool value) noexcept -{ - m_context_flag = value; - set_header_context_flag(value); -} - -inline ref_type Array::get_ref() const noexcept -{ - return m_ref; -} - -inline MemRef Array::get_mem() const noexcept -{ - return MemRef(get_header_from_data(m_data), m_ref, m_alloc); -} - -inline void Array::destroy() noexcept -{ - if (!is_attached()) - return; - char* header = get_header_from_data(m_data); - m_alloc.free_(m_ref, header); - m_data = nullptr; -} - -inline void Array::destroy_deep() noexcept -{ - if (!is_attached()) - return; - - if (m_has_refs) - destroy_children(); - - char* header = get_header_from_data(m_data); - m_alloc.free_(m_ref, header); - m_data = nullptr; -} - -inline ref_type Array::write(_impl::ArrayWriterBase& out, bool deep, bool only_if_modified) const -{ - REALM_ASSERT(is_attached()); - - if (only_if_modified && m_alloc.is_read_only(m_ref)) - return m_ref; - - if (!deep || !m_has_refs) - return do_write_shallow(out); // Throws - - return do_write_deep(out, only_if_modified); // Throws -} - -inline ref_type Array::write(ref_type ref, Allocator& alloc, _impl::ArrayWriterBase& out, bool only_if_modified) -{ - if (only_if_modified && alloc.is_read_only(ref)) - return ref; - - Array array(alloc); - array.init_from_ref(ref); - - if (!array.m_has_refs) - return array.do_write_shallow(out); // Throws - - return array.do_write_deep(out, only_if_modified); // Throws -} - -inline void Array::add(int_fast64_t value) -{ - insert(m_size, value); -} - -inline void Array::erase(size_t ndx) -{ - // This can throw, but only if array is currently in read-only - // memory. - move(ndx + 1, size(), ndx); - - // Update size (also in header) - --m_size; - set_header_size(m_size); -} - - -inline void Array::erase(size_t begin, size_t end) -{ - if (begin != end) { - // This can throw, but only if array is currently in read-only memory. - move(end, size(), begin); // Throws - - // Update size (also in header) - m_size -= end - begin; - set_header_size(m_size); - } -} - -inline void Array::clear() -{ - truncate(0); // Throws -} - -inline void Array::clear_and_destroy_children() -{ - truncate_and_destroy_children(0); -} - -inline void Array::destroy(ref_type ref, Allocator& alloc) noexcept -{ - destroy(MemRef(ref, alloc), alloc); -} - -inline void Array::destroy(MemRef mem, Allocator& alloc) noexcept -{ - alloc.free_(mem); -} - -inline void Array::destroy_deep(ref_type ref, Allocator& alloc) noexcept -{ - destroy_deep(MemRef(ref, alloc), alloc); -} - -inline void Array::destroy_deep(MemRef mem, Allocator& alloc) noexcept -{ - if (!get_hasrefs_from_header(mem.get_addr())) { - alloc.free_(mem); - return; - } - Array array(alloc); - array.init_from_mem(mem); - array.destroy_deep(); -} - - -inline void Array::adjust(size_t ndx, int_fast64_t diff) -{ - REALM_ASSERT_3(ndx, <=, m_size); - if (diff != 0) { - // FIXME: Should be optimized - int_fast64_t v = get(ndx); - set(ndx, int64_t(v + diff)); // Throws - } -} - -inline void Array::adjust(size_t begin, size_t end, int_fast64_t diff) -{ - if (diff != 0) { - // FIXME: Should be optimized - for (size_t i = begin; i != end; ++i) - adjust(i, diff); // Throws - } -} - - -//------------------------------------------------- - -inline bool Array::get_is_inner_bptree_node_from_header(const char* header) noexcept -{ - typedef unsigned char uchar; - const uchar* h = reinterpret_cast(header); - return (int(h[4]) & 0x80) != 0; -} -inline bool Array::get_hasrefs_from_header(const char* header) noexcept -{ - typedef unsigned char uchar; - const uchar* h = reinterpret_cast(header); - return (int(h[4]) & 0x40) != 0; -} -inline bool Array::get_context_flag_from_header(const char* header) noexcept -{ - typedef unsigned char uchar; - const uchar* h = reinterpret_cast(header); - return (int(h[4]) & 0x20) != 0; -} -inline Array::WidthType Array::get_wtype_from_header(const char* header) noexcept -{ - typedef unsigned char uchar; - const uchar* h = reinterpret_cast(header); - return WidthType((int(h[4]) & 0x18) >> 3); -} -inline uint_least8_t Array::get_width_from_header(const char* header) noexcept -{ - typedef unsigned char uchar; - const uchar* h = reinterpret_cast(header); - return uint_least8_t((1 << (int(h[4]) & 0x07)) >> 1); -} -inline size_t Array::get_size_from_header(const char* header) noexcept -{ - typedef unsigned char uchar; - const uchar* h = reinterpret_cast(header); - return (size_t(h[5]) << 16) + (size_t(h[6]) << 8) + h[7]; -} -inline size_t Array::get_capacity_from_header(const char* header) noexcept -{ - typedef unsigned char uchar; - const uchar* h = reinterpret_cast(header); - return (size_t(h[0]) << 16) + (size_t(h[1]) << 8) + h[2]; -} - - -inline char* Array::get_data_from_header(char* header) noexcept -{ - return header + header_size; -} -inline char* Array::get_header_from_data(char* data) noexcept -{ - return data - header_size; -} -inline const char* Array::get_data_from_header(const char* header) noexcept -{ - return get_data_from_header(const_cast(header)); -} - - -inline bool Array::get_is_inner_bptree_node_from_header() const noexcept -{ - return get_is_inner_bptree_node_from_header(get_header_from_data(m_data)); -} -inline bool Array::get_hasrefs_from_header() const noexcept -{ - return get_hasrefs_from_header(get_header_from_data(m_data)); -} -inline bool Array::get_context_flag_from_header() const noexcept -{ - return get_context_flag_from_header(get_header_from_data(m_data)); -} -inline Array::WidthType Array::get_wtype_from_header() const noexcept -{ - return get_wtype_from_header(get_header_from_data(m_data)); -} -inline uint_least8_t Array::get_width_from_header() const noexcept -{ - return get_width_from_header(get_header_from_data(m_data)); -} -inline size_t Array::get_size_from_header() const noexcept -{ - return get_size_from_header(get_header_from_data(m_data)); -} -inline size_t Array::get_capacity_from_header() const noexcept -{ - return get_capacity_from_header(get_header_from_data(m_data)); -} - - -inline void Array::set_header_is_inner_bptree_node(bool value, char* header) noexcept -{ - typedef unsigned char uchar; - uchar* h = reinterpret_cast(header); - h[4] = uchar((int(h[4]) & ~0x80) | int(value) << 7); -} - -inline void Array::set_header_hasrefs(bool value, char* header) noexcept -{ - typedef unsigned char uchar; - uchar* h = reinterpret_cast(header); - h[4] = uchar((int(h[4]) & ~0x40) | int(value) << 6); -} - -inline void Array::set_header_context_flag(bool value, char* header) noexcept -{ - typedef unsigned char uchar; - uchar* h = reinterpret_cast(header); - h[4] = uchar((int(h[4]) & ~0x20) | int(value) << 5); -} - -inline void Array::set_header_wtype(WidthType value, char* header) noexcept -{ - // Indicates how to calculate size in bytes based on width - // 0: bits (width/8) * size - // 1: multiply width * size - // 2: ignore 1 * size - typedef unsigned char uchar; - uchar* h = reinterpret_cast(header); - h[4] = uchar((int(h[4]) & ~0x18) | int(value) << 3); -} - -inline void Array::set_header_width(int value, char* header) noexcept -{ - // Pack width in 3 bits (log2) - int w = 0; - while (value) { - ++w; - value >>= 1; - } - REALM_ASSERT_3(w, <, 8); - - typedef unsigned char uchar; - uchar* h = reinterpret_cast(header); - h[4] = uchar((int(h[4]) & ~0x7) | w); -} - -inline void Array::set_header_size(size_t value, char* header) noexcept -{ - REALM_ASSERT_3(value, <=, max_array_payload); - typedef unsigned char uchar; - uchar* h = reinterpret_cast(header); - h[5] = uchar((value >> 16) & 0x000000FF); - h[6] = uchar((value >> 8) & 0x000000FF); - h[7] = uchar(value & 0x000000FF); -} - -// Note: There is a copy of this function is test_alloc.cpp -inline void Array::set_header_capacity(size_t value, char* header) noexcept -{ - REALM_ASSERT_3(value, <=, max_array_payload); - typedef unsigned char uchar; - uchar* h = reinterpret_cast(header); - h[0] = uchar((value >> 16) & 0x000000FF); - h[1] = uchar((value >> 8) & 0x000000FF); - h[2] = uchar(value & 0x000000FF); -} - - -inline void Array::set_header_is_inner_bptree_node(bool value) noexcept -{ - set_header_is_inner_bptree_node(value, get_header_from_data(m_data)); -} -inline void Array::set_header_hasrefs(bool value) noexcept -{ - set_header_hasrefs(value, get_header_from_data(m_data)); -} -inline void Array::set_header_context_flag(bool value) noexcept -{ - set_header_context_flag(value, get_header_from_data(m_data)); -} -inline void Array::set_header_wtype(WidthType value) noexcept -{ - set_header_wtype(value, get_header_from_data(m_data)); -} -inline void Array::set_header_width(int value) noexcept -{ - set_header_width(value, get_header_from_data(m_data)); -} -inline void Array::set_header_size(size_t value) noexcept -{ - set_header_size(value, get_header_from_data(m_data)); -} -inline void Array::set_header_capacity(size_t value) noexcept -{ - set_header_capacity(value, get_header_from_data(m_data)); -} - - -inline Array::Type Array::get_type_from_header(const char* header) noexcept -{ - if (get_is_inner_bptree_node_from_header(header)) - return type_InnerBptreeNode; - if (get_hasrefs_from_header(header)) - return type_HasRefs; - return type_Normal; -} - - -inline char* Array::get_header() noexcept -{ - return get_header_from_data(m_data); -} - -inline size_t Array::calc_byte_size(WidthType wtype, size_t size, uint_least8_t width) noexcept -{ - size_t num_bytes = 0; - switch (wtype) { - case wtype_Bits: { - // Current assumption is that size is at most 2^24 and that width is at most 64. - // In that case the following will never overflow. (Assuming that size_t is at least 32 bits) - REALM_ASSERT_3(size, <, 0x1000000); - size_t num_bits = size * width; - num_bytes = (num_bits + 7) >> 3; - break; - } - case wtype_Multiply: { - num_bytes = size * width; - break; - } - case wtype_Ignore: - num_bytes = size; - break; - } - - // Ensure 8-byte alignment - num_bytes = (num_bytes + 7) & ~size_t(7); - - num_bytes += header_size; - - return num_bytes; -} - -inline size_t Array::get_byte_size() const noexcept -{ - const char* header = get_header_from_data(m_data); - WidthType wtype = get_wtype_from_header(header); - size_t num_bytes = calc_byte_size(wtype, m_size, m_width); - - REALM_ASSERT_7(m_alloc.is_read_only(m_ref), ==, true, ||, num_bytes, <=, get_capacity_from_header(header)); - - return num_bytes; -} - - -inline size_t Array::get_byte_size_from_header(const char* header) noexcept -{ - size_t size = get_size_from_header(header); - uint_least8_t width = get_width_from_header(header); - WidthType wtype = get_wtype_from_header(header); - size_t num_bytes = calc_byte_size(wtype, size, width); - - return num_bytes; -} - - -inline void Array::init_header(char* header, bool is_inner_bptree_node, bool has_refs, bool context_flag, - WidthType width_type, int width, size_t size, size_t capacity) noexcept -{ - // Note: Since the header layout contains unallocated bit and/or - // bytes, it is important that we put the entire header into a - // well defined state initially. - std::fill(header, header + header_size, 0); - set_header_is_inner_bptree_node(is_inner_bptree_node, header); - set_header_hasrefs(has_refs, header); - set_header_context_flag(context_flag, header); - set_header_wtype(width_type, header); - set_header_width(width, header); - set_header_size(size, header); - set_header_capacity(capacity, header); -} - - -//------------------------------------------------- - -inline MemRef Array::clone_deep(Allocator& target_alloc) const -{ - char* header = get_header_from_data(m_data); - return clone(MemRef(header, m_ref, m_alloc), m_alloc, target_alloc); // Throws -} - -inline MemRef Array::create_empty_array(Type type, bool context_flag, Allocator& alloc) -{ - size_t size = 0; - int_fast64_t value = 0; - return create_array(type, context_flag, size, value, alloc); // Throws -} - -inline MemRef Array::create_array(Type type, bool context_flag, size_t size, int_fast64_t value, Allocator& alloc) -{ - return create(type, context_flag, wtype_Bits, size, value, alloc); // Throws -} - -inline bool Array::has_parent() const noexcept -{ - return m_parent != nullptr; -} - -inline ArrayParent* Array::get_parent() const noexcept -{ - return m_parent; -} - -inline void Array::set_parent(ArrayParent* parent, size_t ndx_in_parent) noexcept -{ - m_parent = parent; - m_ndx_in_parent = ndx_in_parent; -} - -inline size_t Array::get_ndx_in_parent() const noexcept -{ - return m_ndx_in_parent; -} - -inline void Array::set_ndx_in_parent(size_t ndx) noexcept -{ - m_ndx_in_parent = ndx; -} - -inline void Array::adjust_ndx_in_parent(int diff) noexcept -{ - // Note that `diff` is promoted to an unsigned type, and that - // C++03 still guarantees the expected result regardless of the - // sizes of `int` and `decltype(m_ndx_in_parent)`. - m_ndx_in_parent += diff; -} - -inline ref_type Array::get_ref_from_parent() const noexcept -{ - ref_type ref = m_parent->get_child_ref(m_ndx_in_parent); - return ref; -} - -inline bool Array::is_attached() const noexcept -{ - return m_data != nullptr; -} - -inline void Array::detach() noexcept -{ - m_data = nullptr; -} - -inline size_t Array::size() const noexcept -{ - REALM_ASSERT_DEBUG(is_attached()); - return m_size; -} - -inline bool Array::is_empty() const noexcept -{ - return size() == 0; -} - -inline size_t Array::get_max_byte_size(size_t num_elems) noexcept -{ - int max_bytes_per_elem = 8; - return header_size + num_elems * max_bytes_per_elem; -} - -inline void Array::update_parent() -{ - if (m_parent) - m_parent->update_child_ref(m_ndx_in_parent, m_ref); -} - - -inline void Array::update_child_ref(size_t child_ndx, ref_type new_ref) -{ - set(child_ndx, new_ref); -} - -inline ref_type Array::get_child_ref(size_t child_ndx) const noexcept -{ - return get_as_ref(child_ndx); -} - - -//************************************************************************************* -// Finding code * -//************************************************************************************* - -template -int64_t Array::get(size_t ndx) const noexcept -{ - return get_universal(m_data, ndx); -} - -template -int64_t Array::get_universal(const char* data, size_t ndx) const -{ - if (w == 0) { - return 0; - } - else if (w == 1) { - size_t offset = ndx >> 3; - return (data[offset] >> (ndx & 7)) & 0x01; - } - else if (w == 2) { - size_t offset = ndx >> 2; - return (data[offset] >> ((ndx & 3) << 1)) & 0x03; - } - else if (w == 4) { - size_t offset = ndx >> 1; - return (data[offset] >> ((ndx & 1) << 2)) & 0x0F; - } - else if (w == 8) { - return *reinterpret_cast(data + ndx); - } - else if (w == 16) { - size_t offset = ndx * 2; - return *reinterpret_cast(data + offset); - } - else if (w == 32) { - size_t offset = ndx * 4; - return *reinterpret_cast(data + offset); - } - else if (w == 64) { - size_t offset = ndx * 8; - return *reinterpret_cast(data + offset); - } - else { - REALM_ASSERT_DEBUG(false); - return int64_t(-1); - } -} - -/* -find() (calls find_optimized()) will call match() for each search result. - -If pattern == true: - 'indexpattern' contains a 64-bit chunk of elements, each of 'width' bits in size where each element indicates a - match if its lower bit is set, otherwise it indicates a non-match. 'index' tells the database row index of the - first element. You must return true if you chose to 'consume' the chunk or false if not. If not, then Array-finder - will afterwards call match() successive times with pattern == false. - -If pattern == false: - 'index' tells the row index of a single match and 'value' tells its value. Return false to make Array-finder break - its search or return true to let it continue until 'end' or 'limit'. - -Array-finder decides itself if - and when - it wants to pass you an indexpattern. It depends on array bit width, match -frequency, and whether the arithemetic and computations for the given search criteria makes it feasible to construct -such a pattern. -*/ - -// These wrapper functions only exist to enable a possibility to make the compiler see that 'value' and/or 'index' are -// unused, such that caller's computation of these values will not be made. Only works if find_action() and -// find_action_pattern() rewritten as macros. Note: This problem has been fixed in next upcoming array.hpp version -template -bool Array::find_action(size_t index, util::Optional value, QueryState* state, - Callback callback) const -{ - if (action == act_CallbackIdx) - return callback(index); - else - return state->match(index, 0, value); -} -template -bool Array::find_action_pattern(size_t index, uint64_t pattern, QueryState* state, Callback callback) const -{ - static_cast(callback); - if (action == act_CallbackIdx) { - // Possible future optimization: call callback(index) like in above find_action(), in a loop for each bit set - // in 'pattern' - return false; - } - return state->match(index, pattern, 0); -} - - -template -uint64_t Array::cascade(uint64_t a) const -{ - // Takes a chunk of values as argument and sets the least significant bit for each - // element which is zero or non-zero, depending on the template parameter. - // Example for zero=true: - // width == 4 and a = 0x5fd07a107610f610 - // will return: 0x0001000100010001 - - // static values needed for fast population count - const uint64_t m1 = 0x5555555555555555ULL; - - if (width == 1) { - return zero ? ~a : a; - } - else if (width == 2) { - // Masks to avoid spillover between segments in cascades - const uint64_t c1 = ~0ULL / 0x3 * 0x1; - - a |= (a >> 1) & c1; // cascade ones in non-zeroed segments - a &= m1; // isolate single bit in each segment - if (zero) - a ^= m1; // reverse isolated bits if checking for zeroed segments - - return a; - } - else if (width == 4) { - const uint64_t m = ~0ULL / 0xF * 0x1; - - // Masks to avoid spillover between segments in cascades - const uint64_t c1 = ~0ULL / 0xF * 0x7; - const uint64_t c2 = ~0ULL / 0xF * 0x3; - - a |= (a >> 1) & c1; // cascade ones in non-zeroed segments - a |= (a >> 2) & c2; - a &= m; // isolate single bit in each segment - if (zero) - a ^= m; // reverse isolated bits if checking for zeroed segments - - return a; - } - else if (width == 8) { - const uint64_t m = ~0ULL / 0xFF * 0x1; - - // Masks to avoid spillover between segments in cascades - const uint64_t c1 = ~0ULL / 0xFF * 0x7F; - const uint64_t c2 = ~0ULL / 0xFF * 0x3F; - const uint64_t c3 = ~0ULL / 0xFF * 0x0F; - - a |= (a >> 1) & c1; // cascade ones in non-zeroed segments - a |= (a >> 2) & c2; - a |= (a >> 4) & c3; - a &= m; // isolate single bit in each segment - if (zero) - a ^= m; // reverse isolated bits if checking for zeroed segments - - return a; - } - else if (width == 16) { - const uint64_t m = ~0ULL / 0xFFFF * 0x1; - - // Masks to avoid spillover between segments in cascades - const uint64_t c1 = ~0ULL / 0xFFFF * 0x7FFF; - const uint64_t c2 = ~0ULL / 0xFFFF * 0x3FFF; - const uint64_t c3 = ~0ULL / 0xFFFF * 0x0FFF; - const uint64_t c4 = ~0ULL / 0xFFFF * 0x00FF; - - a |= (a >> 1) & c1; // cascade ones in non-zeroed segments - a |= (a >> 2) & c2; - a |= (a >> 4) & c3; - a |= (a >> 8) & c4; - a &= m; // isolate single bit in each segment - if (zero) - a ^= m; // reverse isolated bits if checking for zeroed segments - - return a; - } - - else if (width == 32) { - const uint64_t m = ~0ULL / 0xFFFFFFFF * 0x1; - - // Masks to avoid spillover between segments in cascades - const uint64_t c1 = ~0ULL / 0xFFFFFFFF * 0x7FFFFFFF; - const uint64_t c2 = ~0ULL / 0xFFFFFFFF * 0x3FFFFFFF; - const uint64_t c3 = ~0ULL / 0xFFFFFFFF * 0x0FFFFFFF; - const uint64_t c4 = ~0ULL / 0xFFFFFFFF * 0x00FFFFFF; - const uint64_t c5 = ~0ULL / 0xFFFFFFFF * 0x0000FFFF; - - a |= (a >> 1) & c1; // cascade ones in non-zeroed segments - a |= (a >> 2) & c2; - a |= (a >> 4) & c3; - a |= (a >> 8) & c4; - a |= (a >> 16) & c5; - a &= m; // isolate single bit in each segment - if (zero) - a ^= m; // reverse isolated bits if checking for zeroed segments - - return a; - } - else if (width == 64) { - return (a == 0) == zero; - } - else { - REALM_ASSERT_DEBUG(false); - return uint64_t(-1); - } -} - -// This is the main finding function for Array. Other finding functions are just wrappers around this one. -// Search for 'value' using condition cond (Equal, NotEqual, Less, etc) and call find_action() or -// find_action_pattern() for each match. Break and return if find_action() returns false or 'end' is reached. - -// If nullable_array is set, then find_optimized() will treat the array is being nullable, i.e. it will skip the -// first entry and compare correctly against null, etc. -// -// If find_null is set, it means that we search for a null. In that case, `value` is ignored. If find_null is set, -// then nullable_array must be set too. -template -bool Array::find_optimized(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback, bool nullable_array, bool find_null) const -{ - REALM_ASSERT(!(find_null && !nullable_array)); - REALM_ASSERT_DEBUG(start <= m_size && (end <= m_size || end == size_t(-1)) && start <= end); - - size_t start2 = start; - cond c; - - if (end == npos) - end = nullable_array ? size() - 1 : size(); - - if (nullable_array) { - // We were called by find() of a nullable array. So skip first entry, take nulls in count, etc, etc. Fixme: - // Huge speed optimizations are possible here! This is a very simple generic method. - for (; start2 < end; start2++) { - int64_t v = get(start2 + 1); - if (c(v, value, v == get(0), find_null)) { - util::Optional v2(v == get(0) ? util::none : util::make_optional(v)); - if (!find_action(start2 + baseindex, v2, state, callback)) - return false; // tell caller to stop aggregating/search - } - } - return true; // tell caller to continue aggregating/search (on next array leafs) - } - - - // Test first few items with no initial time overhead - if (start2 > 0) { - if (m_size > start2 && c(get(start2), value) && start2 < end) { - if (!find_action(start2 + baseindex, get(start2), state, callback)) - return false; - } - - ++start2; - - if (m_size > start2 && c(get(start2), value) && start2 < end) { - if (!find_action(start2 + baseindex, get(start2), state, callback)) - return false; - } - - ++start2; - - if (m_size > start2 && c(get(start2), value) && start2 < end) { - if (!find_action(start2 + baseindex, get(start2), state, callback)) - return false; - } - - ++start2; - - if (m_size > start2 && c(get(start2), value) && start2 < end) { - if (!find_action(start2 + baseindex, get(start2), state, callback)) - return false; - } - - ++start2; - } - - if (!(m_size > start2 && start2 < end)) - return true; - - if (end == size_t(-1)) - end = m_size; - - // Return immediately if no items in array can match (such as if cond == Greater && value == 100 && - // m_ubound == 15) - if (!c.can_match(value, m_lbound, m_ubound)) - return true; - - // optimization if all items are guaranteed to match (such as cond == NotEqual && value == 100 && m_ubound == 15) - if (c.will_match(value, m_lbound, m_ubound)) { - size_t end2; - - if (action == act_CallbackIdx) - end2 = end; - else { - REALM_ASSERT_DEBUG(state->m_match_count < state->m_limit); - size_t process = state->m_limit - state->m_match_count; - end2 = end - start2 > process ? start2 + process : end; - } - if (action == act_Sum || action == act_Max || action == act_Min) { - int64_t res; - size_t res_ndx = 0; - if (action == act_Sum) - res = Array::sum(start2, end2); - if (action == act_Max) - Array::maximum(res, start2, end2, &res_ndx); - if (action == act_Min) - Array::minimum(res, start2, end2, &res_ndx); - - find_action(res_ndx + baseindex, res, state, callback); - // find_action will increment match count by 1, so we need to `-1` from the number of elements that - // we performed the fast Array methods on. - state->m_match_count += end2 - start2 - 1; - } - else if (action == act_Count) { - state->m_state += end2 - start2; - } - else { - for (; start2 < end2; start2++) - if (!find_action(start2 + baseindex, get(start2), state, callback)) - return false; - } - return true; - } - - // finder cannot handle this bitwidth - REALM_ASSERT_3(m_width, !=, 0); - -#if defined(REALM_COMPILER_SSE) - // Only use SSE if payload is at least one SSE chunk (128 bits) in size. Also note taht SSE doesn't support - // Less-than comparison for 64-bit values. - if ((!(std::is_same::value && m_width == 64)) && end - start2 >= sizeof(__m128i) && m_width >= 8 && - (sseavx<42>() || (sseavx<30>() && std::is_same::value && m_width < 64))) { - - // find_sse() must start2 at 16-byte boundary, so search area before that using compare_equality() - __m128i* const a = reinterpret_cast<__m128i*>(round_up(m_data + start2 * bitwidth / 8, sizeof(__m128i))); - __m128i* const b = reinterpret_cast<__m128i*>(round_down(m_data + end * bitwidth / 8, sizeof(__m128i))); - - if (!compare( - value, start2, (reinterpret_cast(a) - m_data) * 8 / no0(bitwidth), baseindex, state, callback)) - return false; - - // Search aligned area with SSE - if (b > a) { - if (sseavx<42>()) { - if (!find_sse( - value, a, b - a, state, - baseindex + ((reinterpret_cast(a) - m_data) * 8 / no0(bitwidth)), callback)) - return false; - } - else if (sseavx<30>()) { - - if (!find_sse( - value, a, b - a, state, - baseindex + ((reinterpret_cast(a) - m_data) * 8 / no0(bitwidth)), callback)) - return false; - } - } - - // Search remainder with compare_equality() - if (!compare( - value, (reinterpret_cast(b) - m_data) * 8 / no0(bitwidth), end, baseindex, state, callback)) - return false; - - return true; - } - else { - return compare(value, start2, end, baseindex, state, callback); - } -#else - return compare(value, start2, end, baseindex, state, callback); -#endif -} - -template -inline int64_t Array::lower_bits() const -{ - if (width == 1) - return 0xFFFFFFFFFFFFFFFFULL; - else if (width == 2) - return 0x5555555555555555ULL; - else if (width == 4) - return 0x1111111111111111ULL; - else if (width == 8) - return 0x0101010101010101ULL; - else if (width == 16) - return 0x0001000100010001ULL; - else if (width == 32) - return 0x0000000100000001ULL; - else if (width == 64) - return 0x0000000000000001ULL; - else { - REALM_ASSERT_DEBUG(false); - return int64_t(-1); - } -} - -// Tests if any chunk in 'value' is 0 -template -inline bool Array::test_zero(uint64_t value) const -{ - uint64_t hasZeroByte; - uint64_t lower = lower_bits(); - uint64_t upper = lower_bits() * 1ULL << (width == 0 ? 0 : (width - 1ULL)); - hasZeroByte = (value - lower) & ~value & upper; - return hasZeroByte != 0; -} - -// Finds first zero (if eq == true) or non-zero (if eq == false) element in v and returns its position. -// IMPORTANT: This function assumes that at least 1 item matches (test this with test_zero() or other means first)! -template -size_t Array::find_zero(uint64_t v) const -{ - size_t start = 0; - uint64_t hasZeroByte; - // Warning free way of computing (1ULL << width) - 1 - uint64_t mask = (width == 64 ? ~0ULL : ((1ULL << (width == 64 ? 0 : width)) - 1ULL)); - - if (eq == (((v >> (width * start)) & mask) == 0)) { - return 0; - } - - // Bisection optimization, speeds up small bitwidths with high match frequency. More partions than 2 do NOT pay - // off because the work done by test_zero() is wasted for the cases where the value exists in first half, but - // useful if it exists in last half. Sweet spot turns out to be the widths and partitions below. - if (width <= 8) { - hasZeroByte = test_zero(v | 0xffffffff00000000ULL); - if (eq ? !hasZeroByte : (v & 0x00000000ffffffffULL) == 0) { - // 00?? -> increasing - start += 64 / no0(width) / 2; - if (width <= 4) { - hasZeroByte = test_zero(v | 0xffff000000000000ULL); - if (eq ? !hasZeroByte : (v & 0x0000ffffffffffffULL) == 0) { - // 000? - start += 64 / no0(width) / 4; - } - } - } - else { - if (width <= 4) { - // ??00 - hasZeroByte = test_zero(v | 0xffffffffffff0000ULL); - if (eq ? !hasZeroByte : (v & 0x000000000000ffffULL) == 0) { - // 0?00 - start += 64 / no0(width) / 4; - } - } - } - } - - while (eq == (((v >> (width * start)) & mask) != 0)) { - // You must only call find_zero() if you are sure that at least 1 item matches - REALM_ASSERT_3(start, <=, 8 * sizeof(v)); - start++; - } - - return start; -} - -// Generate a magic constant used for later bithacks -template -int64_t Array::find_gtlt_magic(int64_t v) const -{ - uint64_t mask1 = (width == 64 ? ~0ULL : ((1ULL << (width == 64 ? 0 : width)) - - 1ULL)); // Warning free way of computing (1ULL << width) - 1 - uint64_t mask2 = mask1 >> 1; - uint64_t magic = gt ? (~0ULL / no0(mask1) * (mask2 - v)) : (~0ULL / no0(mask1) * v); - return magic; -} - -template -bool Array::find_gtlt_fast(uint64_t chunk, uint64_t magic, QueryState* state, size_t baseindex, - Callback callback) const -{ - // Tests if a a chunk of values contains values that are greater (if gt == true) or less (if gt == false) than v. - // Fast, but limited to work when all values in the chunk are positive. - - uint64_t mask1 = (width == 64 ? ~0ULL : ((1ULL << (width == 64 ? 0 : width)) - - 1ULL)); // Warning free way of computing (1ULL << width) - 1 - uint64_t mask2 = mask1 >> 1; - uint64_t m = gt ? (((chunk + magic) | chunk) & ~0ULL / no0(mask1) * (mask2 + 1)) - : ((chunk - magic) & ~chunk & ~0ULL / no0(mask1) * (mask2 + 1)); - size_t p = 0; - while (m) { - if (find_action_pattern(baseindex, m >> (no0(width) - 1), state, callback)) - break; // consumed, so do not call find_action() - - size_t t = first_set_bit64(m) / no0(width); - p += t; - if (!find_action(p + baseindex, (chunk >> (p * width)) & mask1, state, callback)) - return false; - - if ((t + 1) * width == 64) - m = 0; - else - m >>= (t + 1) * width; - p++; - } - - return true; -} - -// clang-format off -template -bool Array::find_gtlt(int64_t v, uint64_t chunk, QueryState* state, size_t baseindex, Callback callback) const -{ - // Find items in 'chunk' that are greater (if gt == true) or smaller (if gt == false) than 'v'. Fixme, __forceinline can make it crash in vS2010 - find out why - if (width == 1) { - for (size_t t = 0; t < 64; t++) { - if (gt ? static_cast(chunk & 0x1) > v : static_cast(chunk & 0x1) < v) {if (!find_action( t + baseindex, static_cast(chunk & 0x1), state, callback)) return false;} - chunk >>= 1; - } - } - else if (width == 2) { - // Alot (50% +) faster than loop/compiler-unrolled loop - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 0 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 1 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 2 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 3 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 4 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 5 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 6 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 7 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 8 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 9 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 10 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 11 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 12 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 13 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 14 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 15 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 16 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 17 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 18 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 19 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 20 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 21 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 22 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 23 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 24 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 25 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 26 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 27 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 28 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 29 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 30 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - if (gt ? static_cast(chunk & 0x3) > v : static_cast(chunk & 0x3) < v) {if (!find_action( 31 + baseindex, static_cast(chunk & 0x3), state, callback)) return false;} - chunk >>= 2; - } - else if (width == 4) { - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 0 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 1 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 2 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 3 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 4 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 5 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 6 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 7 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 8 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 9 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 10 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 11 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 12 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 13 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 14 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - if (gt ? static_cast(chunk & 0xf) > v : static_cast(chunk & 0xf) < v) {if (!find_action( 15 + baseindex, static_cast(chunk & 0xf), state, callback)) return false;} - chunk >>= 4; - } - else if (width == 8) { - if (gt ? static_cast(chunk) > v : static_cast(chunk) < v) {if (!find_action( 0 + baseindex, static_cast(chunk), state, callback)) return false;} - chunk >>= 8; - if (gt ? static_cast(chunk) > v : static_cast(chunk) < v) {if (!find_action( 1 + baseindex, static_cast(chunk), state, callback)) return false;} - chunk >>= 8; - if (gt ? static_cast(chunk) > v : static_cast(chunk) < v) {if (!find_action( 2 + baseindex, static_cast(chunk), state, callback)) return false;} - chunk >>= 8; - if (gt ? static_cast(chunk) > v : static_cast(chunk) < v) {if (!find_action( 3 + baseindex, static_cast(chunk), state, callback)) return false;} - chunk >>= 8; - if (gt ? static_cast(chunk) > v : static_cast(chunk) < v) {if (!find_action( 4 + baseindex, static_cast(chunk), state, callback)) return false;} - chunk >>= 8; - if (gt ? static_cast(chunk) > v : static_cast(chunk) < v) {if (!find_action( 5 + baseindex, static_cast(chunk), state, callback)) return false;} - chunk >>= 8; - if (gt ? static_cast(chunk) > v : static_cast(chunk) < v) {if (!find_action( 6 + baseindex, static_cast(chunk), state, callback)) return false;} - chunk >>= 8; - if (gt ? static_cast(chunk) > v : static_cast(chunk) < v) {if (!find_action( 7 + baseindex, static_cast(chunk), state, callback)) return false;} - chunk >>= 8; - } - else if (width == 16) { - - if (gt ? static_cast(chunk >> 0 * 16) > v : static_cast(chunk >> 0 * 16) < v) {if (!find_action( 0 + baseindex, static_cast(chunk >> 0 * 16), state, callback)) return false;}; - if (gt ? static_cast(chunk >> 1 * 16) > v : static_cast(chunk >> 1 * 16) < v) {if (!find_action( 1 + baseindex, static_cast(chunk >> 1 * 16), state, callback)) return false;}; - if (gt ? static_cast(chunk >> 2 * 16) > v : static_cast(chunk >> 2 * 16) < v) {if (!find_action( 2 + baseindex, static_cast(chunk >> 2 * 16), state, callback)) return false;}; - if (gt ? static_cast(chunk >> 3 * 16) > v : static_cast(chunk >> 3 * 16) < v) {if (!find_action( 3 + baseindex, static_cast(chunk >> 3 * 16), state, callback)) return false;}; - } - else if (width == 32) { - if (gt ? static_cast(chunk) > v : static_cast(chunk) < v) {if (!find_action( 0 + baseindex, static_cast(chunk), state, callback)) return false;} - chunk >>= 32; - if (gt ? static_cast(chunk) > v : static_cast(chunk) < v) {if (!find_action( 1 + baseindex, static_cast(chunk), state, callback)) return false;} - chunk >>= 32; - } - else if (width == 64) { - if (gt ? static_cast(v) > v : static_cast(v) < v) {if (!find_action( 0 + baseindex, static_cast(v), state, callback)) return false;}; - } - - return true; -} -// clang-format on - -/// Find items in this Array that are equal (eq == true) or different (eq = false) from 'value' -template -inline bool Array::compare_equality(int64_t value, size_t start, size_t end, size_t baseindex, - QueryState* state, Callback callback) const -{ - REALM_ASSERT_DEBUG(start <= m_size && (end <= m_size || end == size_t(-1)) && start <= end); - - size_t ee = round_up(start, 64 / no0(width)); - ee = ee > end ? end : ee; - for (; start < ee; ++start) - if (eq ? (get(start) == value) : (get(start) != value)) { - if (!find_action(start + baseindex, get(start), state, callback)) - return false; - } - - if (start >= end) - return true; - - if (width != 32 && width != 64) { - const int64_t* p = reinterpret_cast(m_data + (start * width / 8)); - const int64_t* const e = reinterpret_cast(m_data + (end * width / 8)) - 1; - const uint64_t mask = (width == 64 ? ~0ULL : ((1ULL << (width == 64 ? 0 : width)) - - 1ULL)); // Warning free way of computing (1ULL << width) - 1 - const uint64_t valuemask = - ~0ULL / no0(mask) * (value & mask); // the "== ? :" is to avoid division by 0 compiler error - - while (p < e) { - uint64_t chunk = *p; - uint64_t v2 = chunk ^ valuemask; - start = (p - reinterpret_cast(m_data)) * 8 * 8 / no0(width); - size_t a = 0; - - while (eq ? test_zero(v2) : v2) { - - if (find_action_pattern(start + baseindex, cascade(v2), state, callback)) - break; // consumed - - size_t t = find_zero(v2); - a += t; - - if (a >= 64 / no0(width)) - break; - - if (!find_action(a + start + baseindex, get(start + t), state, callback)) - return false; - v2 >>= (t + 1) * width; - a += 1; - } - - ++p; - } - - // Loop ended because we are near end or end of array. No need to optimize search in remainder in this case - // because end of array means that - // lots of search work has taken place prior to ending here. So time spent searching remainder is relatively - // tiny - start = (p - reinterpret_cast(m_data)) * 8 * 8 / no0(width); - } - - while (start < end) { - if (eq ? get(start) == value : get(start) != value) { - if (!find_action(start + baseindex, get(start), state, callback)) - return false; - } - ++start; - } - - return true; -} - -// There exists a couple of find() functions that take more or less template arguments. Always call the one that -// takes as most as possible to get best performance. - -// This is the one installed into the m_vtable->finder slots. -template -bool Array::find(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state) const -{ - return find(value, start, end, baseindex, state, CallbackDummy()); -} - -template -bool Array::find(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback, bool nullable_array, bool find_null) const -{ - REALM_TEMPEX4(return find, cond, action, m_width, Callback, - (value, start, end, baseindex, state, callback, nullable_array, find_null)); -} - -template -bool Array::find(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback, bool nullable_array, bool find_null) const -{ - return find_optimized(value, start, end, baseindex, state, callback, - nullable_array, find_null); -} - -#ifdef REALM_COMPILER_SSE -// 'items' is the number of 16-byte SSE chunks. Returns index of packed element relative to first integer of first -// chunk -template -bool Array::find_sse(int64_t value, __m128i* data, size_t items, QueryState* state, size_t baseindex, - Callback callback) const -{ - __m128i search = {0}; - - if (width == 8) - search = _mm_set1_epi8(static_cast(value)); - else if (width == 16) - search = _mm_set1_epi16(static_cast(value)); - else if (width == 32) - search = _mm_set1_epi32(static_cast(value)); - else if (width == 64) { - if (std::is_same::value) - REALM_ASSERT(false); - else - search = _mm_set_epi64x(value, value); - } - - return find_sse_intern(data, &search, items, state, baseindex, callback); -} - -// Compares packed action_data with packed data (equal, less, etc) and performs aggregate action (max, min, sum, -// find_all, etc) on value inside action_data for first match, if any -template -REALM_FORCEINLINE bool Array::find_sse_intern(__m128i* action_data, __m128i* data, size_t items, - QueryState* state, size_t baseindex, Callback callback) const -{ - size_t i = 0; - __m128i compare_result = {0}; - unsigned int resmask; - - // Search loop. Unrolling it has been tested to NOT increase performance (apparently mem bound) - for (i = 0; i < items; ++i) { - // equal / not-equal - if (std::is_same::value || std::is_same::value) { - if (width == 8) - compare_result = _mm_cmpeq_epi8(action_data[i], *data); - if (width == 16) - compare_result = _mm_cmpeq_epi16(action_data[i], *data); - if (width == 32) - compare_result = _mm_cmpeq_epi32(action_data[i], *data); - if (width == 64) { - compare_result = _mm_cmpeq_epi64(action_data[i], *data); // SSE 4.2 only - } - } - - // greater - else if (std::is_same::value) { - if (width == 8) - compare_result = _mm_cmpgt_epi8(action_data[i], *data); - if (width == 16) - compare_result = _mm_cmpgt_epi16(action_data[i], *data); - if (width == 32) - compare_result = _mm_cmpgt_epi32(action_data[i], *data); - if (width == 64) - compare_result = _mm_cmpgt_epi64(action_data[i], *data); - } - // less - else if (std::is_same::value) { - if (width == 8) - compare_result = _mm_cmplt_epi8(action_data[i], *data); - else if (width == 16) - compare_result = _mm_cmplt_epi16(action_data[i], *data); - else if (width == 32) - compare_result = _mm_cmplt_epi32(action_data[i], *data); - else - REALM_ASSERT(false); - } - - resmask = _mm_movemask_epi8(compare_result); - - if (std::is_same::value) - resmask = ~resmask & 0x0000ffff; - - size_t s = i * sizeof(__m128i) * 8 / no0(width); - - while (resmask != 0) { - - uint64_t upper = lower_bits() << (no0(width / 8) - 1); - uint64_t pattern = - resmask & - upper; // fixme, bits at wrong offsets. Only OK because we only use them in 'count' aggregate - if (find_action_pattern(s + baseindex, pattern, state, callback)) - break; - - size_t idx = first_set_bit(resmask) * 8 / no0(width); - s += idx; - if (!find_action( - s + baseindex, get_universal(reinterpret_cast(action_data), s), state, callback)) - return false; - resmask >>= (idx + 1) * no0(width) / 8; - ++s; - } - } - - return true; -} -#endif // REALM_COMPILER_SSE - -template -bool Array::compare_leafs(const Array* foreign, size_t start, size_t end, size_t baseindex, - QueryState* state, Callback callback) const -{ - cond c; - REALM_ASSERT_3(start, <=, end); - if (start == end) - return true; - - - int64_t v; - - // We can compare first element without checking for out-of-range - v = get(start); - if (c(v, foreign->get(start))) { - if (!find_action(start + baseindex, v, state, callback)) - return false; - } - - start++; - - if (start + 3 < end) { - v = get(start); - if (c(v, foreign->get(start))) - if (!find_action(start + baseindex, v, state, callback)) - return false; - - v = get(start + 1); - if (c(v, foreign->get(start + 1))) - if (!find_action(start + 1 + baseindex, v, state, callback)) - return false; - - v = get(start + 2); - if (c(v, foreign->get(start + 2))) - if (!find_action(start + 2 + baseindex, v, state, callback)) - return false; - - start += 3; - } - else if (start == end) { - return true; - } - - bool r; - REALM_TEMPEX4(r = compare_leafs, cond, action, m_width, Callback, - (foreign, start, end, baseindex, state, callback)) - return r; -} - - -template -bool Array::compare_leafs(const Array* foreign, size_t start, size_t end, size_t baseindex, - QueryState* state, Callback callback) const -{ - size_t fw = foreign->m_width; - bool r; - REALM_TEMPEX5(r = compare_leafs_4, cond, action, width, Callback, fw, - (foreign, start, end, baseindex, state, callback)) - return r; -} - - -template -bool Array::compare_leafs_4(const Array* foreign, size_t start, size_t end, size_t baseindex, - QueryState* state, Callback callback) const -{ - cond c; - char* foreign_m_data = foreign->m_data; - - if (width == 0 && foreign_width == 0) { - if (c(0, 0)) { - while (start < end) { - if (!find_action(start + baseindex, 0, state, callback)) - return false; - start++; - } - } - else { - return true; - } - } - - -#if defined(REALM_COMPILER_SSE) - if (sseavx<42>() && width == foreign_width && (width == 8 || width == 16 || width == 32)) { - // We can only use SSE if both bitwidths are equal and above 8 bits and all values are signed - while (start < end && (((reinterpret_cast(m_data) & 0xf) * 8 + start * width) % (128) != 0)) { - int64_t v = get_universal(m_data, start); - int64_t fv = get_universal(foreign_m_data, start); - if (c(v, fv)) { - if (!find_action(start + baseindex, v, state, callback)) - return false; - } - start++; - } - if (start == end) - return true; - - - size_t sse_items = (end - start) * width / 128; - size_t sse_end = start + sse_items * 128 / no0(width); - - while (start < sse_end) { - __m128i* a = reinterpret_cast<__m128i*>(m_data + start * width / 8); - __m128i* b = reinterpret_cast<__m128i*>(foreign_m_data + start * width / 8); - - bool continue_search = - find_sse_intern(a, b, 1, state, baseindex + start, callback); - - if (!continue_search) - return false; - - start += 128 / no0(width); - } - } -#endif - - while (start < end) { - int64_t v = get_universal(m_data, start); - int64_t fv = get_universal(foreign_m_data, start); - - if (c(v, fv)) { - if (!find_action(start + baseindex, v, state, callback)) - return false; - } - - start++; - } - - return true; -} - - -template -bool Array::compare(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const -{ - bool ret = false; - - if (std::is_same::value) - ret = compare_equality(value, start, end, baseindex, state, callback); - else if (std::is_same::value) - ret = compare_equality(value, start, end, baseindex, state, callback); - else if (std::is_same::value) - ret = compare_relation(value, start, end, baseindex, state, callback); - else if (std::is_same::value) - ret = compare_relation(value, start, end, baseindex, state, callback); - else - REALM_ASSERT_DEBUG(false); - - return ret; -} - -template -bool Array::compare_relation(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const -{ - REALM_ASSERT(start <= m_size && (end <= m_size || end == size_t(-1)) && start <= end); - uint64_t mask = (bitwidth == 64 ? ~0ULL : ((1ULL << (bitwidth == 64 ? 0 : bitwidth)) - - 1ULL)); // Warning free way of computing (1ULL << width) - 1 - - size_t ee = round_up(start, 64 / no0(bitwidth)); - ee = ee > end ? end : ee; - for (; start < ee; start++) { - if (gt ? (get(start) > value) : (get(start) < value)) { - if (!find_action(start + baseindex, get(start), state, callback)) - return false; - } - } - - if (start >= end) - return true; // none found, continue (return true) regardless what find_action() would have returned on match - - const int64_t* p = reinterpret_cast(m_data + (start * bitwidth / 8)); - const int64_t* const e = reinterpret_cast(m_data + (end * bitwidth / 8)) - 1; - - // Matches are rare enough to setup fast linear search for remaining items. We use - // bit hacks from http://graphics.stanford.edu/~seander/bithacks.html#HasLessInWord - - if (bitwidth == 1 || bitwidth == 2 || bitwidth == 4 || bitwidth == 8 || bitwidth == 16) { - uint64_t magic = find_gtlt_magic(value); - - // Bit hacks only work if searched item has its most significant bit clear for 'greater than' or - // 'item <= 1 << bitwidth' for 'less than' - if (value != int64_t((magic & mask)) && value >= 0 && bitwidth >= 2 && - value <= static_cast((mask >> 1) - (gt ? 1 : 0))) { - // 15 ms - while (p < e) { - uint64_t upper = lower_bits() << (no0(bitwidth) - 1); - - const int64_t v = *p; - size_t idx; - - // Bit hacks only works if all items in chunk have their most significant bit clear. Test this: - upper = upper & v; - - if (!upper) { - idx = find_gtlt_fast( - v, magic, state, (p - reinterpret_cast(m_data)) * 8 * 8 / no0(bitwidth) + baseindex, - callback); - } - else - idx = find_gtlt( - value, v, state, (p - reinterpret_cast(m_data)) * 8 * 8 / no0(bitwidth) + baseindex, - callback); - - if (!idx) - return false; - ++p; - } - } - else { - // 24 ms - while (p < e) { - int64_t v = *p; - if (!find_gtlt( - value, v, state, (p - reinterpret_cast(m_data)) * 8 * 8 / no0(bitwidth) + baseindex, - callback)) - return false; - ++p; - } - } - start = (p - reinterpret_cast(m_data)) * 8 * 8 / no0(bitwidth); - } - - // matchcount logic in SIMD no longer pays off for 32/64 bit ints because we have just 4/2 elements - - // Test unaligned end and/or values of width > 16 manually - while (start < end) { - if (gt ? get(start) > value : get(start) < value) { - if (!find_action(start + baseindex, get(start), state, callback)) - return false; - } - ++start; - } - return true; -} - -template -size_t Array::find_first(int64_t value, size_t start, size_t end) const -{ - REALM_ASSERT(start <= m_size && (end <= m_size || end == size_t(-1)) && start <= end); - QueryState state; - state.init(act_ReturnFirst, nullptr, - 1); // todo, would be nice to avoid this in order to speed up find_first loops - Finder finder = m_vtable->finder[cond::condition]; - (this->*finder)(value, start, end, 0, &state); - - return static_cast(state.m_state); -} - -//************************************************************************************* -// Finding code ends * -//************************************************************************************* - - -} // namespace realm - -#endif // REALM_ARRAY_HPP diff --git a/Pods/Realm/include/core/realm/array_basic.hpp b/Pods/Realm/include/core/realm/array_basic.hpp deleted file mode 100644 index 317f11ff..00000000 --- a/Pods/Realm/include/core/realm/array_basic.hpp +++ /dev/null @@ -1,116 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ARRAY_BASIC_HPP -#define REALM_ARRAY_BASIC_HPP - -#include - -namespace realm { - -/// A BasicArray can currently only be used for simple unstructured -/// types like float, double. -template -class BasicArray : public Array { -public: - explicit BasicArray(Allocator&) noexcept; - ~BasicArray() noexcept override - { - } - - T get(size_t ndx) const noexcept; - bool is_null(size_t ndx) const noexcept; - void add(T value); - void set(size_t ndx, T value); - void set_null(size_t ndx); - void insert(size_t ndx, T value); - void erase(size_t ndx); - void truncate(size_t size); - void clear(); - - size_t find_first(T value, size_t begin = 0, size_t end = npos) const; - void find_all(IntegerColumn* result, T value, size_t add_offset = 0, size_t begin = 0, size_t end = npos) const; - - size_t count(T value, size_t begin = 0, size_t end = npos) const; - bool maximum(T& result, size_t begin = 0, size_t end = npos) const; - bool minimum(T& result, size_t begin = 0, size_t end = npos) const; - - /// Compare two arrays for equality. - bool compare(const BasicArray&) const; - - /// Get the specified element without the cost of constructing an - /// array instance. If an array instance is already available, or - /// you need to get multiple values, then this method will be - /// slower. - static T get(const char* header, size_t ndx) noexcept; - - ref_type bptree_leaf_insert(size_t ndx, T, TreeInsertBase& state); - - size_t lower_bound(T value) const noexcept; - size_t upper_bound(T value) const noexcept; - - /// Construct a basic array of the specified size and return just - /// the reference to the underlying memory. All elements will be - /// initialized to `T()`. - static MemRef create_array(size_t size, Allocator&); - - static MemRef create_array(Array::Type leaf_type, bool context_flag, size_t size, T value, Allocator&); - - /// Create a new empty array and attach this accessor to it. This - /// does not modify the parent reference information of this - /// accessor. - /// - /// Note that the caller assumes ownership of the allocated - /// underlying node. It is not owned by the accessor. - void create(Array::Type = type_Normal, bool context_flag = false); - - /// Construct a copy of the specified slice of this basic array - /// using the specified target allocator. - MemRef slice(size_t offset, size_t size, Allocator& target_alloc) const; - MemRef slice_and_clone_children(size_t offset, size_t size, Allocator& target_alloc) const; - -#ifdef REALM_DEBUG - void to_dot(std::ostream&, StringData title = StringData()) const; -#endif - -private: - size_t find(T target, size_t begin, size_t end) const; - - size_t calc_byte_len(size_t count, size_t width) const override; - virtual size_t calc_item_count(size_t bytes, size_t width) const noexcept override; - - template - bool minmax(T& result, size_t begin, size_t end) const; - - /// Calculate the total number of bytes needed for a basic array - /// with the specified number of elements. This includes the size - /// of the header. The result will be upwards aligned to the - /// closest 8-byte boundary. - static size_t calc_aligned_byte_size(size_t size); -}; - - -// Class typedefs for BasicArray's: ArrayFloat and ArrayDouble -typedef BasicArray ArrayFloat; -typedef BasicArray ArrayDouble; - -} // namespace realm - -#include - -#endif // REALM_ARRAY_BASIC_HPP diff --git a/Pods/Realm/include/core/realm/array_basic_tpl.hpp b/Pods/Realm/include/core/realm/array_basic_tpl.hpp deleted file mode 100644 index 4147713a..00000000 --- a/Pods/Realm/include/core/realm/array_basic_tpl.hpp +++ /dev/null @@ -1,457 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ARRAY_BASIC_TPL_HPP -#define REALM_ARRAY_BASIC_TPL_HPP - -#include -#include -#include -#include - -#include - -namespace realm { - -template -inline BasicArray::BasicArray(Allocator& allocator) noexcept - : Array(allocator) -{ -} - -template -inline MemRef BasicArray::create_array(size_t init_size, Allocator& allocator) -{ - size_t byte_size_0 = calc_aligned_byte_size(init_size); // Throws - // Adding zero to Array::initial_capacity to avoid taking the - // address of that member - size_t byte_size = std::max(byte_size_0, Array::initial_capacity + 0); // Throws - - MemRef mem = allocator.alloc(byte_size); // Throws - - bool is_inner_bptree_node = false; - bool has_refs = false; - bool context_flag = false; - int width = sizeof(T); - init_header(mem.get_addr(), is_inner_bptree_node, has_refs, context_flag, wtype_Multiply, width, init_size, - byte_size); - - return mem; -} - - -template -inline MemRef BasicArray::create_array(Array::Type type, bool context_flag, size_t init_size, T value, - Allocator& allocator) -{ - REALM_ASSERT(type == Array::type_Normal); - REALM_ASSERT(!context_flag); - MemRef mem = create_array(init_size, allocator); - if (init_size) { - BasicArray tmp(allocator); - tmp.init_from_mem(mem); - for (size_t i = 0; i < init_size; ++i) { - tmp.set(i, value); - } - return tmp.get_mem(); - } - return mem; -} - - -template -inline void BasicArray::create(Array::Type type, bool context_flag) -{ - REALM_ASSERT(type == Array::type_Normal); - REALM_ASSERT(!context_flag); - size_t length = 0; - MemRef mem = create_array(length, get_alloc()); // Throws - init_from_mem(mem); -} - - -template -MemRef BasicArray::slice(size_t offset, size_t slice_size, Allocator& target_alloc) const -{ - REALM_ASSERT(is_attached()); - - // FIXME: This can be optimized as a single contiguous copy - // operation. - BasicArray array_slice(target_alloc); - _impl::ShallowArrayDestroyGuard dg(&array_slice); - array_slice.create(); // Throws - size_t begin = offset; - size_t end = offset + slice_size; - for (size_t i = begin; i != end; ++i) { - T value = get(i); - array_slice.add(value); // Throws - } - dg.release(); - return array_slice.get_mem(); -} - -template -MemRef BasicArray::slice_and_clone_children(size_t offset, size_t slice_size, Allocator& target_alloc) const -{ - // BasicArray never contains refs, so never has children. - return slice(offset, slice_size, target_alloc); -} - - -template -inline void BasicArray::add(T value) -{ - insert(m_size, value); -} - - -template -inline T BasicArray::get(size_t ndx) const noexcept -{ - return *(reinterpret_cast(m_data) + ndx); -} - - -template -inline bool BasicArray::is_null(size_t ndx) const noexcept -{ - // FIXME: This assumes BasicArray will only ever be instantiated for float-like T. - static_assert(realm::is_any::value, "T can only be float or double"); - auto x = get(ndx); - return null::is_null_float(x); -} - - -template -inline T BasicArray::get(const char* header, size_t ndx) noexcept -{ - const char* data = get_data_from_header(header); - // This casting assumes that T can be aliged on an 8-bype - // boundary (since data is aligned on an 8-byte boundary.) - return *(reinterpret_cast(data) + ndx); -} - - -template -inline void BasicArray::set(size_t ndx, T value) -{ - REALM_ASSERT_3(ndx, <, m_size); - - // Check if we need to copy before modifying - copy_on_write(); // Throws - - // Set the value - T* data = reinterpret_cast(m_data) + ndx; - *data = value; -} - -template -inline void BasicArray::set_null(size_t ndx) -{ - // FIXME: This assumes BasicArray will only ever be instantiated for float-like T. - set(ndx, null::get_null_float()); -} - -template -void BasicArray::insert(size_t ndx, T value) -{ - REALM_ASSERT_3(ndx, <=, m_size); - - // Check if we need to copy before modifying - copy_on_write(); // Throws - - // Make room for the new value - alloc(m_size + 1, m_width); // Throws - - // Move values below insertion - if (ndx != m_size) { - char* src_begin = m_data + ndx * m_width; - char* src_end = m_data + m_size * m_width; - char* dst_end = src_end + m_width; - std::copy_backward(src_begin, src_end, dst_end); - } - - // Set the value - T* data = reinterpret_cast(m_data) + ndx; - *data = value; - - ++m_size; -} - -template -void BasicArray::erase(size_t ndx) -{ - REALM_ASSERT_3(ndx, <, m_size); - - // Check if we need to copy before modifying - copy_on_write(); // Throws - - // move data under deletion up - if (ndx < m_size - 1) { - char* dst_begin = m_data + ndx * m_width; - const char* src_begin = dst_begin + m_width; - const char* src_end = m_data + m_size * m_width; - std::copy_n(src_begin, src_end - src_begin, dst_begin); - } - - // Update size (also in header) - --m_size; - set_header_size(m_size); -} - -template -void BasicArray::truncate(size_t to_size) -{ - REALM_ASSERT(is_attached()); - REALM_ASSERT_3(to_size, <=, m_size); - - copy_on_write(); // Throws - - // Update size in accessor and in header. This leaves the capacity - // unchanged. - m_size = to_size; - set_header_size(to_size); -} - -template -inline void BasicArray::clear() -{ - truncate(0); // Throws -} - -template -bool BasicArray::compare(const BasicArray& a) const -{ - size_t n = size(); - if (a.size() != n) - return false; - const T* data_1 = reinterpret_cast(m_data); - const T* data_2 = reinterpret_cast(a.m_data); - return std::equal(data_1, data_1 + n, data_2); -} - - -template -size_t BasicArray::calc_byte_len(size_t for_size, size_t) const -{ - // FIXME: Consider calling `calc_aligned_byte_size(size)` - // instead. Note however, that calc_byte_len() is supposed to return - // the unaligned byte size. It is probably the case that no harm - // is done by returning the aligned version, and most callers of - // calc_byte_len() will actually benefit if calc_byte_len() was - // changed to always return the aligned byte size. - return header_size + for_size * sizeof(T); -} - -template -size_t BasicArray::calc_item_count(size_t bytes, size_t) const noexcept -{ - size_t bytes_without_header = bytes - header_size; - return bytes_without_header / sizeof(T); -} - -template -size_t BasicArray::find(T value, size_t begin, size_t end) const -{ - if (end == npos) - end = m_size; - REALM_ASSERT(begin <= m_size && end <= m_size && begin <= end); - const T* data = reinterpret_cast(m_data); - const T* i = std::find(data + begin, data + end, value); - return i == data + end ? not_found : size_t(i - data); -} - -template -inline size_t BasicArray::find_first(T value, size_t begin, size_t end) const -{ - return this->find(value, begin, end); -} - -template -void BasicArray::find_all(IntegerColumn* result, T value, size_t add_offset, size_t begin, size_t end) const -{ - size_t first = begin - 1; - for (;;) { - first = this->find(value, first + 1, end); - if (first == not_found) - break; - - Array::add_to_column(result, first + add_offset); - } -} - -template -size_t BasicArray::count(T value, size_t begin, size_t end) const -{ - if (end == npos) - end = m_size; - REALM_ASSERT(begin <= m_size && end <= m_size && begin <= end); - const T* data = reinterpret_cast(m_data); - return std::count(data + begin, data + end, value); -} - -#if 0 -// currently unused -template -double BasicArray::sum(size_t begin, size_t end) const -{ - if (end == npos) - end = m_size; - REALM_ASSERT(begin <= m_size && end <= m_size && begin <= end); - const T* data = reinterpret_cast(m_data); - return std::accumulate(data + begin, data + end, double(0)); -} -#endif - -template -template -bool BasicArray::minmax(T& result, size_t begin, size_t end) const -{ - if (end == npos) - end = m_size; - if (m_size == 0) - return false; - REALM_ASSERT(begin < m_size && end <= m_size && begin < end); - - T m = get(begin); - ++begin; - for (; begin < end; ++begin) { - T val = get(begin); - if (find_max ? val > m : val < m) - m = val; - } - result = m; - return true; -} - -template -bool BasicArray::maximum(T& result, size_t begin, size_t end) const -{ - return minmax(result, begin, end); -} - -template -bool BasicArray::minimum(T& result, size_t begin, size_t end) const -{ - return minmax(result, begin, end); -} - - -template -ref_type BasicArray::bptree_leaf_insert(size_t ndx, T value, TreeInsertBase& state) -{ - size_t leaf_size = size(); - REALM_ASSERT_3(leaf_size, <=, REALM_MAX_BPNODE_SIZE); - if (leaf_size < ndx) - ndx = leaf_size; - if (REALM_LIKELY(leaf_size < REALM_MAX_BPNODE_SIZE)) { - insert(ndx, value); - return 0; // Leaf was not split - } - - // Split leaf node - BasicArray new_leaf(get_alloc()); - new_leaf.create(); // Throws - if (ndx == leaf_size) { - new_leaf.add(value); - state.m_split_offset = ndx; - } - else { - // FIXME: Could be optimized by first resizing the target - // array, then copy elements with std::copy(). - for (size_t i = ndx; i != leaf_size; ++i) - new_leaf.add(get(i)); - truncate(ndx); - add(value); - state.m_split_offset = ndx + 1; - } - state.m_split_size = leaf_size + 1; - return new_leaf.get_ref(); -} - -template -inline size_t BasicArray::lower_bound(T value) const noexcept -{ - const T* begin = reinterpret_cast(m_data); - const T* end = begin + size(); - return std::lower_bound(begin, end, value) - begin; -} - -template -inline size_t BasicArray::upper_bound(T value) const noexcept -{ - const T* begin = reinterpret_cast(m_data); - const T* end = begin + size(); - return std::upper_bound(begin, end, value) - begin; -} - -template -inline size_t BasicArray::calc_aligned_byte_size(size_t size) -{ - size_t max = std::numeric_limits::max(); - size_t max_2 = max & ~size_t(7); // Allow for upwards 8-byte alignment - if (size > (max_2 - header_size) / sizeof(T)) - throw std::runtime_error("Byte size overflow"); - size_t byte_size = header_size + size * sizeof(T); - REALM_ASSERT_3(byte_size, >, 0); - size_t aligned_byte_size = ((byte_size - 1) | 7) + 1; // 8-byte alignment - return aligned_byte_size; -} - - -#ifdef REALM_DEBUG - -// LCOV_EXCL_START -template -void BasicArray::to_dot(std::ostream& out, StringData title) const -{ - ref_type ref = get_ref(); - if (title.size() != 0) { - out << "subgraph cluster_" << ref << " {\n"; - out << " label = \"" << title << "\";\n"; - out << " color = white;\n"; - } - - out << "n" << std::hex << ref << std::dec << "[shape=none,label=<"; - out << "
\n"; - - // Header - out << "\n"; - - // Values - size_t n = m_size; - for (size_t i = 0; i != n; ++i) - out << "\n"; - - out << "
"; - out << "0x" << std::hex << ref << std::dec << "
"; - out << "
" << get(i) << "
>];\n"; - - if (title.size() != 0) - out << "}\n"; - - to_dot_parent_edge(out); -} -// LCOV_EXCL_STOP - -#endif // REALM_DEBUG - - -} // namespace realm - -#endif // REALM_ARRAY_BASIC_TPL_HPP diff --git a/Pods/Realm/include/core/realm/array_binary.hpp b/Pods/Realm/include/core/realm/array_binary.hpp deleted file mode 100644 index 414b0dfe..00000000 --- a/Pods/Realm/include/core/realm/array_binary.hpp +++ /dev/null @@ -1,255 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ARRAY_BINARY_HPP -#define REALM_ARRAY_BINARY_HPP - -#include -#include -#include -#include - -namespace realm { - -/* -STORAGE FORMAT ---------------------------------------------------------------------------------------- -ArrayBinary stores binary elements using two ArrayInteger and one ArrayBlob. The ArrayBlob can only store one -single concecutive array of bytes (contrary to its 'Array' name that misleadingly indicates it could store multiple -elements). - -Assume we have the strings "a", "", "abc", null, "ab". Then the three arrays will contain: - -ArrayInteger m_offsets 1, 1, 5, 5, 6 -ArrayBlob m_blob aabcab -ArrayInteger m_nulls 0, 0, 0, 1, 0 // 1 indicates null, 0 indicates non-null - -So for each element the ArrayInteger, the ArrayInteger points into the ArrayBlob at the position of the first -byte of the next element. - -m_nulls is always present (except for old database files; see below), so any ArrayBinary is always nullable! -The nullable property (such as throwing exception upon set(null) on non-nullable column, etc) is handled on -column level only. - -DATABASE FILE VERSION CHANGES ---------------------------------------------------------------------------------------- -Old database files do not have any m_nulls array. To be backwardscompatible, many methods will have tests like -`if(Array::size() == 3)` and have a backwards compatible code paths for these (e.g. avoid writing to m_nulls -in set(), etc). This way no file format upgrade is needed to support nulls for BinaryData. -*/ - -class ArrayBinary : public Array { -public: - explicit ArrayBinary(Allocator&) noexcept; - ~ArrayBinary() noexcept override - { - } - - /// Create a new empty binary array and attach this accessor to - /// it. This does not modify the parent reference information of - /// this accessor. - /// - /// Note that the caller assumes ownership of the allocated - /// underlying node. It is not owned by the accessor. - void create(); - - // Old database files will not have the m_nulls array, so we need code paths for - // backwards compatibility for these cases. - bool legacy_array_type() const noexcept; - - //@{ - /// Overriding functions of Array - void init_from_ref(ref_type) noexcept; - void init_from_mem(MemRef) noexcept; - void init_from_parent() noexcept; - //@} - - bool is_empty() const noexcept; - size_t size() const noexcept; - - BinaryData get(size_t ndx) const noexcept; - size_t read(size_t ndx, size_t pos, char* buffer, size_t max_size) const noexcept; - - void add(BinaryData value, bool add_zero_term = false); - void set(size_t ndx, BinaryData value, bool add_zero_term = false); - void insert(size_t ndx, BinaryData value, bool add_zero_term = false); - void erase(size_t ndx); - void truncate(size_t new_size); - void clear(); - void destroy(); - - /// Get the specified element without the cost of constructing an - /// array instance. If an array instance is already available, or - /// you need to get multiple values, then this method will be - /// slower. - static BinaryData get(const char* header, size_t ndx, Allocator&) noexcept; - - ref_type bptree_leaf_insert(size_t ndx, BinaryData, bool add_zero_term, TreeInsertBase& state); - - static size_t get_size_from_header(const char*, Allocator&) noexcept; - - /// Construct a binary array of the specified size and return just - /// the reference to the underlying memory. All elements will be - /// initialized to the binary value `defaults`, which can be either - /// null or zero-length non-null (value with size > 0 is not allowed as - /// initialization value). - static MemRef create_array(size_t size, Allocator&, BinaryData defaults); - - /// Construct a copy of the specified slice of this binary array - /// using the specified target allocator. - MemRef slice(size_t offset, size_t slice_size, Allocator& target_alloc) const; - -#ifdef REALM_DEBUG - void to_dot(std::ostream&, bool is_strings, StringData title = StringData()) const; -#endif - bool update_from_parent(size_t old_baseline) noexcept; - -private: - ArrayInteger m_offsets; - ArrayBlob m_blob; - ArrayInteger m_nulls; -}; - - -// Implementation: - -inline ArrayBinary::ArrayBinary(Allocator& allocator) noexcept - : Array(allocator) - , m_offsets(allocator) - , m_blob(allocator) - , m_nulls(allocator) -{ - m_offsets.set_parent(this, 0); - m_blob.set_parent(this, 1); - m_nulls.set_parent(this, 2); -} - -inline void ArrayBinary::create() -{ - size_t init_size = 0; - BinaryData defaults = BinaryData{}; // This init value is ignored because size = 0 - MemRef mem = create_array(init_size, get_alloc(), defaults); // Throws - init_from_mem(mem); -} - -inline void ArrayBinary::init_from_ref(ref_type ref) noexcept -{ - REALM_ASSERT(ref); - char* header = get_alloc().translate(ref); - init_from_mem(MemRef(header, ref, m_alloc)); -} - -inline void ArrayBinary::init_from_parent() noexcept -{ - ref_type ref = get_ref_from_parent(); - init_from_ref(ref); -} - -inline bool ArrayBinary::is_empty() const noexcept -{ - return m_offsets.is_empty(); -} - -// Old database files will not have the m_nulls array, so we need code paths for -// backwards compatibility for these cases. We can test if m_nulls exists by looking -// at number of references in this ArrayBinary. -inline bool ArrayBinary::legacy_array_type() const noexcept -{ - if (Array::size() == 3) - return false; // New database file - else if (Array::size() == 2) - return true; // Old database file - else - REALM_ASSERT(false); // Should never happen - return false; -} - -inline size_t ArrayBinary::size() const noexcept -{ - return m_offsets.size(); -} - -inline BinaryData ArrayBinary::get(size_t ndx) const noexcept -{ - REALM_ASSERT_3(ndx, <, m_offsets.size()); - - if (!legacy_array_type() && m_nulls.get(ndx)) { - return BinaryData(); - } - else { - size_t begin = ndx ? to_size_t(m_offsets.get(ndx - 1)) : 0; - size_t end = to_size_t(m_offsets.get(ndx)); - - BinaryData bd = BinaryData(m_blob.get(begin), end - begin); - // Old database file (non-nullable column should never return null) - REALM_ASSERT(!bd.is_null()); - return bd; - } -} - -inline void ArrayBinary::truncate(size_t new_size) -{ - REALM_ASSERT_3(new_size, <, m_offsets.size()); - - size_t blob_size = new_size ? to_size_t(m_offsets.get(new_size - 1)) : 0; - - m_offsets.truncate(new_size); - m_blob.truncate(blob_size); - if (!legacy_array_type()) - m_nulls.truncate(new_size); -} - -inline void ArrayBinary::clear() -{ - m_blob.clear(); - m_offsets.clear(); - if (!legacy_array_type()) - m_nulls.clear(); -} - -inline void ArrayBinary::destroy() -{ - m_blob.destroy(); - m_offsets.destroy(); - if (!legacy_array_type()) - m_nulls.destroy(); - Array::destroy(); -} - -inline size_t ArrayBinary::get_size_from_header(const char* header, Allocator& alloc) noexcept -{ - ref_type offsets_ref = to_ref(Array::get(header, 0)); - const char* offsets_header = alloc.translate(offsets_ref); - return Array::get_size_from_header(offsets_header); -} - -inline bool ArrayBinary::update_from_parent(size_t old_baseline) noexcept -{ - bool res = Array::update_from_parent(old_baseline); - if (res) { - m_blob.update_from_parent(old_baseline); - m_offsets.update_from_parent(old_baseline); - if (!legacy_array_type()) - m_nulls.update_from_parent(old_baseline); - } - return res; -} - -} // namespace realm - -#endif // REALM_ARRAY_BINARY_HPP diff --git a/Pods/Realm/include/core/realm/array_blob.hpp b/Pods/Realm/include/core/realm/array_blob.hpp deleted file mode 100644 index 7fcf181c..00000000 --- a/Pods/Realm/include/core/realm/array_blob.hpp +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ARRAY_BLOB_HPP -#define REALM_ARRAY_BLOB_HPP - -#include - -namespace realm { - - -class ArrayBlob : public Array { -public: - static constexpr size_t max_binary_size = 0xFFFFF8 - Array::header_size; - - explicit ArrayBlob(Allocator&) noexcept; - ~ArrayBlob() noexcept override - { - } - - const char* get(size_t index) const noexcept; - BinaryData get_at(size_t& pos) const noexcept; - bool is_null(size_t index) const noexcept; - ref_type add(const char* data, size_t data_size, bool add_zero_term = false); - void insert(size_t pos, const char* data, size_t data_size, bool add_zero_term = false); - ref_type replace(size_t begin, size_t end, const char* data, size_t data_size, bool add_zero_term = false); - void erase(size_t begin, size_t end); - - /// Get the specified element without the cost of constructing an - /// array instance. If an array instance is already available, or - /// you need to get multiple values, then this method will be - /// slower. - static const char* get(const char* header, size_t index) noexcept; - - /// Create a new empty blob (binary) array and attach this - /// accessor to it. This does not modify the parent reference - /// information of this accessor. - /// - /// Note that the caller assumes ownership of the allocated - /// underlying node. It is not owned by the accessor. - void create(); - - /// Construct a blob of the specified size and return just the - /// reference to the underlying memory. All bytes will be - /// initialized to zero. - static MemRef create_array(size_t init_size, Allocator&); - -#ifdef REALM_DEBUG - size_t blob_size() const noexcept; - void verify() const; - void to_dot(std::ostream&, StringData title = StringData()) const; -#endif - -private: - size_t calc_byte_len(size_t for_size, size_t width) const override; - size_t calc_item_count(size_t bytes, size_t width) const noexcept override; -}; - - -// Implementation: - -// Creates new array (but invalid, call init_from_ref() to init) -inline ArrayBlob::ArrayBlob(Allocator& allocator) noexcept - : Array(allocator) -{ -} - -inline bool ArrayBlob::is_null(size_t index) const noexcept -{ - return (get(index) == nullptr); -} - -inline const char* ArrayBlob::get(size_t index) const noexcept -{ - return m_data + index; -} - -inline ref_type ArrayBlob::add(const char* data, size_t data_size, bool add_zero_term) -{ - return replace(m_size, m_size, data, data_size, add_zero_term); -} - -inline void ArrayBlob::insert(size_t pos, const char* data, size_t data_size, bool add_zero_term) -{ - replace(pos, pos, data, data_size, add_zero_term); -} - -inline void ArrayBlob::erase(size_t begin, size_t end) -{ - const char* data = nullptr; - size_t data_size = 0; - replace(begin, end, data, data_size); -} - -inline const char* ArrayBlob::get(const char* header, size_t pos) noexcept -{ - const char* data = get_data_from_header(header); - return data + pos; -} - -inline void ArrayBlob::create() -{ - size_t init_size = 0; - MemRef mem = create_array(init_size, get_alloc()); // Throws - init_from_mem(mem); -} - -inline MemRef ArrayBlob::create_array(size_t init_size, Allocator& allocator) -{ - bool context_flag = false; - int_fast64_t value = 0; - return Array::create(type_Normal, context_flag, wtype_Ignore, init_size, value, allocator); // Throws -} - -inline size_t ArrayBlob::calc_byte_len(size_t for_size, size_t) const -{ - return header_size + for_size; -} - -inline size_t ArrayBlob::calc_item_count(size_t bytes, size_t) const noexcept -{ - return bytes - header_size; -} - - -} // namespace realm - -#endif // REALM_ARRAY_BLOB_HPP diff --git a/Pods/Realm/include/core/realm/array_blobs_big.hpp b/Pods/Realm/include/core/realm/array_blobs_big.hpp deleted file mode 100644 index d931837d..00000000 --- a/Pods/Realm/include/core/realm/array_blobs_big.hpp +++ /dev/null @@ -1,218 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ARRAY_BIG_BLOBS_HPP -#define REALM_ARRAY_BIG_BLOBS_HPP - -#include - -namespace realm { - - -class ArrayBigBlobs : public Array { -public: - typedef BinaryData value_type; - - explicit ArrayBigBlobs(Allocator&, bool nullable) noexcept; - - BinaryData get(size_t ndx) const noexcept; - BinaryData get_at(size_t ndx, size_t& pos) const noexcept; - void set(size_t ndx, BinaryData value, bool add_zero_term = false); - void add(BinaryData value, bool add_zero_term = false); - void insert(size_t ndx, BinaryData value, bool add_zero_term = false); - void erase(size_t ndx); - void truncate(size_t new_size); - void clear(); - void destroy(); - - size_t count(BinaryData value, bool is_string = false, size_t begin = 0, size_t end = npos) const noexcept; - size_t find_first(BinaryData value, bool is_string = false, size_t begin = 0, size_t end = npos) const noexcept; - void find_all(IntegerColumn& result, BinaryData value, bool is_string = false, size_t add_offset = 0, - size_t begin = 0, size_t end = npos); - - /// Get the specified element without the cost of constructing an - /// array instance. If an array instance is already available, or - /// you need to get multiple values, then this method will be - /// slower. - static BinaryData get(const char* header, size_t ndx, Allocator&) noexcept; - - ref_type bptree_leaf_insert(size_t ndx, BinaryData, bool add_zero_term, TreeInsertBase& state); - - //@{ - /// Those that return a string, discard the terminating zero from - /// the stored value. Those that accept a string argument, add a - /// terminating zero before storing the value. - StringData get_string(size_t ndx) const noexcept; - void add_string(StringData value); - void set_string(size_t ndx, StringData value); - void insert_string(size_t ndx, StringData value); - static StringData get_string(const char* header, size_t ndx, Allocator&, bool nullable) noexcept; - ref_type bptree_leaf_insert_string(size_t ndx, StringData, TreeInsertBase& state); - //@} - - /// Create a new empty big blobs array and attach this accessor to - /// it. This does not modify the parent reference information of - /// this accessor. - /// - /// Note that the caller assumes ownership of the allocated - /// underlying node. It is not owned by the accessor. - void create(); - - /// Construct a copy of the specified slice of this big blobs - /// array using the specified target allocator. - MemRef slice(size_t offset, size_t slice_size, Allocator& target_alloc) const; - -#ifdef REALM_DEBUG - void verify() const; - void to_dot(std::ostream&, bool is_strings, StringData title = StringData()) const; -#endif - -private: - bool m_nullable; -}; - - -// Implementation: - -inline ArrayBigBlobs::ArrayBigBlobs(Allocator& allocator, bool nullable) noexcept - : Array(allocator) - , m_nullable(nullable) -{ -} - -inline BinaryData ArrayBigBlobs::get(size_t ndx) const noexcept -{ - ref_type ref = get_as_ref(ndx); - if (ref == 0) - return {}; // realm::null(); - - const char* blob_header = get_alloc().translate(ref); - if (!get_context_flag_from_header(blob_header)) { - const char* value = ArrayBlob::get(blob_header, 0); - size_t blob_size = get_size_from_header(blob_header); - return BinaryData(value, blob_size); - } - return {}; -} - -inline BinaryData ArrayBigBlobs::get(const char* header, size_t ndx, Allocator& alloc) noexcept -{ - ref_type blob_ref = to_ref(Array::get(header, ndx)); - if (blob_ref == 0) - return {}; - - const char* blob_header = alloc.translate(blob_ref); - if (!get_context_flag_from_header(blob_header)) { - const char* blob_data = Array::get_data_from_header(blob_header); - size_t blob_size = Array::get_size_from_header(blob_header); - return BinaryData(blob_data, blob_size); - } - return {}; -} - -inline void ArrayBigBlobs::erase(size_t ndx) -{ - ref_type blob_ref = Array::get_as_ref(ndx); - if (blob_ref != 0) { // nothing to destroy if null - Array::destroy(blob_ref, get_alloc()); // Shallow - } - Array::erase(ndx); -} - -inline void ArrayBigBlobs::truncate(size_t new_size) -{ - Array::truncate_and_destroy_children(new_size); -} - -inline void ArrayBigBlobs::clear() -{ - Array::clear_and_destroy_children(); -} - -inline void ArrayBigBlobs::destroy() -{ - Array::destroy_deep(); -} - -inline StringData ArrayBigBlobs::get_string(size_t ndx) const noexcept -{ - BinaryData bin = get(ndx); - if (bin.is_null()) - return realm::null(); - else - return StringData(bin.data(), bin.size() - 1); // Do not include terminating zero -} - -inline void ArrayBigBlobs::set_string(size_t ndx, StringData value) -{ - REALM_ASSERT_DEBUG(!(!m_nullable && value.is_null())); - BinaryData bin(value.data(), value.size()); - bool add_zero_term = true; - set(ndx, bin, add_zero_term); -} - -inline void ArrayBigBlobs::add_string(StringData value) -{ - REALM_ASSERT_DEBUG(!(!m_nullable && value.is_null())); - BinaryData bin(value.data(), value.size()); - bool add_zero_term = true; - add(bin, add_zero_term); -} - -inline void ArrayBigBlobs::insert_string(size_t ndx, StringData value) -{ - REALM_ASSERT_DEBUG(!(!m_nullable && value.is_null())); - BinaryData bin(value.data(), value.size()); - bool add_zero_term = true; - insert(ndx, bin, add_zero_term); -} - -inline StringData ArrayBigBlobs::get_string(const char* header, size_t ndx, Allocator& alloc, bool nullable) noexcept -{ - static_cast(nullable); - BinaryData bin = get(header, ndx, alloc); - REALM_ASSERT_DEBUG(!(!nullable && bin.is_null())); - if (bin.is_null()) - return realm::null(); - else - return StringData(bin.data(), bin.size() - 1); // Do not include terminating zero -} - -inline ref_type ArrayBigBlobs::bptree_leaf_insert_string(size_t ndx, StringData value, TreeInsertBase& state) -{ - REALM_ASSERT_DEBUG(!(!m_nullable && value.is_null())); - BinaryData bin(value.data(), value.size()); - bool add_zero_term = true; - return bptree_leaf_insert(ndx, bin, add_zero_term, state); -} - -inline void ArrayBigBlobs::create() -{ - bool context_flag = true; - Array::create(type_HasRefs, context_flag); // Throws -} - -inline MemRef ArrayBigBlobs::slice(size_t offset, size_t slice_size, Allocator& target_alloc) const -{ - return slice_and_clone_children(offset, slice_size, target_alloc); -} - - -} // namespace realm - -#endif // REALM_ARRAY_BIG_BLOBS_HPP diff --git a/Pods/Realm/include/core/realm/array_direct.hpp b/Pods/Realm/include/core/realm/array_direct.hpp deleted file mode 100644 index e3373925..00000000 --- a/Pods/Realm/include/core/realm/array_direct.hpp +++ /dev/null @@ -1,372 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ARRAY_DIRECT_HPP -#define REALM_ARRAY_DIRECT_HPP - -#include -#include - -using namespace realm::util; - -// clang-format off -/* wid == 16/32 likely when accessing offsets in B tree */ -#define REALM_TEMPEX(fun, wid, arg) \ - if (wid == 16) {fun<16> arg;} \ - else if (wid == 32) {fun<32> arg;} \ - else if (wid == 0) {fun<0> arg;} \ - else if (wid == 1) {fun<1> arg;} \ - else if (wid == 2) {fun<2> arg;} \ - else if (wid == 4) {fun<4> arg;} \ - else if (wid == 8) {fun<8> arg;} \ - else if (wid == 64) {fun<64> arg;} \ - else {REALM_ASSERT_DEBUG(false); fun<0> arg;} - -#define REALM_TEMPEX2(fun, targ, wid, arg) \ - if (wid == 16) {fun arg;} \ - else if (wid == 32) {fun arg;} \ - else if (wid == 0) {fun arg;} \ - else if (wid == 1) {fun arg;} \ - else if (wid == 2) {fun arg;} \ - else if (wid == 4) {fun arg;} \ - else if (wid == 8) {fun arg;} \ - else if (wid == 64) {fun arg;} \ - else {REALM_ASSERT_DEBUG(false); fun arg;} - -#define REALM_TEMPEX3(fun, targ1, targ2, wid, arg) \ - if (wid == 16) {fun arg;} \ - else if (wid == 32) {fun arg;} \ - else if (wid == 0) {fun arg;} \ - else if (wid == 1) {fun arg;} \ - else if (wid == 2) {fun arg;} \ - else if (wid == 4) {fun arg;} \ - else if (wid == 8) {fun arg;} \ - else if (wid == 64) {fun arg;} \ - else {REALM_ASSERT_DEBUG(false); fun arg;} - -#define REALM_TEMPEX4(fun, targ1, targ2, wid, targ3, arg) \ - if (wid == 16) {fun arg;} \ - else if (wid == 32) {fun arg;} \ - else if (wid == 0) {fun arg;} \ - else if (wid == 1) {fun arg;} \ - else if (wid == 2) {fun arg;} \ - else if (wid == 4) {fun arg;} \ - else if (wid == 8) {fun arg;} \ - else if (wid == 64) {fun arg;} \ - else {REALM_ASSERT_DEBUG(false); fun arg;} - -#define REALM_TEMPEX5(fun, targ1, targ2, targ3, targ4, wid, arg) \ - if (wid == 16) {fun arg;} \ - else if (wid == 32) {fun arg;} \ - else if (wid == 0) {fun arg;} \ - else if (wid == 1) {fun arg;} \ - else if (wid == 2) {fun arg;} \ - else if (wid == 4) {fun arg;} \ - else if (wid == 8) {fun arg;} \ - else if (wid == 64) {fun arg;} \ - else {REALM_ASSERT_DEBUG(false); fun arg;} -// clang-format on - -namespace realm { - -// Direct access methods - -template -void set_direct(char* data, size_t ndx, int_fast64_t value) noexcept -{ - if (width == 0) { - REALM_ASSERT_DEBUG(value == 0); - return; - } - else if (width == 1) { - REALM_ASSERT_DEBUG(0 <= value && value <= 0x01); - size_t byte_ndx = ndx / 8; - size_t bit_ndx = ndx % 8; - typedef unsigned char uchar; - uchar* p = reinterpret_cast(data) + byte_ndx; - *p = uchar((*p & ~(0x01 << bit_ndx)) | (int(value) & 0x01) << bit_ndx); - } - else if (width == 2) { - REALM_ASSERT_DEBUG(0 <= value && value <= 0x03); - size_t byte_ndx = ndx / 4; - size_t bit_ndx = ndx % 4 * 2; - typedef unsigned char uchar; - uchar* p = reinterpret_cast(data) + byte_ndx; - *p = uchar((*p & ~(0x03 << bit_ndx)) | (int(value) & 0x03) << bit_ndx); - } - else if (width == 4) { - REALM_ASSERT_DEBUG(0 <= value && value <= 0x0F); - size_t byte_ndx = ndx / 2; - size_t bit_ndx = ndx % 2 * 4; - typedef unsigned char uchar; - uchar* p = reinterpret_cast(data) + byte_ndx; - *p = uchar((*p & ~(0x0F << bit_ndx)) | (int(value) & 0x0F) << bit_ndx); - } - else if (width == 8) { - REALM_ASSERT_DEBUG(std::numeric_limits::min() <= value && - value <= std::numeric_limits::max()); - *(reinterpret_cast(data) + ndx) = int8_t(value); - } - else if (width == 16) { - REALM_ASSERT_DEBUG(std::numeric_limits::min() <= value && - value <= std::numeric_limits::max()); - *(reinterpret_cast(data) + ndx) = int16_t(value); - } - else if (width == 32) { - REALM_ASSERT_DEBUG(std::numeric_limits::min() <= value && - value <= std::numeric_limits::max()); - *(reinterpret_cast(data) + ndx) = int32_t(value); - } - else if (width == 64) { - REALM_ASSERT_DEBUG(std::numeric_limits::min() <= value && - value <= std::numeric_limits::max()); - *(reinterpret_cast(data) + ndx) = int64_t(value); - } - else { - REALM_ASSERT_DEBUG(false); - } -} - -template -void fill_direct(char* data, size_t begin, size_t end, int_fast64_t value) noexcept -{ - for (size_t i = begin; i != end; ++i) - set_direct(data, i, value); -} - -template -int64_t get_direct(const char* data, size_t ndx) noexcept -{ - if (w == 0) { - return 0; - } - if (w == 1) { - size_t offset = ndx >> 3; - return (data[offset] >> (ndx & 7)) & 0x01; - } - if (w == 2) { - size_t offset = ndx >> 2; - return (data[offset] >> ((ndx & 3) << 1)) & 0x03; - } - if (w == 4) { - size_t offset = ndx >> 1; - return (data[offset] >> ((ndx & 1) << 2)) & 0x0F; - } - if (w == 8) { - return *reinterpret_cast(data + ndx); - } - if (w == 16) { - size_t offset = ndx * 2; - return *reinterpret_cast(data + offset); - } - if (w == 32) { - size_t offset = ndx * 4; - return *reinterpret_cast(data + offset); - } - if (w == 64) { - size_t offset = ndx * 8; - return *reinterpret_cast(data + offset); - } - REALM_ASSERT_DEBUG(false); - return int64_t(-1); -} - -inline int64_t get_direct(const char* data, size_t width, size_t ndx) noexcept -{ - REALM_TEMPEX(return get_direct, width, (data, ndx)); -} - - -template -inline std::pair get_two(const char* data, size_t ndx) noexcept -{ - return std::make_pair(to_size_t(get_direct(data, ndx + 0)), to_size_t(get_direct(data, ndx + 1))); -} - -inline std::pair get_two(const char* data, size_t width, size_t ndx) noexcept -{ - REALM_TEMPEX(return get_two, width, (data, ndx)); -} - - -template -inline void get_three(const char* data, size_t ndx, ref_type& v0, ref_type& v1, ref_type& v2) noexcept -{ - v0 = to_ref(get_direct(data, ndx + 0)); - v1 = to_ref(get_direct(data, ndx + 1)); - v2 = to_ref(get_direct(data, ndx + 2)); -} - -inline void get_three(const char* data, size_t width, size_t ndx, ref_type& v0, ref_type& v1, ref_type& v2) noexcept -{ - REALM_TEMPEX(get_three, width, (data, ndx, v0, v1, v2)); -} - - -// Lower/upper bound in sorted sequence -// ------------------------------------ -// -// 3 3 3 4 4 4 5 6 7 9 9 9 -// ^ ^ ^ ^ ^ -// | | | | | -// | | | | -- Lower and upper bound of 15 -// | | | | -// | | | -- Lower and upper bound of 8 -// | | | -// | | -- Upper bound of 4 -// | | -// | -- Lower bound of 4 -// | -// -- Lower and upper bound of 1 -// -// These functions are semantically identical to std::lower_bound() and -// std::upper_bound(). -// -// We currently use binary search. See for example -// http://www.tbray.org/ongoing/When/200x/2003/03/22/Binary. -template -inline size_t lower_bound(const char* data, size_t size, int64_t value) noexcept -{ - // The binary search used here is carefully optimized. Key trick is to use a single - // loop controlling variable (size) instead of high/low pair, and to keep updates - // to size done inside the loop independent of comparisons. Further key to speed - // is to avoid branching inside the loop, using conditional moves instead. This - // provides robust performance for random searches, though predictable searches - // might be slightly faster if we used branches instead. The loop unrolling yields - // a final 5-20% speedup depending on circumstances. - - size_t low = 0; - - while (size >= 8) { - // The following code (at X, Y and Z) is 3 times manually unrolled instances of (A) below. - // These code blocks must be kept in sync. Meassurements indicate 3 times unrolling to give - // the best performance. See (A) for comments on the loop body. - // (X) - size_t half = size / 2; - size_t other_half = size - half; - size_t probe = low + half; - size_t other_low = low + other_half; - int64_t v = get_direct(data, probe); - size = half; - low = (v < value) ? other_low : low; - - // (Y) - half = size / 2; - other_half = size - half; - probe = low + half; - other_low = low + other_half; - v = get_direct(data, probe); - size = half; - low = (v < value) ? other_low : low; - - // (Z) - half = size / 2; - other_half = size - half; - probe = low + half; - other_low = low + other_half; - v = get_direct(data, probe); - size = half; - low = (v < value) ? other_low : low; - } - while (size > 0) { - // (A) - // To understand the idea in this code, please note that - // for performance, computation of size for the next iteration - // MUST be INDEPENDENT of the conditional. This allows the - // processor to unroll the loop as fast as possible, and it - // minimizes the length of dependence chains leading up to branches. - // Making the unfolding of the loop independent of the data being - // searched, also minimizes the delays incurred by branch - // mispredictions, because they can be determined earlier - // and the speculation corrected earlier. - - // Counterintuitive: - // To make size independent of data, we cannot always split the - // range at the theoretical optimal point. When we determine that - // the key is larger than the probe at some index K, and prepare - // to search the upper part of the range, you would normally start - // the search at the next index, K+1, to get the shortest range. - // We can only do this when splitting a range with odd number of entries. - // If there is an even number of entries we search from K instead of K+1. - // This potentially leads to redundant comparisons, but in practice we - // gain more performance by making the changes to size predictable. - - // if size is even, half and other_half are the same. - // if size is odd, half is one less than other_half. - size_t half = size / 2; - size_t other_half = size - half; - size_t probe = low + half; - size_t other_low = low + other_half; - int64_t v = get_direct(data, probe); - size = half; - // for max performance, the line below should compile into a conditional - // move instruction. Not all compilers do this. To maximize chance - // of succes, no computation should be done in the branches of the - // conditional. - low = (v < value) ? other_low : low; - }; - - return low; -} - -// See lower_bound() -template -inline size_t upper_bound(const char* data, size_t size, int64_t value) noexcept -{ - size_t low = 0; - while (size >= 8) { - size_t half = size / 2; - size_t other_half = size - half; - size_t probe = low + half; - size_t other_low = low + other_half; - int64_t v = get_direct(data, probe); - size = half; - low = (value >= v) ? other_low : low; - - half = size / 2; - other_half = size - half; - probe = low + half; - other_low = low + other_half; - v = get_direct(data, probe); - size = half; - low = (value >= v) ? other_low : low; - - half = size / 2; - other_half = size - half; - probe = low + half; - other_low = low + other_half; - v = get_direct(data, probe); - size = half; - low = (value >= v) ? other_low : low; - } - - while (size > 0) { - size_t half = size / 2; - size_t other_half = size - half; - size_t probe = low + half; - size_t other_low = low + other_half; - int64_t v = get_direct(data, probe); - size = half; - low = (value >= v) ? other_low : low; - }; - - return low; -} -} - -#endif /* ARRAY_TPL_HPP_ */ diff --git a/Pods/Realm/include/core/realm/array_integer.hpp b/Pods/Realm/include/core/realm/array_integer.hpp deleted file mode 100644 index 40822a8e..00000000 --- a/Pods/Realm/include/core/realm/array_integer.hpp +++ /dev/null @@ -1,625 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ARRAY_INTEGER_HPP -#define REALM_ARRAY_INTEGER_HPP - -#include -#include -#include - -namespace realm { - -class ArrayInteger : public Array { -public: - typedef int64_t value_type; - - explicit ArrayInteger(Allocator&) noexcept; - ~ArrayInteger() noexcept override - { - } - - void create(Type type = type_Normal, bool context_flag = false); - - void add(int64_t value); - void set(size_t ndx, int64_t value); - void set_uint(size_t ndx, uint_fast64_t value) noexcept; - int64_t get(size_t ndx) const noexcept; - uint64_t get_uint(size_t ndx) const noexcept; - static int64_t get(const char* header, size_t ndx) noexcept; - bool compare(const ArrayInteger& a) const noexcept; - - /// Add \a diff to the element at the specified index. - void adjust(size_t ndx, int_fast64_t diff); - - /// Add \a diff to all the elements in the specified index range. - void adjust(size_t begin, size_t end, int_fast64_t diff); - - /// Add signed \a diff to all elements that are greater than, or equal to \a - /// limit. - void adjust_ge(int_fast64_t limit, int_fast64_t diff); - - int64_t operator[](size_t ndx) const noexcept - { - return get(ndx); - } - int64_t front() const noexcept; - int64_t back() const noexcept; - - size_t lower_bound(int64_t value) const noexcept; - size_t upper_bound(int64_t value) const noexcept; - - std::vector to_vector() const; - -private: - template - bool minmax(size_t from, size_t to, uint64_t maxdiff, int64_t* min, int64_t* max) const; -}; - -class ArrayIntNull : public Array { -public: - using value_type = util::Optional; - - explicit ArrayIntNull(Allocator&) noexcept; - ~ArrayIntNull() noexcept override; - - /// Construct an array of the specified type and size, and return just the - /// reference to the underlying memory. All elements will be initialized to - /// the specified value. - static MemRef create_array(Type, bool context_flag, size_t size, value_type value, Allocator&); - void create(Type = type_Normal, bool context_flag = false); - - void init_from_ref(ref_type) noexcept; - void init_from_mem(MemRef) noexcept; - void init_from_parent() noexcept; - - size_t size() const noexcept; - bool is_empty() const noexcept; - - void insert(size_t ndx, value_type value); - void add(value_type value); - void set(size_t ndx, value_type value) noexcept; - value_type get(size_t ndx) const noexcept; - static value_type get(const char* header, size_t ndx) noexcept; - void get_chunk(size_t ndx, value_type res[8]) const noexcept; - void set_null(size_t ndx) noexcept; - bool is_null(size_t ndx) const noexcept; - int64_t null_value() const noexcept; - - value_type operator[](size_t ndx) const noexcept; - value_type front() const noexcept; - value_type back() const noexcept; - void erase(size_t ndx); - void erase(size_t begin, size_t end); - void truncate(size_t size); - void clear(); - void set_all_to_zero(); - - void move(size_t begin, size_t end, size_t dest_begin); - void move_backward(size_t begin, size_t end, size_t dest_end); - - size_t lower_bound(int64_t value) const noexcept; - size_t upper_bound(int64_t value) const noexcept; - - int64_t sum(size_t start = 0, size_t end = npos) const; - size_t count(int64_t value) const noexcept; - bool maximum(int64_t& result, size_t start = 0, size_t end = npos, size_t* return_ndx = nullptr) const; - bool minimum(int64_t& result, size_t start = 0, size_t end = npos, size_t* return_ndx = nullptr) const; - - bool find(int cond, Action action, value_type value, size_t start, size_t end, size_t baseindex, - QueryState* state) const; - - template - bool find(value_type value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const; - - // This is the one installed into the m_finder slots. - template - bool find(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state) const; - - template - bool find(value_type value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const; - - // Optimized implementation for release mode - template - bool find_optimized(value_type value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const; - - // Called for each search result - template - bool find_action(size_t index, value_type value, QueryState* state, Callback callback) const; - - template - bool find_action_pattern(size_t index, uint64_t pattern, QueryState* state, Callback callback) const; - - // Wrappers for backwards compatibility and for simple use without - // setting up state initialization etc - template - size_t find_first(value_type value, size_t start = 0, size_t end = npos) const; - - void find_all(IntegerColumn* result, value_type value, size_t col_offset = 0, size_t begin = 0, - size_t end = npos) const; - - - size_t find_first(value_type value, size_t begin = 0, size_t end = npos) const; - - - // Overwrite Array::bptree_leaf_insert to correctly split nodes. - ref_type bptree_leaf_insert(size_t ndx, value_type value, TreeInsertBase& state); - - MemRef slice(size_t offset, size_t slice_size, Allocator& target_alloc) const; - - /// Construct a deep copy of the specified slice of this array using the - /// specified target allocator. Subarrays will be cloned. - MemRef slice_and_clone_children(size_t offset, size_t slice_size, Allocator& target_alloc) const; - -protected: - void avoid_null_collision(int64_t value); - -private: - template - bool minmax_helper(int64_t& result, size_t start = 0, size_t end = npos, size_t* return_ndx = nullptr) const; - - int_fast64_t choose_random_null(int64_t incoming) const; - void replace_nulls_with(int64_t new_null); - bool can_use_as_null(int64_t value) const; -}; - - -// Implementation: - -inline ArrayInteger::ArrayInteger(Allocator& allocator) noexcept - : Array(allocator) -{ - m_is_inner_bptree_node = false; -} - -inline void ArrayInteger::add(int64_t value) -{ - Array::add(value); -} - -inline int64_t ArrayInteger::get(size_t ndx) const noexcept -{ - return Array::get(ndx); -} - -inline int64_t ArrayInteger::get(const char* header, size_t ndx) noexcept -{ - return Array::get(header, ndx); -} - -inline void ArrayInteger::set(size_t ndx, int64_t value) -{ - Array::set(ndx, value); -} - -inline void ArrayInteger::set_uint(size_t ndx, uint_fast64_t value) noexcept -{ - // When a value of a signed type is converted to an unsigned type, the C++ - // standard guarantees that negative values are converted from the native - // representation to 2's complement, but the effect of conversions in the - // opposite direction is left unspecified by the - // standard. `realm::util::from_twos_compl()` is used here to perform the - // correct opposite unsigned-to-signed conversion, which reduces to a no-op - // when 2's complement is the native representation of negative values. - set(ndx, util::from_twos_compl(value)); -} - -inline bool ArrayInteger::compare(const ArrayInteger& a) const noexcept -{ - if (a.size() != size()) - return false; - - for (size_t i = 0; i < size(); ++i) { - if (get(i) != a.get(i)) - return false; - } - - return true; -} - -inline int64_t ArrayInteger::front() const noexcept -{ - return Array::front(); -} - -inline int64_t ArrayInteger::back() const noexcept -{ - return Array::back(); -} - -inline void ArrayInteger::adjust(size_t ndx, int_fast64_t diff) -{ - Array::adjust(ndx, diff); -} - -inline void ArrayInteger::adjust(size_t begin, size_t end, int_fast64_t diff) -{ - Array::adjust(begin, end, diff); -} - -inline void ArrayInteger::adjust_ge(int_fast64_t limit, int_fast64_t diff) -{ - Array::adjust_ge(limit, diff); -} - -inline size_t ArrayInteger::lower_bound(int64_t value) const noexcept -{ - return lower_bound_int(value); -} - -inline size_t ArrayInteger::upper_bound(int64_t value) const noexcept -{ - return upper_bound_int(value); -} - - -inline ArrayIntNull::ArrayIntNull(Allocator& allocator) noexcept - : Array(allocator) -{ -} - -inline ArrayIntNull::~ArrayIntNull() noexcept -{ -} - -inline void ArrayIntNull::create(Type type, bool context_flag) -{ - MemRef r = create_array(type, context_flag, 0, util::none, m_alloc); - init_from_mem(r); -} - - -inline size_t ArrayIntNull::size() const noexcept -{ - return Array::size() - 1; -} - -inline bool ArrayIntNull::is_empty() const noexcept -{ - return size() == 0; -} - -inline void ArrayIntNull::insert(size_t ndx, value_type value) -{ - if (value) { - avoid_null_collision(*value); - Array::insert(ndx + 1, *value); - } - else { - Array::insert(ndx + 1, null_value()); - } -} - -inline void ArrayIntNull::add(value_type value) -{ - if (value) { - avoid_null_collision(*value); - Array::add(*value); - } - else { - Array::add(null_value()); - } -} - -inline void ArrayIntNull::set(size_t ndx, value_type value) noexcept -{ - if (value) { - avoid_null_collision(*value); - Array::set(ndx + 1, *value); - } - else { - Array::set(ndx + 1, null_value()); - } -} - -inline void ArrayIntNull::set_null(size_t ndx) noexcept -{ - Array::set(ndx + 1, null_value()); -} - -inline ArrayIntNull::value_type ArrayIntNull::get(size_t ndx) const noexcept -{ - int64_t value = Array::get(ndx + 1); - if (value == null_value()) { - return util::none; - } - return util::some(value); -} - -inline ArrayIntNull::value_type ArrayIntNull::get(const char* header, size_t ndx) noexcept -{ - int64_t null_value = Array::get(header, 0); - int64_t value = Array::get(header, ndx + 1); - if (value == null_value) { - return util::none; - } - else { - return util::some(value); - } -} - -inline bool ArrayIntNull::is_null(size_t ndx) const noexcept -{ - return !get(ndx); -} - -inline int64_t ArrayIntNull::null_value() const noexcept -{ - return Array::get(0); -} - -inline ArrayIntNull::value_type ArrayIntNull::operator[](size_t ndx) const noexcept -{ - return get(ndx); -} - -inline ArrayIntNull::value_type ArrayIntNull::front() const noexcept -{ - return get(0); -} - -inline ArrayIntNull::value_type ArrayIntNull::back() const noexcept -{ - return Array::back(); -} - -inline void ArrayIntNull::erase(size_t ndx) -{ - Array::erase(ndx + 1); -} - -inline void ArrayIntNull::erase(size_t begin, size_t end) -{ - Array::erase(begin + 1, end + 1); -} - -inline void ArrayIntNull::truncate(size_t to_size) -{ - Array::truncate(to_size + 1); -} - -inline void ArrayIntNull::clear() -{ - truncate(0); -} - -inline void ArrayIntNull::set_all_to_zero() -{ - // FIXME: Array::set_all_to_zero does something else - for (size_t i = 0; i < size(); ++i) { - set(i, 0); - } -} - -inline void ArrayIntNull::move(size_t begin, size_t end, size_t dest_begin) -{ - Array::move(begin + 1, end + 1, dest_begin + 1); -} - -inline void ArrayIntNull::move_backward(size_t begin, size_t end, size_t dest_end) -{ - Array::move_backward(begin + 1, end + 1, dest_end + 1); -} - -inline size_t ArrayIntNull::lower_bound(int64_t value) const noexcept -{ - // FIXME: Consider this behaviour with NULLs. - // Array::lower_bound_int assumes an already sorted array, but - // this array could be sorted with nulls first or last. - return Array::lower_bound_int(value); -} - -inline size_t ArrayIntNull::upper_bound(int64_t value) const noexcept -{ - // FIXME: see lower_bound - return Array::upper_bound_int(value); -} - -inline int64_t ArrayIntNull::sum(size_t start, size_t end) const -{ - // FIXME: Optimize - int64_t sum_of_range = 0; - if (end == npos) - end = size(); - for (size_t i = start; i < end; ++i) { - value_type x = get(i); - if (x) { - sum_of_range += *x; - } - } - return sum_of_range; -} - -inline size_t ArrayIntNull::count(int64_t value) const noexcept -{ - size_t count_of_value = Array::count(value); - if (value == null_value()) { - --count_of_value; - } - return count_of_value; -} - -// FIXME: Optimize -template -inline bool ArrayIntNull::minmax_helper(int64_t& result, size_t start, size_t end, size_t* return_ndx) const -{ - size_t best_index = 1; - - if (end == npos) { - end = m_size; - } - - ++start; - - REALM_ASSERT(start < m_size && end <= m_size && start < end); - - if (m_size == 1) { - // empty array - return false; - } - - if (m_width == 0) { - if (return_ndx) - *return_ndx = best_index - 1; - result = 0; - return true; - } - - int64_t m = Array::get(start); - - const int64_t null_val = null_value(); - for (; start < end; ++start) { - const int64_t v = Array::get(start); - if (find_max ? v > m : v < m) { - if (v == null_val) { - continue; - } - m = v; - best_index = start; - } - } - - result = m; - if (return_ndx) { - *return_ndx = best_index - 1; - } - return true; -} - -inline bool ArrayIntNull::maximum(int64_t& result, size_t start, size_t end, size_t* return_ndx) const -{ - return minmax_helper(result, start, end, return_ndx); -} - -inline bool ArrayIntNull::minimum(int64_t& result, size_t start, size_t end, size_t* return_ndx) const -{ - return minmax_helper(result, start, end, return_ndx); -} - -inline bool ArrayIntNull::find(int cond, Action action, value_type value, size_t start, size_t end, size_t baseindex, - QueryState* state) const -{ - if (value) { - return Array::find(cond, action, *value, start, end, baseindex, state, true /*treat as nullable array*/, - false /*search parameter given in 'value' argument*/); - } - else { - return Array::find(cond, action, 0 /* unused dummy*/, start, end, baseindex, state, - true /*treat as nullable array*/, true /*search for null, ignore value argument*/); - } -} - -template -bool ArrayIntNull::find(value_type value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const -{ - if (value) { - return Array::find(*value, start, end, baseindex, state, std::forward(callback), - true /*treat as nullable array*/, - false /*search parameter given in 'value' argument*/); - } - else { - return Array::find(0 /*ignored*/, start, end, baseindex, state, - std::forward(callback), true /*treat as nullable array*/, - true /*search for null, ignore value argument*/); - } -} - - -template -bool ArrayIntNull::find(int64_t value, size_t start, size_t end, size_t baseindex, QueryState* state) const -{ - return Array::find(value, start, end, baseindex, state, true /*treat as nullable array*/, - false /*search parameter given in 'value' argument*/); -} - - -template -bool ArrayIntNull::find(value_type value, size_t start, size_t end, size_t baseindex, QueryState* state, - Callback callback) const -{ - if (value) { - return Array::find(*value, start, end, baseindex, state, std::forward(callback), - true /*treat as nullable array*/, - false /*search parameter given in 'value' argument*/); - } - else { - return Array::find(0 /*ignored*/, start, end, baseindex, state, - std::forward(callback), true /*treat as nullable array*/, - true /*search for null, ignore value argument*/); - } -} - - -template -bool ArrayIntNull::find_action(size_t index, value_type value, QueryState* state, Callback callback) const -{ - if (value) { - return Array::find_action(index, *value, state, callback, true /*treat as nullable array*/, - false /*search parameter given in 'value' argument*/); - } - else { - return Array::find_action(index, 0 /* ignored */, state, callback, - true /*treat as nullable array*/, - true /*search for null, ignore value argument*/); - } -} - - -template -bool ArrayIntNull::find_action_pattern(size_t index, uint64_t pattern, QueryState* state, - Callback callback) const -{ - return Array::find_action_pattern(index, pattern, state, callback, - true /*treat as nullable array*/, - false /*search parameter given in 'value' argument*/); -} - - -template -size_t ArrayIntNull::find_first(value_type value, size_t start, size_t end) const -{ - QueryState state; - state.init(act_ReturnFirst, nullptr, 1); - if (value) { - Array::find(*value, start, end, 0, &state, Array::CallbackDummy(), - true /*treat as nullable array*/, - false /*search parameter given in 'value' argument*/); - } - else { - Array::find(0 /*ignored*/, start, end, 0, &state, Array::CallbackDummy(), - true /*treat as nullable array*/, - true /*search for null, ignore value argument*/); - } - - if (state.m_match_count > 0) - return to_size_t(state.m_state); - else - return not_found; -} - -inline size_t ArrayIntNull::find_first(value_type value, size_t begin, size_t end) const -{ - return find_first(value, begin, end); -} -} - -#endif // REALM_ARRAY_INTEGER_HPP diff --git a/Pods/Realm/include/core/realm/array_string.hpp b/Pods/Realm/include/core/realm/array_string.hpp deleted file mode 100644 index bbf32036..00000000 --- a/Pods/Realm/include/core/realm/array_string.hpp +++ /dev/null @@ -1,180 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ARRAY_STRING_HPP -#define REALM_ARRAY_STRING_HPP - -#include - -namespace realm { - -/* -ArrayString stores strings as a concecutive list of fixed-length blocks of m_width bytes. The -longest string it can store is (m_width - 1) bytes before it needs to expand. - -An example of the format for m_width = 4 is following sequence of bytes, where x is payload: - -xxx0 xx01 x002 0003 0004 (strings "xxx",. "xx", "x", "", realm::null()) - -So each string is 0 terminated, and the last byte in a block tells how many 0s are present, except -for a realm::null() which has the byte set to m_width (4). The byte is used to compute the length of a string -in various functions. - -New: If m_witdh = 0, then all elements are realm::null(). So to add an empty string we must expand m_width -New: StringData is null() if-and-only-if StringData::data() == 0. -*/ - -class ArrayString : public Array { -public: - static const size_t max_width = 64; - - typedef StringData value_type; - // Constructor defaults to non-nullable because we use non-nullable ArrayString so many places internally in core - // (data which isn't user payload) where null isn't needed. - explicit ArrayString(Allocator&, bool nullable = false) noexcept; - ~ArrayString() noexcept override - { - } - - bool is_null(size_t ndx) const; - void set_null(size_t ndx); - StringData get(size_t ndx) const noexcept; - void add(); - void add(StringData value); - void set(size_t ndx, StringData value); - void insert(size_t ndx, StringData value); - void erase(size_t ndx); - - size_t count(StringData value, size_t begin = 0, size_t end = npos) const noexcept; - size_t find_first(StringData value, size_t begin = 0, size_t end = npos) const noexcept; - void find_all(IntegerColumn& result, StringData value, size_t add_offset = 0, size_t begin = 0, - size_t end = npos); - - /// Compare two string arrays for equality. - bool compare_string(const ArrayString&) const noexcept; - - /// Get the specified element without the cost of constructing an - /// array instance. If an array instance is already available, or - /// you need to get multiple values, then this method will be - /// slower. - static StringData get(const char* header, size_t ndx, bool nullable) noexcept; - - ref_type bptree_leaf_insert(size_t ndx, StringData, TreeInsertBase& state); - - /// Construct a string array of the specified size and return just - /// the reference to the underlying memory. All elements will be - /// initialized to the empty string. - static MemRef create_array(size_t size, Allocator&); - - /// Create a new empty string array and attach this accessor to - /// it. This does not modify the parent reference information of - /// this accessor. - /// - /// Note that the caller assumes ownership of the allocated - /// underlying node. It is not owned by the accessor. - void create(); - - /// Construct a copy of the specified slice of this string array - /// using the specified target allocator. - MemRef slice(size_t offset, size_t slice_size, Allocator& target_alloc) const; - -#ifdef REALM_DEBUG - void string_stats() const; - void to_dot(std::ostream&, StringData title = StringData()) const; -#endif - -private: - size_t calc_byte_len(size_t num_items, size_t width) const override; - size_t calc_item_count(size_t bytes, size_t width) const noexcept override; - - bool m_nullable; -}; - - -// Implementation: - -// Creates new array (but invalid, call init_from_ref() to init) -inline ArrayString::ArrayString(Allocator& allocator, bool nullable) noexcept - : Array(allocator) - , m_nullable(nullable) -{ -} - -inline void ArrayString::create() -{ - size_t init_size = 0; - MemRef mem = create_array(init_size, get_alloc()); // Throws - init_from_mem(mem); -} - -inline MemRef ArrayString::create_array(size_t init_size, Allocator& allocator) -{ - bool context_flag = false; - int_fast64_t value = 0; - return Array::create(type_Normal, context_flag, wtype_Multiply, init_size, value, allocator); // Throws -} - -inline StringData ArrayString::get(size_t ndx) const noexcept -{ - REALM_ASSERT_3(ndx, <, m_size); - if (m_width == 0) - return m_nullable ? realm::null() : StringData(""); - - const char* data = m_data + (ndx * m_width); - size_t array_size = (m_width - 1) - data[m_width - 1]; - - if (array_size == static_cast(-1)) - return m_nullable ? realm::null() : StringData(""); - - REALM_ASSERT_EX(data[array_size] == 0, data[array_size], - array_size); // Realm guarantees 0 terminated return strings - return StringData(data, array_size); -} - -inline void ArrayString::add(StringData value) -{ - REALM_ASSERT(!(!m_nullable && value.is_null())); - insert(m_size, value); // Throws -} - -inline void ArrayString::add() -{ - add(m_nullable ? realm::null() : StringData("")); // Throws -} - -inline StringData ArrayString::get(const char* header, size_t ndx, bool nullable) noexcept -{ - REALM_ASSERT(ndx < get_size_from_header(header)); - uint_least8_t width = get_width_from_header(header); - const char* data = get_data_from_header(header) + (ndx * width); - - if (width == 0) - return nullable ? realm::null() : StringData(""); - - size_t size = (width - 1) - data[width - 1]; - - if (size == static_cast(-1)) - return nullable ? realm::null() : StringData(""); - - return StringData(data, size); -} - - -} // namespace realm - -#endif // REALM_ARRAY_STRING_HPP diff --git a/Pods/Realm/include/core/realm/array_string_long.hpp b/Pods/Realm/include/core/realm/array_string_long.hpp deleted file mode 100644 index af9911e2..00000000 --- a/Pods/Realm/include/core/realm/array_string_long.hpp +++ /dev/null @@ -1,224 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ARRAY_STRING_LONG_HPP -#define REALM_ARRAY_STRING_LONG_HPP - -#include -#include - -namespace realm { - - -class ArrayStringLong : public Array { -public: - typedef StringData value_type; - - explicit ArrayStringLong(Allocator&, bool nullable) noexcept; - ~ArrayStringLong() noexcept override - { - } - - /// Create a new empty long string array and attach this accessor to - /// it. This does not modify the parent reference information of - /// this accessor. - /// - /// Note that the caller assumes ownership of the allocated - /// underlying node. It is not owned by the accessor. - void create(); - - //@{ - /// Overriding functions of Array - void init_from_ref(ref_type) noexcept; - void init_from_mem(MemRef) noexcept; - void init_from_parent() noexcept; - //@} - - bool is_empty() const noexcept; - size_t size() const noexcept; - - StringData get(size_t ndx) const noexcept; - - - void add(StringData value); - void set(size_t ndx, StringData value); - void insert(size_t ndx, StringData value); - void erase(size_t ndx); - void truncate(size_t size); - void clear(); - void destroy(); - - bool is_null(size_t ndx) const; - void set_null(size_t ndx); - - size_t count(StringData value, size_t begin = 0, size_t end = npos) const noexcept; - size_t find_first(StringData value, size_t begin = 0, size_t end = npos) const noexcept; - void find_all(IntegerColumn& result, StringData value, size_t add_offset = 0, size_t begin = 0, - size_t end = npos) const; - - /// Get the specified element without the cost of constructing an - /// array instance. If an array instance is already available, or - /// you need to get multiple values, then this method will be - /// slower. - static StringData get(const char* header, size_t ndx, Allocator&, bool nullable) noexcept; - - ref_type bptree_leaf_insert(size_t ndx, StringData, TreeInsertBase&); - - static size_t get_size_from_header(const char*, Allocator&) noexcept; - - /// Construct a long string array of the specified size and return - /// just the reference to the underlying memory. All elements will - /// be initialized to zero size blobs. - static MemRef create_array(size_t size, Allocator&, bool nullable); - - /// Construct a copy of the specified slice of this long string - /// array using the specified target allocator. - MemRef slice(size_t offset, size_t slice_size, Allocator& target_alloc) const; - -#ifdef REALM_DEBUG - void to_dot(std::ostream&, StringData title = StringData()) const; -#endif - - bool update_from_parent(size_t old_baseline) noexcept; - -private: - ArrayInteger m_offsets; - ArrayBlob m_blob; - Array m_nulls; - bool m_nullable; -}; - - -// Implementation: -inline ArrayStringLong::ArrayStringLong(Allocator& allocator, bool nullable) noexcept - : Array(allocator) - , m_offsets(allocator) - , m_blob(allocator) - , m_nulls(nullable ? allocator : Allocator::get_default()) - , m_nullable(nullable) -{ - m_offsets.set_parent(this, 0); - m_blob.set_parent(this, 1); - if (nullable) - m_nulls.set_parent(this, 2); -} - -inline void ArrayStringLong::create() -{ - size_t init_size = 0; - MemRef mem = create_array(init_size, get_alloc(), m_nullable); // Throws - init_from_mem(mem); -} - -inline void ArrayStringLong::init_from_ref(ref_type ref) noexcept -{ - REALM_ASSERT(ref); - char* header = get_alloc().translate(ref); - init_from_mem(MemRef(header, ref, m_alloc)); - m_nullable = (Array::size() == 3); -} - -inline void ArrayStringLong::init_from_parent() noexcept -{ - ref_type ref = get_ref_from_parent(); - init_from_ref(ref); -} - -inline bool ArrayStringLong::is_empty() const noexcept -{ - return m_offsets.is_empty(); -} - -inline size_t ArrayStringLong::size() const noexcept -{ - return m_offsets.size(); -} - -inline StringData ArrayStringLong::get(size_t ndx) const noexcept -{ - REALM_ASSERT_3(ndx, <, m_offsets.size()); - - if (m_nullable && m_nulls.get(ndx) == 0) - return realm::null(); - - size_t begin, end; - if (0 < ndx) { - begin = to_size_t(m_offsets.get(ndx - 1)); - end = to_size_t(m_offsets.get(ndx)); - } - else { - begin = 0; - end = to_size_t(m_offsets.get(0)); - } - --end; // Discount the terminating zero - - return StringData(m_blob.get(begin), end - begin); -} - -inline void ArrayStringLong::truncate(size_t new_size) -{ - REALM_ASSERT_3(new_size, <, m_offsets.size()); - - size_t blob_size = new_size ? to_size_t(m_offsets.get(new_size - 1)) : 0; - - m_offsets.truncate(new_size); - m_blob.truncate(blob_size); - if (m_nullable) - m_nulls.truncate(new_size); -} - -inline void ArrayStringLong::clear() -{ - m_blob.clear(); - m_offsets.clear(); - if (m_nullable) - m_nulls.clear(); -} - -inline void ArrayStringLong::destroy() -{ - m_blob.destroy(); - m_offsets.destroy(); - if (m_nullable) - m_nulls.destroy(); - Array::destroy(); -} - -inline bool ArrayStringLong::update_from_parent(size_t old_baseline) noexcept -{ - bool res = Array::update_from_parent(old_baseline); - if (res) { - m_blob.update_from_parent(old_baseline); - m_offsets.update_from_parent(old_baseline); - if (m_nullable) - m_nulls.update_from_parent(old_baseline); - } - return res; -} - -inline size_t ArrayStringLong::get_size_from_header(const char* header, Allocator& alloc) noexcept -{ - ref_type offsets_ref = to_ref(Array::get(header, 0)); - const char* offsets_header = alloc.translate(offsets_ref); - return Array::get_size_from_header(offsets_header); -} - - -} // namespace realm - -#endif // REALM_ARRAY_STRING_LONG_HPP diff --git a/Pods/Realm/include/core/realm/binary_data.hpp b/Pods/Realm/include/core/realm/binary_data.hpp deleted file mode 100644 index cc1c2837..00000000 --- a/Pods/Realm/include/core/realm/binary_data.hpp +++ /dev/null @@ -1,235 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_BINARY_DATA_HPP -#define REALM_BINARY_DATA_HPP - -#include -#include -#include -#include - -#include -#include -#include - -namespace realm { - -/// A reference to a chunk of binary data. -/// -/// This class does not own the referenced memory, nor does it in any other way -/// attempt to manage the lifetime of it. -/// -/// \sa StringData -class BinaryData { -public: - BinaryData() noexcept - : m_data(nullptr) - , m_size(0) - { - } - BinaryData(const char* external_data, size_t data_size) noexcept - : m_data(external_data) - , m_size(data_size) - { - } - template - explicit BinaryData(const char (&external_data)[N]) - : m_data(external_data) - , m_size(N) - { - } - template - explicit BinaryData(const std::basic_string&); - - template - explicit operator std::basic_string() const; - - char operator[](size_t i) const noexcept - { - return m_data[i]; - } - - const char* data() const noexcept - { - return m_data; - } - size_t size() const noexcept - { - return m_size; - } - - /// Is this a null reference? - /// - /// An instance of BinaryData is a null reference when, and only when the - /// stored size is zero (size()) and the stored pointer is the null pointer - /// (data()). - /// - /// In the case of the empty byte sequence, the stored size is still zero, - /// but the stored pointer is **not** the null pointer. Note that the actual - /// value of the pointer is immaterial in this case (as long as it is not - /// zero), because when the size is zero, it is an error to dereference the - /// pointer. - /// - /// Conversion of a BinaryData object to `bool` yields the logical negation - /// of the result of calling this function. In other words, a BinaryData - /// object is converted to true if it is not the null reference, otherwise - /// it is converted to false. - /// - /// It is important to understand that all of the functions and operators in - /// this class, and most of the functions in the Realm API in general - /// makes no distinction between a null reference and a reference to the - /// empty byte sequence. These functions and operators never look at the - /// stored pointer if the stored size is zero. - bool is_null() const noexcept; - - friend bool operator==(const BinaryData&, const BinaryData&) noexcept; - friend bool operator!=(const BinaryData&, const BinaryData&) noexcept; - - //@{ - /// Trivial bytewise lexicographical comparison. - friend bool operator<(const BinaryData&, const BinaryData&) noexcept; - friend bool operator>(const BinaryData&, const BinaryData&) noexcept; - friend bool operator<=(const BinaryData&, const BinaryData&) noexcept; - friend bool operator>=(const BinaryData&, const BinaryData&) noexcept; - //@} - - bool begins_with(BinaryData) const noexcept; - bool ends_with(BinaryData) const noexcept; - bool contains(BinaryData) const noexcept; - - template - friend std::basic_ostream& operator<<(std::basic_ostream&, const BinaryData&); - - explicit operator bool() const noexcept; - -private: - const char* m_data; - size_t m_size; -}; - -/// A read-only chunk of binary data. -class OwnedBinaryData : public OwnedData { -public: - using OwnedData::OwnedData; - - OwnedBinaryData() = default; - OwnedBinaryData(const BinaryData& binary_data) - : OwnedData(binary_data.data(), binary_data.size()) - { - } - - BinaryData get() const - { - return {data(), size()}; - } -}; - - -// Implementation: - -template -inline BinaryData::BinaryData(const std::basic_string& s) - : m_data(s.data()) - , m_size(s.size()) -{ -} - -template -inline BinaryData::operator std::basic_string() const -{ - return std::basic_string(m_data, m_size); -} - -inline bool BinaryData::is_null() const noexcept -{ - return !m_data; -} - -inline bool operator==(const BinaryData& a, const BinaryData& b) noexcept -{ - return a.m_size == b.m_size && a.is_null() == b.is_null() && safe_equal(a.m_data, a.m_data + a.m_size, b.m_data); -} - -inline bool operator!=(const BinaryData& a, const BinaryData& b) noexcept -{ - return !(a == b); -} - -inline bool operator<(const BinaryData& a, const BinaryData& b) noexcept -{ - if (a.is_null() || b.is_null()) - return !a.is_null() < !b.is_null(); - - return std::lexicographical_compare(a.m_data, a.m_data + a.m_size, b.m_data, b.m_data + b.m_size); -} - -inline bool operator>(const BinaryData& a, const BinaryData& b) noexcept -{ - return b < a; -} - -inline bool operator<=(const BinaryData& a, const BinaryData& b) noexcept -{ - return !(b < a); -} - -inline bool operator>=(const BinaryData& a, const BinaryData& b) noexcept -{ - return !(a < b); -} - -inline bool BinaryData::begins_with(BinaryData d) const noexcept -{ - if (is_null() && !d.is_null()) - return false; - - return d.m_size <= m_size && safe_equal(m_data, m_data + d.m_size, d.m_data); -} - -inline bool BinaryData::ends_with(BinaryData d) const noexcept -{ - if (is_null() && !d.is_null()) - return false; - - return d.m_size <= m_size && safe_equal(m_data + m_size - d.m_size, m_data + m_size, d.m_data); -} - -inline bool BinaryData::contains(BinaryData d) const noexcept -{ - if (is_null() && !d.is_null()) - return false; - - return d.m_size == 0 || std::search(m_data, m_data + m_size, d.m_data, d.m_data + d.m_size) != m_data + m_size; -} - -template -inline std::basic_ostream& operator<<(std::basic_ostream& out, const BinaryData& d) -{ - out << "BinaryData(" << static_cast(d.m_data) << ", " << d.m_size << ")"; - return out; -} - -inline BinaryData::operator bool() const noexcept -{ - return !is_null(); -} - -} // namespace realm - -#endif // REALM_BINARY_DATA_HPP diff --git a/Pods/Realm/include/core/realm/bptree.hpp b/Pods/Realm/include/core/realm/bptree.hpp deleted file mode 100644 index 29dc8e84..00000000 --- a/Pods/Realm/include/core/realm/bptree.hpp +++ /dev/null @@ -1,1262 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_BPTREE_HPP -#define REALM_BPTREE_HPP - -#include // std::unique_ptr -#include -#include -#include -#include -#include - -namespace realm { - -/// Specialize BpTree to implement column types. -template -class BpTree; - -class ArrayInteger; -class ArrayIntNull; - -class BpTreeNode : public Array { -public: - using Array::Array; - /// Get the number of elements in the B+-tree rooted at this array - /// node. The root must not be a leaf. - /// - /// Please avoid using this function (consider it deprecated). It - /// will have to be removed if we choose to get rid of the last - /// element of the main array of an inner B+-tree node that stores - /// the total number of elements in the subtree. The motivation - /// for removing it, is that it will significantly improve the - /// efficiency when inserting after, and erasing the last element. - size_t get_bptree_size() const noexcept; - - /// The root must not be a leaf. - static size_t get_bptree_size_from_header(const char* root_header) noexcept; - - - /// Find the leaf node corresponding to the specified element - /// index index. The specified element index must refer to an - /// element that exists in the tree. This function must be called - /// on an inner B+-tree node, never a leaf. Note that according to - /// invar:bptree-nonempty-inner and invar:bptree-nonempty-leaf, an - /// inner B+-tree node can never be empty. - /// - /// This function is not obliged to instantiate intermediate array - /// accessors. For this reason, this function cannot be used for - /// operations that modify the tree, as that requires an unbroken - /// chain of parent array accessors between the root and the - /// leaf. Thus, despite the fact that the returned MemRef object - /// appears to allow modification of the referenced memory, the - /// caller must handle the memory reference as if it was - /// const-qualified. - /// - /// \return (`leaf_header`, `ndx_in_leaf`) where `leaf_header` - /// points to the the header of the located leaf, and - /// `ndx_in_leaf` is the local index within that leaf - /// corresponding to the specified element index. - std::pair get_bptree_leaf(size_t elem_ndx) const noexcept; - - - class NodeInfo; - class VisitHandler; - - /// Visit leaves of the B+-tree rooted at this inner node, - /// starting with the leaf that contains the element at the - /// specified element index start offset, and ending when the - /// handler returns false. The specified element index offset must - /// refer to an element that exists in the tree. This function - /// must be called on an inner B+-tree node, never a leaf. Note - /// that according to invar:bptree-nonempty-inner and - /// invar:bptree-nonempty-leaf, an inner B+-tree node can never be - /// empty. - /// - /// \param elem_ndx_offset The start position (must be valid). - /// - /// \param elems_in_tree The total number of elements in the tree. - /// - /// \param handler The callback which will get called for each leaf. - /// - /// \return True if, and only if the handler has returned true for - /// all visited leafs. - bool visit_bptree_leaves(size_t elem_ndx_offset, size_t elems_in_tree, VisitHandler& handler); - - - class UpdateHandler; - - /// Call the handler for every leaf. This function must be called - /// on an inner B+-tree node, never a leaf. - void update_bptree_leaves(UpdateHandler&); - - /// Call the handler for the leaf that contains the element at the - /// specified index. This function must be called on an inner - /// B+-tree node, never a leaf. - void update_bptree_elem(size_t elem_ndx, UpdateHandler&); - - - class EraseHandler; - - /// Erase the element at the specified index in the B+-tree with - /// the specified root. When erasing the last element, you must - /// pass npos in place of the index. This function must be called - /// with a root that is an inner B+-tree node, never a leaf. - /// - /// This function is guaranteed to succeed (not throw) if the - /// specified element was inserted during the current transaction, - /// and no other modifying operation has been carried out since - /// then (noexcept:bptree-erase-alt). - /// - /// FIXME: ExceptionSafety: The exception guarantee explained - /// above is not as powerfull as we would like it to be. Here is - /// what we would like: This function is guaranteed to succeed - /// (not throw) if the specified element was inserted during the - /// current transaction (noexcept:bptree-erase). This must be true - /// even if the element is modified after insertion, and/or if - /// other elements are inserted or erased around it. There are two - /// aspects of the current design that stand in the way of this - /// guarantee: (A) The fact that the node accessor, that is cached - /// in the column accessor, has to be reallocated/reinstantiated - /// when the root switches between being a leaf and an inner - /// node. This problem would go away if we always cached the last - /// used leaf accessor in the column accessor instead. (B) The - /// fact that replacing one child ref with another can fail, - /// because it may require reallocation of memory to expand the - /// bit-width. This can be fixed in two ways: Either have the - /// inner B+-tree nodes always have a bit-width of 64, or allow - /// the root node to be discarded and the column ref to be set to - /// zero in Table::m_columns. - static void erase_bptree_elem(BpTreeNode* root, size_t elem_ndx, EraseHandler&); - - template - struct TreeInsert : TreeInsertBase { - typename TreeTraits::value_type m_value; - bool m_nullable; - }; - - /// Same as bptree_insert() but insert after the last element. - template - ref_type bptree_append(TreeInsert& state); - - /// Insert an element into the B+-subtree rooted at this array - /// node. The element is inserted before the specified element - /// index. This function must be called on an inner B+-tree node, - /// never a leaf. If this inner node had to be split, this - /// function returns the `ref` of the new sibling. - template - ref_type bptree_insert(size_t elem_ndx, TreeInsert& state); - -protected: - /// Insert a new child after original. If the parent has to be - /// split, this function returns the `ref` of the new parent node. - ref_type insert_bptree_child(Array& offsets, size_t orig_child_ndx, ref_type new_sibling_ref, - TreeInsertBase& state); - - void ensure_bptree_offsets(Array& offsets); - void create_bptree_offsets(Array& offsets, int_fast64_t first_value); - - bool do_erase_bptree_elem(size_t elem_ndx, EraseHandler&); -}; - -class BpTreeBase { -public: - struct unattached_tag { - }; - - // Accessor concept: - Allocator& get_alloc() const noexcept; - void destroy() noexcept; - void detach(); - bool is_attached() const noexcept; - void set_parent(ArrayParent* parent, size_t ndx_in_parent) noexcept; - size_t get_ndx_in_parent() const noexcept; - void set_ndx_in_parent(size_t ndx) noexcept; - void update_from_parent(size_t old_baseline) noexcept; - MemRef clone_deep(Allocator& alloc) const; - - // BpTree interface: - const Array& root() const noexcept; - Array& root() noexcept; - bool root_is_leaf() const noexcept; - BpTreeNode& root_as_node(); - const BpTreeNode& root_as_node() const; - void introduce_new_root(ref_type new_sibling_ref, TreeInsertBase& state, bool is_append); - void replace_root(std::unique_ptr leaf); - -protected: - explicit BpTreeBase(std::unique_ptr root); - explicit BpTreeBase(BpTreeBase&&) = default; - BpTreeBase& operator=(BpTreeBase&&) = default; - std::unique_ptr m_root; - - struct SliceHandler { - virtual MemRef slice_leaf(MemRef leaf_mem, size_t offset, size_t size, Allocator& target_alloc) = 0; - ~SliceHandler() noexcept - { - } - }; - static ref_type write_subtree(const BpTreeNode& root, size_t slice_offset, size_t slice_size, size_t table_size, - SliceHandler&, _impl::OutputStream&); - friend class ColumnBase; - friend class ColumnBaseSimple; - -private: - struct WriteSliceHandler; - - // FIXME: Move B+Tree functionality from Array to this class. -}; - - -// Default implementation of BpTree. This should work for all types that have monomorphic -// leaves (i.e. all leaves are of the same type). -template -class BpTree : public BpTreeBase { -public: - using value_type = T; - using LeafType = typename ColumnTypeTraits::leaf_type; - - /// LeafInfo is used by get_leaf() to provide access to a leaf - /// without instantiating unnecessary nodes along the way. - /// Upon return, out_leaf with hold a pointer to the leaf containing - /// the index given to get_leaf(). If the index happens to be - /// in the root node (i.e., the root is a leaf), it will point - /// to the root node. - /// If the index isn't in the root node, fallback will be initialized - /// to represent the leaf holding the node, and out_leaf will be set - /// to point to fallback. - struct LeafInfo { - const LeafType** out_leaf; - LeafType* fallback; - }; - - BpTree(); - explicit BpTree(BpTreeBase::unattached_tag); - explicit BpTree(Allocator& alloc); - REALM_DEPRECATED("Initialize with MemRef instead") - explicit BpTree(std::unique_ptr init_root) - : BpTreeBase(std::move(init_root)) - { - } - explicit BpTree(Allocator& alloc, MemRef mem) - : BpTreeBase(std::unique_ptr(new LeafType(alloc))) - { - init_from_mem(alloc, mem); - } - BpTree(BpTree&&) = default; - BpTree& operator=(BpTree&&) = default; - void init_from_ref(Allocator& alloc, ref_type ref); - void init_from_mem(Allocator& alloc, MemRef mem); - void init_from_parent(); - - size_t size() const noexcept; - bool is_empty() const noexcept - { - return size() == 0; - } - - T get(size_t ndx) const noexcept; - bool is_null(size_t ndx) const noexcept; - void set(size_t, T value); - void set_null(size_t); - void insert(size_t ndx, T value, size_t num_rows = 1); - void erase(size_t ndx, bool is_last = false); - void move_last_over(size_t ndx, size_t last_row_ndx); - void clear(); - T front() const noexcept; - T back() const noexcept; - - size_t find_first(T value, size_t begin = 0, size_t end = npos) const; - void find_all(IntegerColumn& out_indices, T value, size_t begin = 0, size_t end = npos) const; - - static MemRef create_leaf(Array::Type leaf_type, size_t size, T value, Allocator&); - - /// See LeafInfo for information about what to put in the inout_leaf - /// parameter. - /// - /// This function cannot be used for modifying operations as it - /// does not ensure the presence of an unbroken chain of parent - /// accessors. For this reason, the identified leaf should always - /// be accessed through the returned const-qualified reference, - /// and never directly through the specfied fallback accessor. - void get_leaf(size_t ndx, size_t& out_ndx_in_leaf, LeafInfo& inout_leaf) const noexcept; - - void update_each(BpTreeNode::UpdateHandler&); - void update_elem(size_t, BpTreeNode::UpdateHandler&); - - void adjust(size_t ndx, T diff); - void adjust(T diff); - void adjust_ge(T limit, T diff); - - ref_type write(size_t slice_offset, size_t slice_size, size_t table_size, _impl::OutputStream& out) const; - -#if defined(REALM_DEBUG) - void verify() const; - static size_t verify_leaf(MemRef mem, Allocator& alloc); -#endif - static void leaf_to_dot(MemRef mem, ArrayParent* parent, size_t ndx_in_parent, std::ostream& out, - Allocator& alloc); - -private: - LeafType& root_as_leaf(); - const LeafType& root_as_leaf() const; - - std::unique_ptr create_root_from_ref(Allocator& alloc, ref_type ref); - std::unique_ptr create_root_from_mem(Allocator& alloc, MemRef mem); - - struct EraseHandler; - struct UpdateHandler; - struct SetNullHandler; - struct SliceHandler; - struct AdjustHandler; - struct AdjustGEHandler; - - struct LeafValueInserter; - struct LeafNullInserter; - - template - void bptree_insert(size_t row_ndx, BpTreeNode::TreeInsert& state, size_t num_rows); -}; - - -class BpTreeNode::NodeInfo { -public: - MemRef m_mem; - Array* m_parent; - size_t m_ndx_in_parent; - size_t m_offset, m_size; -}; - -class BpTreeNode::VisitHandler { -public: - virtual bool visit(const NodeInfo& leaf_info) = 0; - virtual ~VisitHandler() noexcept - { - } -}; - - -class BpTreeNode::UpdateHandler { -public: - virtual void update(MemRef, ArrayParent*, size_t leaf_ndx_in_parent, size_t elem_ndx_in_leaf) = 0; - virtual ~UpdateHandler() noexcept - { - } -}; - - -class BpTreeNode::EraseHandler { -public: - /// If the specified leaf has more than one element, this function - /// must erase the specified element from the leaf and return - /// false. Otherwise, when the leaf has a single element, this - /// function must return true without modifying the leaf. If \a - /// elem_ndx_in_leaf is `npos`, it refers to the last element in - /// the leaf. The implementation of this function must be - /// exception safe. This function is guaranteed to be called at - /// most once during each execution of Array::erase_bptree_elem(), - /// and *exactly* once during each *successful* execution of - /// Array::erase_bptree_elem(). - virtual bool erase_leaf_elem(MemRef, ArrayParent*, size_t leaf_ndx_in_parent, size_t elem_ndx_in_leaf) = 0; - - virtual void destroy_leaf(MemRef leaf_mem) noexcept = 0; - - /// Must replace the current root with the specified leaf. The - /// implementation of this function must not destroy the - /// underlying root node, or any of its children, as that will be - /// done by Array::erase_bptree_elem(). The implementation of this - /// function must be exception safe. - virtual void replace_root_by_leaf(MemRef leaf_mem) = 0; - - /// Same as replace_root_by_leaf(), but must replace the root with - /// an empty leaf. Also, if this function is called during an - /// execution of Array::erase_bptree_elem(), it is guaranteed that - /// it will be preceeded by a call to erase_leaf_elem(). - virtual void replace_root_by_empty_leaf() = 0; - - virtual ~EraseHandler() noexcept - { - } -}; - - -/// Implementation: - -inline BpTreeBase::BpTreeBase(std::unique_ptr init_root) - : m_root(std::move(init_root)) -{ -} - -inline Allocator& BpTreeBase::get_alloc() const noexcept -{ - return m_root->get_alloc(); -} - -inline void BpTreeBase::destroy() noexcept -{ - if (m_root) - m_root->destroy_deep(); -} - -inline void BpTreeBase::detach() -{ - m_root->detach(); -} - -inline bool BpTreeBase::is_attached() const noexcept -{ - return m_root->is_attached(); -} - -inline bool BpTreeBase::root_is_leaf() const noexcept -{ - return !m_root->is_inner_bptree_node(); -} - -inline BpTreeNode& BpTreeBase::root_as_node() -{ - REALM_ASSERT_DEBUG(!root_is_leaf()); - REALM_ASSERT_DEBUG(dynamic_cast(m_root.get()) != nullptr); - return static_cast(root()); -} - -inline const BpTreeNode& BpTreeBase::root_as_node() const -{ - Array* arr = m_root.get(); - REALM_ASSERT_DEBUG(!root_is_leaf()); - REALM_ASSERT_DEBUG(dynamic_cast(arr) != nullptr); - return static_cast(*arr); -} - -inline void BpTreeBase::set_parent(ArrayParent* parent, size_t ndx_in_parent) noexcept -{ - m_root->set_parent(parent, ndx_in_parent); -} - -inline size_t BpTreeBase::get_ndx_in_parent() const noexcept -{ - return m_root->get_ndx_in_parent(); -} - -inline void BpTreeBase::set_ndx_in_parent(size_t ndx) noexcept -{ - m_root->set_ndx_in_parent(ndx); -} - -inline void BpTreeBase::update_from_parent(size_t old_baseline) noexcept -{ - m_root->update_from_parent(old_baseline); -} - -inline MemRef BpTreeBase::clone_deep(Allocator& alloc) const -{ - return m_root->clone_deep(alloc); -} - -inline const Array& BpTreeBase::root() const noexcept -{ - return *m_root; -} - -inline Array& BpTreeBase::root() noexcept -{ - return *m_root; -} - -inline size_t BpTreeNode::get_bptree_size() const noexcept -{ - REALM_ASSERT_DEBUG(is_inner_bptree_node()); - int_fast64_t v = back(); - return size_t(v / 2); // v = 1 + 2*total_elems_in_tree -} - -inline size_t BpTreeNode::get_bptree_size_from_header(const char* root_header) noexcept -{ - REALM_ASSERT_DEBUG(get_is_inner_bptree_node_from_header(root_header)); - size_t root_size = get_size_from_header(root_header); - int_fast64_t v = get(root_header, root_size - 1); - return size_t(v / 2); // v = 1 + 2*total_elems_in_tree -} - -inline void BpTreeNode::ensure_bptree_offsets(Array& offsets) -{ - int_fast64_t first_value = get(0); - if (first_value % 2 == 0) { - offsets.init_from_ref(to_ref(first_value)); - } - else { - create_bptree_offsets(offsets, first_value); // Throws - } - offsets.set_parent(this, 0); -} - - -template -ref_type BpTreeNode::bptree_append(TreeInsert& state) -{ - // FIXME: Consider exception safety. Especially, how can the split - // be carried out in an exception safe manner? - // - // Can split be done as a separate preparation step, such that if - // the actual insert fails, the split will still have occured. - // - // Unfortunately, it requires a rather significant rearrangement - // of the insertion flow. Instead of returning the sibling ref - // from insert functions, the leaf-insert functions must instead - // call the special bptree_insert() function on the parent, which - // will then cascade the split towards the root as required. - // - // At each level where a split is required (starting at the leaf): - // - // 1. Create the new sibling. - // - // 2. Copy relevant entries over such that new sibling is in - // its final state. - // - // 3. Call Array::bptree_insert() on parent with sibling ref. - // - // 4. Rearrange entries in original sibling and truncate as - // required (must not throw). - // - // What about the 'offsets' array? It will always be - // present. Consider this carefully. - - REALM_ASSERT_DEBUG(size() >= 1 + 1 + 1); // At least one child - - ArrayParent& childs_parent = *this; - size_t child_ref_ndx = size() - 2; - ref_type child_ref = get_as_ref(child_ref_ndx), new_sibling_ref; - char* child_header = static_cast(m_alloc.translate(child_ref)); - - bool child_is_leaf = !get_is_inner_bptree_node_from_header(child_header); - if (child_is_leaf) { - size_t elem_ndx_in_child = npos; // Append - new_sibling_ref = TreeTraits::leaf_insert(MemRef(child_header, child_ref, m_alloc), childs_parent, - child_ref_ndx, m_alloc, elem_ndx_in_child, state); // Throws - } - else { - BpTreeNode child(m_alloc); - child.init_from_mem(MemRef(child_header, child_ref, m_alloc)); - child.set_parent(&childs_parent, child_ref_ndx); - new_sibling_ref = child.bptree_append(state); // Throws - } - - if (REALM_LIKELY(!new_sibling_ref)) { - // +2 because stored value is 1 + 2*total_elems_in_subtree - adjust(size() - 1, +2); // Throws - return 0; // Child was not split, so parent was not split either - } - - Array offsets(m_alloc); - int_fast64_t first_value = get(0); - if (first_value % 2 == 0) { - // Offsets array is present (general form) - offsets.init_from_ref(to_ref(first_value)); - offsets.set_parent(this, 0); - } - size_t child_ndx = child_ref_ndx - 1; - return insert_bptree_child(offsets, child_ndx, new_sibling_ref, state); // Throws -} - - -template -ref_type BpTreeNode::bptree_insert(size_t elem_ndx, TreeInsert& state) -{ - REALM_ASSERT_3(size(), >=, 1 + 1 + 1); // At least one child - - // Conversion to general form if in compact form. Since this - // conversion will occur from root to leaf, it will maintain - // invar:bptree-node-form. - Array offsets(m_alloc); - ensure_bptree_offsets(offsets); // Throws - - size_t child_ndx, elem_ndx_in_child; - if (elem_ndx == 0) { - // Optimization for prepend - child_ndx = 0; - elem_ndx_in_child = 0; - } - else { - // There is a choice to be made when the element is to be - // inserted between two subtrees. It can either be appended to - // the first subtree, or it can be prepended to the second - // one. We currently always append to the first subtree. It is - // essentially a matter of using the lower vs. the upper bound - // when searching through the offsets array. - child_ndx = offsets.lower_bound_int(elem_ndx); - REALM_ASSERT_3(child_ndx, <, size() - 2); - size_t elem_ndx_offset = child_ndx == 0 ? 0 : to_size_t(offsets.get(child_ndx - 1)); - elem_ndx_in_child = elem_ndx - elem_ndx_offset; - } - - ArrayParent& childs_parent = *this; - size_t child_ref_ndx = child_ndx + 1; - ref_type child_ref = get_as_ref(child_ref_ndx), new_sibling_ref; - char* child_header = static_cast(m_alloc.translate(child_ref)); - bool child_is_leaf = !get_is_inner_bptree_node_from_header(child_header); - if (child_is_leaf) { - REALM_ASSERT_3(elem_ndx_in_child, <=, REALM_MAX_BPNODE_SIZE); - new_sibling_ref = TreeTraits::leaf_insert(MemRef(child_header, child_ref, m_alloc), childs_parent, - child_ref_ndx, m_alloc, elem_ndx_in_child, state); // Throws - } - else { - BpTreeNode child(m_alloc); - child.init_from_mem(MemRef(child_header, child_ref, m_alloc)); - child.set_parent(&childs_parent, child_ref_ndx); - new_sibling_ref = child.bptree_insert(elem_ndx_in_child, state); // Throws - } - - if (REALM_LIKELY(!new_sibling_ref)) { - // +2 because stored value is 1 + 2*total_elems_in_subtree - adjust(size() - 1, +2); // Throws - offsets.adjust(child_ndx, offsets.size(), +1); - return 0; // Child was not split, so parent was not split either - } - - return insert_bptree_child(offsets, child_ndx, new_sibling_ref, state); // Throws -} - -template -BpTree::BpTree() - : BpTree(Allocator::get_default()) -{ -} - -template -BpTree::BpTree(Allocator& alloc) - : BpTreeBase(std::unique_ptr(new LeafType(alloc))) -{ -} - -template -BpTree::BpTree(BpTreeBase::unattached_tag) - : BpTreeBase(nullptr) -{ -} - -template -std::unique_ptr BpTree::create_root_from_mem(Allocator& alloc, MemRef mem) -{ - const char* header = mem.get_addr(); - std::unique_ptr new_root; - bool is_inner_bptree_node = Array::get_is_inner_bptree_node_from_header(header); - - bool can_reuse_root_accessor = - m_root && &m_root->get_alloc() == &alloc && m_root->is_inner_bptree_node() == is_inner_bptree_node; - if (can_reuse_root_accessor) { - if (is_inner_bptree_node) { - m_root->init_from_mem(mem); - } - else { - static_cast(*m_root).init_from_mem(mem); - } - return std::move(m_root); // Same root will be reinstalled. - } - - // Not reusing root note, allocating a new one. - if (is_inner_bptree_node) { - new_root.reset(new BpTreeNode{alloc}); - new_root->init_from_mem(mem); - } - else { - std::unique_ptr leaf{new LeafType{alloc}}; - leaf->init_from_mem(mem); - new_root = std::move(leaf); - } - return new_root; -} - -template -std::unique_ptr BpTree::create_root_from_ref(Allocator& alloc, ref_type ref) -{ - MemRef mem = MemRef{alloc.translate(ref), ref, alloc}; - return create_root_from_mem(alloc, mem); -} - -template -void BpTree::init_from_ref(Allocator& alloc, ref_type ref) -{ - auto new_root = create_root_from_ref(alloc, ref); - replace_root(std::move(new_root)); -} - -template -void BpTree::init_from_mem(Allocator& alloc, MemRef mem) -{ - auto new_root = create_root_from_mem(alloc, mem); - replace_root(std::move(new_root)); -} - -template -void BpTree::init_from_parent() -{ - ref_type ref = root().get_ref_from_parent(); - if (ref) { - ArrayParent* parent = m_root->get_parent(); - size_t ndx_in_parent = m_root->get_ndx_in_parent(); - auto new_root = create_root_from_ref(get_alloc(), ref); - new_root->set_parent(parent, ndx_in_parent); - m_root = std::move(new_root); - } - else { - m_root->detach(); - } -} - -template -typename BpTree::LeafType& BpTree::root_as_leaf() -{ - REALM_ASSERT_DEBUG(root_is_leaf()); - REALM_ASSERT_DEBUG(dynamic_cast(m_root.get()) != nullptr); - return static_cast(root()); -} - -template -const typename BpTree::LeafType& BpTree::root_as_leaf() const -{ - REALM_ASSERT_DEBUG(root_is_leaf()); - REALM_ASSERT_DEBUG(dynamic_cast(m_root.get()) != nullptr); - return static_cast(root()); -} - -template -size_t BpTree::size() const noexcept -{ - if (root_is_leaf()) { - return root_as_leaf().size(); - } - return root_as_node().get_bptree_size(); -} - -template -T BpTree::back() const noexcept -{ - // FIXME: slow - return get(size() - 1); -} - -namespace _impl { - -// NullableOrNothing encapsulates the behavior of nullable and -// non-nullable leaf types, so that non-nullable leaf types -// don't have to implement is_null/set_null but BpTree can still -// support the interface (and return false / assert when null -// is not supported). -template -struct NullableOrNothing { - static bool is_null(const Leaf& leaf, size_t ndx) - { - return leaf.is_null(ndx); - } - static void set_null(Leaf& leaf, size_t ndx) - { - leaf.set_null(ndx); - } -}; -template <> -struct NullableOrNothing { - static bool is_null(const ArrayInteger&, size_t) - { - return false; - } - static void set_null(ArrayInteger&, size_t) - { - REALM_ASSERT_RELEASE(false); - } -}; -} - -template -bool BpTree::is_null(size_t ndx) const noexcept -{ - if (root_is_leaf()) { - return _impl::NullableOrNothing::is_null(root_as_leaf(), ndx); - } - LeafType fallback(get_alloc()); - const LeafType* leaf; - LeafInfo leaf_info{&leaf, &fallback}; - size_t ndx_in_leaf; - get_leaf(ndx, ndx_in_leaf, leaf_info); - return _impl::NullableOrNothing::is_null(*leaf, ndx_in_leaf); -} - -template -T BpTree::get(size_t ndx) const noexcept -{ - REALM_ASSERT_DEBUG_EX(ndx < size(), ndx, size()); - if (root_is_leaf()) { - return root_as_leaf().get(ndx); - } - - // Use direct getter to avoid initializing leaf array: - std::pair p = root_as_node().get_bptree_leaf(ndx); - const char* leaf_header = p.first.get_addr(); - size_t ndx_in_leaf = p.second; - return LeafType::get(leaf_header, ndx_in_leaf); -} - -template -template -void BpTree::bptree_insert(size_t row_ndx, BpTreeNode::TreeInsert& state, size_t num_rows) -{ - ref_type new_sibling_ref; - for (size_t i = 0; i < num_rows; ++i) { - size_t row_ndx_2 = row_ndx == realm::npos ? realm::npos : row_ndx + i; - if (root_is_leaf()) { - REALM_ASSERT_DEBUG(row_ndx_2 == realm::npos || row_ndx_2 < REALM_MAX_BPNODE_SIZE); - new_sibling_ref = root_as_leaf().bptree_leaf_insert(row_ndx_2, state.m_value, state); - } - else { - if (row_ndx_2 == realm::npos) { - new_sibling_ref = root_as_node().bptree_append(state); // Throws - } - else { - new_sibling_ref = root_as_node().bptree_insert(row_ndx_2, state); // Throws - } - } - - if (REALM_UNLIKELY(new_sibling_ref)) { - bool is_append = row_ndx_2 == realm::npos; - introduce_new_root(new_sibling_ref, state, is_append); - } - } -} - -template -struct BpTree::LeafValueInserter { - using value_type = T; - T m_value; - LeafValueInserter(T value) - : m_value(std::move(value)) - { - } - - // TreeTraits concept: - static ref_type leaf_insert(MemRef leaf_mem, ArrayParent& parent, size_t ndx_in_parent, Allocator& alloc, - size_t ndx_in_leaf, BpTreeNode::TreeInsert& state) - { - LeafType leaf{alloc}; - leaf.init_from_mem(leaf_mem); - leaf.set_parent(&parent, ndx_in_parent); - // Should not move out of m_value, because the same inserter may be used to perform - // multiple insertions (for example, if num_rows > 1). - return leaf.bptree_leaf_insert(ndx_in_leaf, state.m_value, state); - } -}; - -template -struct BpTree::LeafNullInserter { - using value_type = null; - // TreeTraits concept: - static ref_type leaf_insert(MemRef leaf_mem, ArrayParent& parent, size_t ndx_in_parent, Allocator& alloc, - size_t ndx_in_leaf, BpTreeNode::TreeInsert& state) - { - LeafType leaf{alloc}; - leaf.init_from_mem(leaf_mem); - leaf.set_parent(&parent, ndx_in_parent); - return leaf.bptree_leaf_insert(ndx_in_leaf, null{}, state); - } -}; - -template -void BpTree::insert(size_t row_ndx, T value, size_t num_rows) -{ - REALM_ASSERT_DEBUG(row_ndx == npos || row_ndx < size()); - BpTreeNode::TreeInsert inserter; - inserter.m_value = std::move(value); - inserter.m_nullable = std::is_same>::value; // FIXME - bptree_insert(row_ndx, inserter, num_rows); // Throws -} - -template -struct BpTree::UpdateHandler : BpTreeNode::UpdateHandler { - LeafType m_leaf; - const T m_value; - UpdateHandler(BpTreeBase& tree, T value) noexcept - : m_leaf(tree.get_alloc()) - , m_value(std::move(value)) - { - } - void update(MemRef mem, ArrayParent* parent, size_t ndx_in_parent, size_t elem_ndx_in_leaf) override - { - m_leaf.init_from_mem(mem); - m_leaf.set_parent(parent, ndx_in_parent); - m_leaf.set(elem_ndx_in_leaf, m_value); // Throws - } -}; - -template -struct BpTree::SetNullHandler : BpTreeNode::UpdateHandler { - LeafType m_leaf; - SetNullHandler(BpTreeBase& tree) noexcept - : m_leaf(tree.get_alloc()) - { - } - void update(MemRef mem, ArrayParent* parent, size_t ndx_in_parent, size_t elem_ndx_in_leaf) override - { - m_leaf.init_from_mem(mem); - m_leaf.set_parent(parent, ndx_in_parent); - _impl::NullableOrNothing::set_null(m_leaf, elem_ndx_in_leaf); // Throws - } -}; - -template -void BpTree::set(size_t ndx, T value) -{ - if (root_is_leaf()) { - root_as_leaf().set(ndx, std::move(value)); - } - else { - UpdateHandler set_leaf_elem(*this, std::move(value)); - static_cast(m_root.get())->update_bptree_elem(ndx, set_leaf_elem); // Throws - } -} - -template -void BpTree::set_null(size_t ndx) -{ - if (root_is_leaf()) { - _impl::NullableOrNothing::set_null(root_as_leaf(), ndx); - } - else { - SetNullHandler set_leaf_elem(*this); - static_cast(m_root.get())->update_bptree_elem(ndx, set_leaf_elem); // Throws; - } -} - -template -struct BpTree::EraseHandler : BpTreeNode::EraseHandler { - BpTreeBase& m_tree; - LeafType m_leaf; - bool m_leaves_have_refs; // FIXME: Should be able to eliminate this. - EraseHandler(BpTreeBase& tree) noexcept - : m_tree(tree) - , m_leaf(tree.get_alloc()) - , m_leaves_have_refs(false) - { - } - bool erase_leaf_elem(MemRef leaf_mem, ArrayParent* parent, size_t leaf_ndx_in_parent, - size_t elem_ndx_in_leaf) override - { - m_leaf.init_from_mem(leaf_mem); - REALM_ASSERT_3(m_leaf.size(), >=, 1); - size_t last_ndx = m_leaf.size() - 1; - if (last_ndx == 0) { - m_leaves_have_refs = m_leaf.has_refs(); - return true; - } - m_leaf.set_parent(parent, leaf_ndx_in_parent); - size_t ndx = elem_ndx_in_leaf; - if (ndx == npos) - ndx = last_ndx; - m_leaf.erase(ndx); // Throws - return false; - } - void destroy_leaf(MemRef leaf_mem) noexcept override - { - // FIXME: Seems like this would cause file space leaks if - // m_leaves_have_refs is true, but consider carefully how - // m_leaves_have_refs get its value. - m_tree.get_alloc().free_(leaf_mem); - } - void replace_root_by_leaf(MemRef leaf_mem) override - { - std::unique_ptr leaf{new LeafType(m_tree.get_alloc())}; // Throws - leaf->init_from_mem(leaf_mem); - m_tree.replace_root(std::move(leaf)); // Throws - } - void replace_root_by_empty_leaf() override - { - std::unique_ptr leaf{new LeafType(m_tree.get_alloc())}; // Throws - leaf->create(m_leaves_have_refs ? Array::type_HasRefs : Array::type_Normal); // Throws - m_tree.replace_root(std::move(leaf)); // Throws - } -}; - -template -void BpTree::erase(size_t ndx, bool is_last) -{ - REALM_ASSERT_DEBUG_EX(ndx < size(), ndx, size()); - REALM_ASSERT_DEBUG(is_last == (ndx == size() - 1)); - if (root_is_leaf()) { - root_as_leaf().erase(ndx); - } - else { - size_t ndx_2 = is_last ? npos : ndx; - EraseHandler handler(*this); - BpTreeNode::erase_bptree_elem(&root_as_node(), ndx_2, handler); - } -} - -template -void BpTree::move_last_over(size_t row_ndx, size_t last_row_ndx) -{ - // Copy value from last row over - T value = get(last_row_ndx); - set(row_ndx, value); - erase(last_row_ndx, true); -} - -template -void BpTree::clear() -{ - if (root_is_leaf()) { - if (std::is_same::value && root().get_type() == Array::type_HasRefs) { - // FIXME: This is because some column types rely on integer columns - // to contain refs. - root().clear_and_destroy_children(); - } - else { - root_as_leaf().clear(); - } - } - else { - Allocator& alloc = get_alloc(); - root().destroy_deep(); - - std::unique_ptr new_root(new LeafType(alloc)); - new_root->create(); - replace_root(std::move(new_root)); - } -} - - -template -struct BpTree::AdjustHandler : BpTreeNode::UpdateHandler { - LeafType m_leaf; - const T m_diff; - AdjustHandler(BpTreeBase& tree, T diff) - : m_leaf(tree.get_alloc()) - , m_diff(diff) - { - } - - void update(MemRef mem, ArrayParent* parent, size_t ndx_in_parent, size_t) final - { - m_leaf.init_from_mem(mem); - m_leaf.set_parent(parent, ndx_in_parent); - m_leaf.adjust(0, m_leaf.size(), m_diff); - } -}; - -template -void BpTree::adjust(T diff) -{ - if (root_is_leaf()) { - root_as_leaf().adjust(0, m_root->size(), std::move(diff)); // Throws - } - else { - AdjustHandler adjust_leaf_elem(*this, std::move(diff)); - root_as_node().update_bptree_leaves(adjust_leaf_elem); // Throws - } -} - -template -void BpTree::adjust(size_t ndx, T diff) -{ - static_assert(std::is_arithmetic::value, "adjust is undefined for non-arithmetic trees"); - set(ndx, get(ndx) + diff); -} - -template -struct BpTree::AdjustGEHandler : BpTreeNode::UpdateHandler { - LeafType m_leaf; - const T m_limit, m_diff; - - AdjustGEHandler(BpTreeBase& tree, T limit, T diff) - : m_leaf(tree.get_alloc()) - , m_limit(limit) - , m_diff(diff) - { - } - - void update(MemRef mem, ArrayParent* parent, size_t ndx_in_parent, size_t) final - { - m_leaf.init_from_mem(mem); - m_leaf.set_parent(parent, ndx_in_parent); - m_leaf.adjust_ge(m_limit, m_diff); - } -}; - -template -void BpTree::adjust_ge(T limit, T diff) -{ - if (root_is_leaf()) { - root_as_leaf().adjust_ge(std::move(limit), std::move(diff)); // Throws - } - else { - AdjustGEHandler adjust_leaf_elem(*this, std::move(limit), std::move(diff)); - root_as_node().update_bptree_leaves(adjust_leaf_elem); // Throws - } -} - -template -struct BpTree::SliceHandler : public BpTreeBase::SliceHandler { -public: - SliceHandler(Allocator& alloc) - : m_leaf(alloc) - { - } - MemRef slice_leaf(MemRef leaf_mem, size_t offset, size_t size, Allocator& target_alloc) override - { - m_leaf.init_from_mem(leaf_mem); - return m_leaf.slice_and_clone_children(offset, size, target_alloc); // Throws - } - -private: - LeafType m_leaf; -}; - -template -ref_type BpTree::write(size_t slice_offset, size_t slice_size, size_t table_size, _impl::OutputStream& out) const -{ - ref_type ref; - if (root_is_leaf()) { - Allocator& alloc = Allocator::get_default(); - MemRef mem = root_as_leaf().slice_and_clone_children(slice_offset, slice_size, alloc); // Throws - Array slice(alloc); - _impl::DeepArrayDestroyGuard dg(&slice); - slice.init_from_mem(mem); - bool deep = true; - bool only_when_modified = false; - ref = slice.write(out, deep, only_when_modified); // Throws - } - else { - SliceHandler handler(get_alloc()); - ref = write_subtree(root_as_node(), slice_offset, slice_size, table_size, handler, out); // Throws - } - return ref; -} - -template -MemRef BpTree::create_leaf(Array::Type leaf_type, size_t size, T value, Allocator& alloc) -{ - bool context_flag = false; - MemRef mem = LeafType::create_array(leaf_type, context_flag, size, std::move(value), alloc); - return mem; -} - -template -void BpTree::get_leaf(size_t ndx, size_t& ndx_in_leaf, LeafInfo& inout_leaf_info) const noexcept -{ - if (root_is_leaf()) { - ndx_in_leaf = ndx; - *inout_leaf_info.out_leaf = &root_as_leaf(); - return; - } - std::pair p = root_as_node().get_bptree_leaf(ndx); - inout_leaf_info.fallback->init_from_mem(p.first); - ndx_in_leaf = p.second; - *inout_leaf_info.out_leaf = inout_leaf_info.fallback; -} - -template -size_t BpTree::find_first(T value, size_t begin, size_t end) const -{ - if (root_is_leaf()) { - return root_as_leaf().find_first(value, begin, end); - } - - // FIXME: It would be better to always require that 'end' is - // specified explicitly, since Table has the size readily - // available, and Array::get_bptree_size() is deprecated. - if (end == npos) - end = size(); - - LeafType leaf_cache(get_alloc()); - size_t ndx_in_tree = begin; - while (ndx_in_tree < end) { - const LeafType* leaf; - LeafInfo leaf_info{&leaf, &leaf_cache}; - size_t ndx_in_leaf; - get_leaf(ndx_in_tree, ndx_in_leaf, leaf_info); - size_t leaf_offset = ndx_in_tree - ndx_in_leaf; - size_t end_in_leaf = std::min(leaf->size(), end - leaf_offset); - size_t ndx = leaf->find_first(value, ndx_in_leaf, end_in_leaf); // Throws (maybe) - if (ndx != not_found) - return leaf_offset + ndx; - ndx_in_tree = leaf_offset + end_in_leaf; - } - - return not_found; -} - -template -void BpTree::find_all(IntegerColumn& result, T value, size_t begin, size_t end) const -{ - if (root_is_leaf()) { - root_as_leaf().find_all(&result, value, 0, begin, end); // Throws - return; - } - - // FIXME: It would be better to always require that 'end' is - // specified explicitely, since Table has the size readily - // available, and Array::get_bptree_size() is deprecated. - if (end == npos) - end = size(); - - LeafType leaf_cache(get_alloc()); - size_t ndx_in_tree = begin; - while (ndx_in_tree < end) { - const LeafType* leaf; - LeafInfo leaf_info{&leaf, &leaf_cache}; - size_t ndx_in_leaf; - get_leaf(ndx_in_tree, ndx_in_leaf, leaf_info); - size_t leaf_offset = ndx_in_tree - ndx_in_leaf; - size_t end_in_leaf = std::min(leaf->size(), end - leaf_offset); - leaf->find_all(&result, value, leaf_offset, ndx_in_leaf, end_in_leaf); // Throws - ndx_in_tree = leaf_offset + end_in_leaf; - } -} - -#if defined(REALM_DEBUG) -template -size_t BpTree::verify_leaf(MemRef mem, Allocator& alloc) -{ - LeafType leaf(alloc); - leaf.init_from_mem(mem); - leaf.verify(); - return leaf.size(); -} - -template -void BpTree::verify() const -{ - if (root_is_leaf()) { - root_as_leaf().verify(); - } - else { - root().verify_bptree(&verify_leaf); - } -} -#endif // REALM_DEBUG - -template -void BpTree::leaf_to_dot(MemRef leaf_mem, ArrayParent* parent, size_t ndx_in_parent, std::ostream& out, - Allocator& alloc) -{ - LeafType leaf(alloc); - leaf.init_from_mem(leaf_mem); - leaf.set_parent(parent, ndx_in_parent); - leaf.to_dot(out); -} - -} // namespace realm - -#endif // REALM_BPTREE_HPP diff --git a/Pods/Realm/include/core/realm/column.hpp b/Pods/Realm/include/core/realm/column.hpp deleted file mode 100644 index 9a9fc4b1..00000000 --- a/Pods/Realm/include/core/realm/column.hpp +++ /dev/null @@ -1,1854 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_HPP -#define REALM_COLUMN_HPP - -#include // unint8_t etc -#include // size_t -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace realm { - - -// Pre-definitions -struct CascadeState; -class StringIndex; - -template -struct ImplicitNull; - -template -struct ImplicitNull> { - static constexpr bool value = true; -}; - -template <> -struct ImplicitNull { - static constexpr bool value = false; -}; - -template <> -struct ImplicitNull { - static constexpr bool value = true; -}; - -template <> -struct ImplicitNull { - static constexpr bool value = true; -}; - -// FIXME: Add specialization for ImplicitNull for float, double, StringData, BinaryData. - -template -R aggregate(const ColType& column, T target, size_t start, size_t end, size_t limit, size_t* return_ndx); - - -// Iterator with random access for Columns -template -class ColumnRandIterator : public std::iterator { -public: - ColumnRandIterator(const Column* src_col, size_t ndx = 0); - bool operator==(const ColumnRandIterator& rhs) const; - bool operator!=(const ColumnRandIterator& rhs) const; - bool operator<(const ColumnRandIterator& rhs) const; - bool operator>(const ColumnRandIterator& rhs) const; - bool operator<=(const ColumnRandIterator& rhs) const; - bool operator>=(const ColumnRandIterator& rhs) const; - ColumnRandIterator& operator+=(ptrdiff_t movement); - ColumnRandIterator& operator-=(ptrdiff_t movement); - ColumnRandIterator& operator++(); - ColumnRandIterator& operator--(); - ColumnRandIterator operator++(int); - ColumnRandIterator operator--(int); - ColumnRandIterator operator+(ptrdiff_t movement); - ColumnRandIterator operator-(ptrdiff_t movement); - ptrdiff_t operator-(const ColumnRandIterator& rawIterator); - const ColumnDataType operator*() const; - const ColumnDataType operator->() const; - const ColumnDataType operator[](ptrdiff_t offset) const; - size_t get_col_ndx() const; - -protected: - size_t m_col_ndx; - const Column* m_col; -}; - -/// Base class for all column types. -class ColumnBase { -public: - /// Get the number of entries in this column. This operation is relatively - /// slow. - virtual size_t size() const noexcept = 0; - - /// \throw LogicError Thrown if this column is not string valued. - virtual void set_string(size_t row_ndx, StringData value); - - /// Whether or not this column is nullable. - virtual bool is_nullable() const noexcept; - - /// Whether or not the value at \a row_ndx is NULL. If the column is not - /// nullable, always returns false. - virtual bool is_null(size_t row_ndx) const noexcept; - - /// Sets the value at \a row_ndx to be NULL. - /// \throw LogicError Thrown if this column is not nullable. - virtual void set_null(size_t row_ndx); - - /// Inserts the specified number of elements into this column - /// starting at the specified row index. The new elements will have the - /// default value for the column type. - /// - /// \param row_ndx The row to start insertion at. If the row_ndx is less - /// than prior_num_rows then previous rows from row_ndx onwards will be - /// moved ahead by num_rows_to_insert. - /// - /// \param num_rows_to_insert The number of rows to insert. There is no - /// restriction on this value. - /// - /// \param prior_num_rows The number of elements in this column prior to the - /// modification. - /// - /// \param nullable Specifies whether or not this column is nullable. This - /// function may assert if nullable does not agree with \a is_nullable() - virtual void insert_rows(size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows, bool nullable) = 0; - - /// Removes the specified number of consecutive elements from - /// this column, starting at the specified row index. - /// - /// \param row_ndx The row to start removal at (inclusive). This must be - /// less than prior_num_rows. - /// - /// \param num_rows_to_erase The number of rows to erase. - /// The row_ndx + num_rows_to_erase must be less than prior_num_rows. - /// - /// \param prior_num_rows The number of elements in this column prior to the - /// modification. - /// - /// \param broken_reciprocal_backlinks If true, link columns must assume - /// that reciprocal backlinks have already been removed. Non-link columns - /// should ignore this argument. - virtual void erase_rows(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, - bool broken_reciprocal_backlinks) = 0; - - /// Removes the element at the specified row index by - /// moving the element at the last row index over it. This reduces the - /// number of elements by one. - /// - /// \param row_ndx The row to erase. Must be less than prior_num_rows. - /// - /// \param prior_num_rows The number of elements in this column prior to the - /// modification. - /// - /// \param broken_reciprocal_backlinks If true, link columns must assume - /// that reciprocal backlinks have already been removed. Non-link columns - /// should ignore this argument. - virtual void move_last_row_over(size_t row_ndx, size_t prior_num_rows, bool broken_reciprocal_backlinks) = 0; - - /// Remove all elements from this column. - /// - /// \param num_rows The total number of rows in this column. - /// - /// \param broken_reciprocal_backlinks If true, link columns must assume - /// that reciprocal backlinks have already been removed. Non-link columns - /// should ignore this argument. - virtual void clear(size_t num_rows, bool broken_reciprocal_backlinks) = 0; - - /// \brief Swap the elements at the specified indices. - /// - /// Behaviour is undefined if: - /// - \a row_ndx_1 or \a row_ndx_2 point to an invalid element (out-of - /// bounds) - /// - \a row_ndx_1 and \a row_ndx_2 point to the same value - virtual void swap_rows(size_t row_ndx_1, size_t row_ndx_2) = 0; - - virtual void destroy() noexcept = 0; - void move_assign(ColumnBase& col) noexcept; - - virtual ~ColumnBase() noexcept - { - } - - // Getter function for index. For integer index, the caller must supply a - // buffer that we can store the extracted value in (it may be bitpacked, so - // we cannot return a pointer in to the Array as we do with String index). - virtual StringData get_index_data(size_t, StringIndex::StringConversionBuffer& buffer) const noexcept = 0; - - // Search index - virtual bool supports_search_index() const noexcept; - virtual bool has_search_index() const noexcept; - virtual StringIndex* create_search_index(); - virtual void destroy_search_index() noexcept; - virtual const StringIndex* get_search_index() const noexcept; - virtual StringIndex* get_search_index() noexcept; - virtual void set_search_index_ref(ref_type, ArrayParent*, size_t ndx_in_parent, bool allow_duplicate_values); - virtual void set_search_index_allow_duplicate_values(bool) noexcept; - - virtual Allocator& get_alloc() const noexcept = 0; - - /// Returns the 'ref' of the root array. - virtual ref_type get_ref() const noexcept = 0; - virtual MemRef get_mem() const noexcept = 0; - - virtual void replace_root_array(std::unique_ptr leaf) = 0; - virtual MemRef clone_deep(Allocator& alloc) const = 0; - virtual void detach(void) = 0; - virtual bool is_attached(void) const noexcept = 0; - - static size_t get_size_from_type_and_ref(ColumnType, ref_type, Allocator&, bool) noexcept; - - // These assume that the right column compile-time type has been - // figured out. - static size_t get_size_from_ref(ref_type root_ref, Allocator&); - static size_t get_size_from_ref(ref_type spec_ref, ref_type columns_ref, Allocator&); - - /// Write a slice of this column to the specified output stream. - virtual ref_type write(size_t slice_offset, size_t slice_size, size_t table_size, _impl::OutputStream&) const = 0; - - /// Get this column's logical index within the containing table, or npos - /// for free-standing or non-top-level columns. - size_t get_column_index() const noexcept - { - return m_column_ndx; - } - - virtual void set_parent(ArrayParent*, size_t ndx_in_parent) noexcept = 0; - virtual size_t get_ndx_in_parent() const noexcept = 0; - virtual void set_ndx_in_parent(size_t ndx_in_parent) noexcept = 0; - - /// Called to update refs and memory pointers of this column accessor and - /// all its nested accessors, but only in cases where the logical contents - /// in strictly unchanged. Group::commit(), and - /// SharedGroup::commit_and_continue_as_read()() are examples of such - /// cases. In both those cases, the purpose is to keep user visible - /// accessors in a valid state across a commit. - virtual void update_from_parent(size_t old_baseline) noexcept = 0; - - //@{ - - /// cascade_break_backlinks_to() is called iteratively for each column by - /// Table::cascade_break_backlinks_to() with the same arguments as are - /// passed to Table::cascade_break_backlinks_to(). Link columns must - /// override it. The same is true for cascade_break_backlinks_to_all_rows(), - /// except that it is called from - /// Table::cascade_break_backlinks_to_all_rows(), and that it expects - /// Table::cascade_break_backlinks_to_all_rows() to pass the number of rows - /// in the table as \a num_rows. - - virtual void cascade_break_backlinks_to(size_t row_ndx, CascadeState&); - virtual void cascade_break_backlinks_to_all_rows(size_t num_rows, CascadeState&); - - //@} - - void discard_child_accessors() noexcept; - - /// For columns that are able to contain subtables, this function returns - /// the pointer to the subtable accessor at the specified row index if it - /// exists, otherwise it returns null. For other column types, this function - /// returns null. - virtual Table* get_subtable_accessor(size_t row_ndx) const noexcept; - - /// Detach and remove the subtable accessor at the specified row if it - /// exists. For column types that are unable to contain subtable, this - /// function does nothing. - virtual void discard_subtable_accessor(size_t row_ndx) noexcept; - - virtual void adj_acc_insert_rows(size_t row_ndx, size_t num_rows) noexcept; - virtual void adj_acc_erase_row(size_t row_ndx) noexcept; - /// See Table::adj_acc_move_over() - virtual void adj_acc_move_over(size_t from_row_ndx, size_t to_row_ndx) noexcept; - virtual void adj_acc_swap_rows(size_t row_ndx_1, size_t row_ndx_2) noexcept; - virtual void adj_acc_merge_rows(size_t old_row_ndx, size_t new_row_ndx) noexcept; - virtual void adj_acc_clear_root_table() noexcept; - - enum { - mark_Recursive = 0x01, - mark_LinkTargets = 0x02, - mark_LinkOrigins = 0x04, - }; - - virtual void mark(int type) noexcept; - - virtual void bump_link_origin_table_version() noexcept; - - virtual int compare_values(size_t row1, size_t row2) const noexcept = 0; - - /// Refresh the dirty part of the accessor subtree rooted at this column - /// accessor. - /// - /// The following conditions are necessary and sufficient for the proper - /// operation of this function: - /// - /// - The parent table accessor (excluding its column accessors) is in a - /// valid state (already refreshed). - /// - /// - Every subtable accessor in the subtree is marked dirty if it needs to - /// be refreshed, or if it has a descendant accessor that needs to be - /// refreshed. - /// - /// - This column accessor, as well as all its descendant accessors, are in - /// structural correspondence with the underlying node hierarchy whose - /// root ref is stored in the parent (`Table::m_columns`) (see - /// AccessorConsistencyLevels). - /// - /// - The 'index in parent' property of the cached root array - /// (`root->m_ndx_in_parent`) is valid. - virtual void refresh_accessor_tree(size_t new_col_ndx, const Spec&); - - virtual void verify() const = 0; - virtual void verify(const Table&, size_t col_ndx) const; - virtual void to_dot(std::ostream&, StringData title = StringData()) const = 0; - virtual void do_dump_node_structure(std::ostream&, int level) const = 0; - -#ifdef REALM_DEBUG - void dump_node_structure() const; // To std::cerr (for GDB) - void bptree_to_dot(const Array* root, std::ostream& out) const; -#endif - -protected: - using SliceHandler = BpTreeBase::SliceHandler; - - ColumnBase(size_t column_ndx = npos) - : m_column_ndx(column_ndx) - { - } - ColumnBase(ColumnBase&&) = default; - - // Must not assume more than minimal consistency (see - // AccessorConsistencyLevels). - virtual void do_discard_child_accessors() noexcept - { - } - - //@{ - /// \tparam L Any type with an appropriate `value_type`, %size(), - /// and %get() members. - template - size_t lower_bound(const L& list, T value) const noexcept; - - template - size_t upper_bound(const L& list, T value) const noexcept; - //@} - - // Node functions - - class CreateHandler { - public: - virtual ref_type create_leaf(size_t size) = 0; - ~CreateHandler() noexcept - { - } - }; - - static ref_type create(Allocator&, size_t size, CreateHandler&); - - class LeafToDot; - virtual void leaf_to_dot(MemRef, ArrayParent*, size_t ndx_in_parent, std::ostream&) const = 0; - - template - static int compare_values(const Column* column, size_t row1, size_t row2) noexcept; - -private: - size_t m_column_ndx = npos; - - static ref_type build(size_t* rest_size_ptr, size_t fixed_height, Allocator&, CreateHandler&); -}; - - -// FIXME: Temporary class until all column types have been migrated to use BpTree interface -class ColumnBaseSimple : public ColumnBase { -public: - //@{ - /// Returns the array node at the root of this column, but note - /// that there is no guarantee that this node is an inner B+-tree - /// node or a leaf. This is the case for a MixedColumn in - /// particular. - Array* get_root_array() noexcept - { - return m_array.get(); - } - const Array* get_root_array() const noexcept - { - return m_array.get(); - } - //@} - - Allocator& get_alloc() const noexcept final - { - return m_array->get_alloc(); - } - void destroy() noexcept override - { - if (m_array) - m_array->destroy_deep(); - } - ref_type get_ref() const noexcept final - { - return m_array->get_ref(); - } - MemRef get_mem() const noexcept final - { - return m_array->get_mem(); - } - void detach() noexcept final - { - m_array->detach(); - } - bool is_attached() const noexcept final - { - return m_array->is_attached(); - } - void set_parent(ArrayParent* parent, size_t ndx_in_parent) noexcept final - { - m_array->set_parent(parent, ndx_in_parent); - } - size_t get_ndx_in_parent() const noexcept final - { - return m_array->get_ndx_in_parent(); - } - void set_ndx_in_parent(size_t ndx_in_parent) noexcept override - { - m_array->set_ndx_in_parent(ndx_in_parent); - } - void update_from_parent(size_t old_baseline) noexcept override - { - m_array->update_from_parent(old_baseline); - } - MemRef clone_deep(Allocator& alloc) const override - { - return m_array->clone_deep(alloc); - } - -protected: - ColumnBaseSimple(size_t column_ndx) - : ColumnBase(column_ndx) - { - } - ColumnBaseSimple(Array* root) - : m_array(root) - { - } - std::unique_ptr m_array; - - void replace_root_array(std::unique_ptr new_root) final; - bool root_is_leaf() const noexcept - { - return !m_array->is_inner_bptree_node(); - } - - /// Introduce a new root node which increments the height of the - /// tree by one. - void introduce_new_root(ref_type new_sibling_ref, TreeInsertBase& state, bool is_append); - - static ref_type write(const Array* root, size_t slice_offset, size_t slice_size, size_t table_size, SliceHandler&, - _impl::OutputStream&); - -#if defined(REALM_DEBUG) - void tree_to_dot(std::ostream&) const; -#endif -}; - -class ColumnBaseWithIndex : public ColumnBase { -public: - ~ColumnBaseWithIndex() noexcept override - { - } - void set_ndx_in_parent(size_t ndx) noexcept override; - void update_from_parent(size_t old_baseline) noexcept override; - void refresh_accessor_tree(size_t, const Spec&) override; - void move_assign(ColumnBaseWithIndex& col) noexcept; - void destroy() noexcept override; - - virtual bool supports_search_index() const noexcept override - { - return true; - } - bool has_search_index() const noexcept final - { - return bool(m_search_index); - } - StringIndex* get_search_index() noexcept final - { - return m_search_index.get(); - } - const StringIndex* get_search_index() const noexcept final - { - return m_search_index.get(); - } - void destroy_search_index() noexcept override; - void set_search_index_ref(ref_type ref, ArrayParent* parent, size_t ndx_in_parent, - bool allow_duplicate_valaues) final; - StringIndex* create_search_index() override = 0; - -protected: - using ColumnBase::ColumnBase; - ColumnBaseWithIndex(ColumnBaseWithIndex&&) = default; - std::unique_ptr m_search_index; -}; - - -/// A column (Column) is a single B+-tree, and the root of -/// the column is the root of the B+-tree. All leaf nodes are arrays. -template -class Column : public ColumnBaseWithIndex { -public: - using value_type = T; - using LeafInfo = typename BpTree::LeafInfo; - using LeafType = typename BpTree::LeafType; - - static constexpr bool nullable = ImplicitNull::value; - - struct unattached_root_tag { - }; - - explicit Column() noexcept - : ColumnBaseWithIndex(npos) - , m_tree(Allocator::get_default()) - { - } - REALM_DEPRECATED("Initialize with ref instead") explicit Column(std::unique_ptr root) noexcept; - Column(Allocator&, ref_type, size_t column_ndx = npos); - Column(unattached_root_tag, Allocator&); - Column(Column&&) noexcept = default; - ~Column() noexcept override; - - void init_from_parent(); - void init_from_ref(Allocator&, ref_type); - void init_from_mem(Allocator&, MemRef); - // Accessor concept: - void destroy() noexcept override; - Allocator& get_alloc() const noexcept final; - ref_type get_ref() const noexcept final; - MemRef get_mem() const noexcept final; - void set_parent(ArrayParent* parent, size_t ndx_in_parent) noexcept override; - size_t get_ndx_in_parent() const noexcept final; - void set_ndx_in_parent(size_t ndx) noexcept final; - void update_from_parent(size_t old_baseline) noexcept override; - void refresh_accessor_tree(size_t, const Spec&) override; - void detach() noexcept final; - bool is_attached() const noexcept final; - MemRef clone_deep(Allocator&) const override; - - void move_assign(Column&); - - static size_t get_size_from_ref(ref_type root_ref, Allocator& alloc) - { - return ColumnBase::get_size_from_ref(root_ref, alloc); - } - - size_t size() const noexcept override; - bool is_empty() const noexcept - { - return size() == 0; - } - bool is_nullable() const noexcept override; - - /// Provides access to the leaf that contains the element at the - /// specified index. Upon return \a ndx_in_leaf will be set to the - /// corresponding index relative to the beginning of the leaf. - /// - /// LeafInfo is a struct defined by the underlying BpTree - /// data structure, that provides a way for the caller to do - /// leaf caching without instantiating too many objects along - /// the way. - /// - /// This function cannot be used for modifying operations as it - /// does not ensure the presence of an unbroken chain of parent - /// accessors. For this reason, the identified leaf should always - /// be accessed through the returned const-qualified reference, - /// and never directly through the specfied fallback accessor. - void get_leaf(size_t ndx, size_t& ndx_in_leaf, LeafInfo& inout_leaf) const noexcept; - - // Getting and setting values - T get(size_t ndx) const noexcept; - bool is_null(size_t ndx) const noexcept override; - T back() const noexcept; - void set(size_t, T value); - void set_null(size_t) override; - void add(T value = T{}); - void insert(size_t ndx, T value = T{}, size_t num_rows = 1); - void erase(size_t row_ndx); - void erase(size_t row_ndx, bool is_last); - void move_last_over(size_t row_ndx, size_t last_row_ndx); - void clear(); - - // Index support - StringData get_index_data(size_t ndx, StringIndex::StringConversionBuffer& buffer) const noexcept override; - - // FIXME: Remove these - uint64_t get_uint(size_t ndx) const noexcept; - ref_type get_as_ref(size_t ndx) const noexcept; - void set_uint(size_t ndx, uint64_t value); - void set_as_ref(size_t ndx, ref_type value); - - template - void adjust(size_t ndx, U diff); - - template - void adjust(U diff); - - template - void adjust_ge(T limit, U diff); - - size_t count(T target) const; - - typename ColumnTypeTraits::sum_type sum(size_t start = 0, size_t end = npos, size_t limit = npos, - size_t* return_ndx = nullptr) const; - - typename ColumnTypeTraits::minmax_type maximum(size_t start = 0, size_t end = npos, size_t limit = npos, - size_t* return_ndx = nullptr) const; - - typename ColumnTypeTraits::minmax_type minimum(size_t start = 0, size_t end = npos, size_t limit = npos, - size_t* return_ndx = nullptr) const; - - double average(size_t start = 0, size_t end = npos, size_t limit = npos, size_t* return_ndx = nullptr) const; - - size_t find_first(T value, size_t begin = 0, size_t end = npos) const; - void find_all(Column& out_indices, T value, size_t begin = 0, size_t end = npos) const; - - void populate_search_index(); - StringIndex* create_search_index() override; - inline bool supports_search_index() const noexcept override - { - if (realm::is_any::value) - return false; - else - return true; - } - - - //@{ - /// Find the lower/upper bound for the specified value assuming - /// that the elements are already sorted in ascending order - /// according to ordinary integer comparison. - size_t lower_bound(T value) const noexcept; - size_t upper_bound(T value) const noexcept; - //@} - - using const_iterator = ColumnRandIterator; - - const_iterator cbegin() const - { - return const_iterator(this, 0); // `this` is const in a const method - } - const_iterator cend() const - { - return const_iterator(this, size()); - } - - size_t find_gte(T target, size_t start) const; - - bool compare(const Column&) const noexcept; - int compare_values(size_t row1, size_t row2) const noexcept override; - - static ref_type create(Allocator&, Array::Type leaf_type = Array::type_Normal, size_t size = 0, T value = T{}); - - // Overriding method in ColumnBase - ref_type write(size_t, size_t, size_t, _impl::OutputStream&) const override; - - void insert_rows(size_t, size_t, size_t, bool) override; - void erase_rows(size_t, size_t, size_t, bool) override; - void move_last_row_over(size_t, size_t, bool) override; - - /// \brief Swap the elements at the specified indices. - /// - /// If this \c Column has a search index defined, it will be updated to - /// reflect the changes induced by the swap. - /// - /// Behaviour is undefined if: - /// - \a row_ndx_1 or \a row_ndx_2 point to an invalid element (out-of - /// bounds) - /// - \a row_ndx_1 and \a row_ndx_2 point to the same value - void swap_rows(size_t, size_t) override; - void clear(size_t, bool) override; - - /// \param row_ndx Must be `realm::npos` if appending. - /// \param value The value to store at the specified row. - /// \param num_rows The number of rows to insert. - void insert_without_updating_index(size_t row_ndx, T value, size_t num_rows); - - void verify() const override; - void to_dot(std::ostream&, StringData title) const override; - void do_dump_node_structure(std::ostream&, int) const override; -#ifdef REALM_DEBUG - using ColumnBase::verify; - void tree_to_dot(std::ostream&) const; - MemStats stats() const; -#endif - - //@{ - /// Returns the array node at the root of this column, but note - /// that there is no guarantee that this node is an inner B+-tree - /// node or a leaf. This is the case for a MixedColumn in - /// particular. - Array* get_root_array() noexcept - { - return &m_tree.root(); - } - const Array* get_root_array() const noexcept - { - return &m_tree.root(); - } - //@} - -protected: - bool root_is_leaf() const noexcept - { - return m_tree.root_is_leaf(); - } - void replace_root_array(std::unique_ptr leaf) final - { - m_tree.replace_root(std::move(leaf)); - } - - void set_without_updating_index(size_t row_ndx, T value); - void erase_without_updating_index(size_t row_ndx, bool is_last); - void move_last_over_without_updating_index(size_t row_ndx, size_t last_row_ndx); - void swap_rows_without_updating_index(size_t row_ndx_1, size_t row_ndx_2); - - /// If any element points to an array node, this function recursively - /// destroys that array node. Note that the same is **not** true for - /// IntegerColumn::do_erase() and IntegerColumn::do_move_last_over(). - /// - /// FIXME: Be careful, clear_without_updating_index() currently forgets - /// if the leaf type is Array::type_HasRefs. - void clear_without_updating_index(); - - void leaf_to_dot(MemRef, ArrayParent*, size_t ndx_in_parent, std::ostream&) const override; -#ifdef REALM_DEBUG - static void dump_node_structure(const Array& root, std::ostream&, int level); -#endif - std::pair get_to_dot_parent(size_t ndx_in_parent) const; - -private: - class EraseLeafElem; - class CreateHandler; - class SliceHandler; - - friend class Array; - friend class ColumnBase; - friend class StringIndex; - - BpTree m_tree; - - void do_erase(size_t row_ndx, size_t num_rows_to_erase, bool is_last); -}; - -// Implementation: - - -template <> -inline size_t IntNullColumn::get_size_from_ref(ref_type root_ref, Allocator& alloc) -{ - // FIXME: Speed improvement possible by not creating instance, but tricky! This slow method is OK so far - // because it's only invoked by Table::get_size_from_ref() which is only used for subtables which we - // currently 2016) do not expose publicly. - IntNullColumn inc(alloc, root_ref); - return inc.size(); -} - - -inline bool ColumnBase::supports_search_index() const noexcept -{ - REALM_ASSERT(!has_search_index()); - return false; -} - -inline bool ColumnBase::has_search_index() const noexcept -{ - return get_search_index() != nullptr; -} - -inline StringIndex* ColumnBase::create_search_index() -{ - return nullptr; -} - -inline void ColumnBase::destroy_search_index() noexcept -{ -} - -inline const StringIndex* ColumnBase::get_search_index() const noexcept -{ - return nullptr; -} - -inline StringIndex* ColumnBase::get_search_index() noexcept -{ - return nullptr; -} - -inline void ColumnBase::set_search_index_ref(ref_type, ArrayParent*, size_t, bool) -{ -} - -inline void ColumnBase::set_search_index_allow_duplicate_values(bool) noexcept -{ -} - -inline void ColumnBase::discard_child_accessors() noexcept -{ - do_discard_child_accessors(); -} - -inline Table* ColumnBase::get_subtable_accessor(size_t) const noexcept -{ - return 0; -} - -inline void ColumnBase::discard_subtable_accessor(size_t) noexcept -{ - // Noop -} - -inline void ColumnBase::adj_acc_insert_rows(size_t, size_t) noexcept -{ - // Noop -} - -inline void ColumnBase::adj_acc_erase_row(size_t) noexcept -{ - // Noop -} - -inline void ColumnBase::adj_acc_move_over(size_t, size_t) noexcept -{ - // Noop -} - -inline void ColumnBase::adj_acc_swap_rows(size_t, size_t) noexcept -{ - // Noop -} - -inline void ColumnBase::adj_acc_merge_rows(size_t, size_t) noexcept -{ - // Noop -} - -inline void ColumnBase::adj_acc_clear_root_table() noexcept -{ - // Noop -} - -inline void ColumnBase::mark(int) noexcept -{ - // Noop -} - -inline void ColumnBase::bump_link_origin_table_version() noexcept -{ - // Noop -} - -template -int ColumnBase::compare_values(const Column* column, size_t row1, size_t row2) noexcept -{ - // we negate nullability such that the two ternary statements in this method can look identical to reduce - // risk of bugs - bool v1 = !column->is_null(row1); - bool v2 = !column->is_null(row2); - - if (!v1 || !v2) - return v1 == v2 ? 0 : v1 < v2 ? 1 : -1; - - auto a = column->get(row1); - auto b = column->get(row2); - return a == b ? 0 : a < b ? 1 : -1; -} - -template -void Column::set_without_updating_index(size_t ndx, T value) -{ - m_tree.set(ndx, std::move(value)); -} - -template -void Column::set(size_t ndx, T value) -{ - REALM_ASSERT_DEBUG(ndx < size()); - if (has_search_index()) { - m_search_index->set(ndx, value); - } - set_without_updating_index(ndx, std::move(value)); -} - -template -void Column::set_null(size_t ndx) -{ - REALM_ASSERT_DEBUG(ndx < size()); - if (!is_nullable()) { - throw LogicError{LogicError::column_not_nullable}; - } - if (has_search_index()) { - m_search_index->set(ndx, null{}); - } - m_tree.set_null(ndx); -} - -// When a value of a signed type is converted to an unsigned type, the C++ standard guarantees that negative values -// are converted from the native representation to 2's complement, but the opposite conversion is left as undefined. -// realm::util::from_twos_compl() is used here to perform the correct opposite unsigned-to-signed conversion, -// which reduces to a no-op when 2's complement is the native representation of negative values. -template -void Column::set_uint(size_t ndx, uint64_t value) -{ - set(ndx, util::from_twos_compl(value)); -} - -template -void Column::set_as_ref(size_t ndx, ref_type ref) -{ - set(ndx, from_ref(ref)); -} - -template -template -void Column::adjust(size_t ndx, U diff) -{ - REALM_ASSERT_3(ndx, <, size()); - m_tree.adjust(ndx, diff); -} - -template -template -void Column::adjust(U diff) -{ - m_tree.adjust(diff); -} - -template -template -void Column::adjust_ge(T limit, U diff) -{ - m_tree.adjust_ge(limit, diff); -} - -template -size_t Column::count(T target) const -{ - if (has_search_index()) { - return m_search_index->count(target); - } - return to_size_t(aggregate(*this, target, 0, size(), npos, nullptr)); -} - -template -typename ColumnTypeTraits::sum_type Column::sum(size_t start, size_t end, size_t limit, - size_t* return_ndx) const -{ - using sum_type = typename ColumnTypeTraits::sum_type; - if (nullable) - return aggregate(*this, 0, start, end, limit, return_ndx); - else - return aggregate(*this, 0, start, end, limit, return_ndx); -} - -template -double Column::average(size_t start, size_t end, size_t limit, size_t* return_ndx) const -{ - if (end == size_t(-1)) - end = size(); - - auto s = sum(start, end, limit); - size_t cnt = to_size_t(aggregate(*this, 0, start, end, limit, nullptr)); - if (return_ndx) - *return_ndx = cnt; - double avg = double(s) / (cnt == 0 ? 1 : cnt); - return avg; -} - -template -typename ColumnTypeTraits::minmax_type Column::minimum(size_t start, size_t end, size_t limit, - size_t* return_ndx) const -{ - using R = typename ColumnTypeTraits::minmax_type; - return aggregate(*this, 0, start, end, limit, return_ndx); -} - -template -typename ColumnTypeTraits::minmax_type Column::maximum(size_t start, size_t end, size_t limit, - size_t* return_ndx) const -{ - using R = typename ColumnTypeTraits::minmax_type; - return aggregate(*this, 0, start, end, limit, return_ndx); -} - -template -void Column::get_leaf(size_t ndx, size_t& ndx_in_leaf, LeafInfo& inout_leaf_info) const noexcept -{ - m_tree.get_leaf(ndx, ndx_in_leaf, inout_leaf_info); -} - -template -StringData Column::get_index_data(size_t ndx, StringIndex::StringConversionBuffer& buffer) const noexcept -{ - T x = get(ndx); - return to_str(x, buffer); -} - -template -void Column::populate_search_index() -{ - REALM_ASSERT(has_search_index()); - // Populate the index - size_t num_rows = size(); - for (size_t row_ndx = 0; row_ndx != num_rows; ++row_ndx) { - bool is_append = true; - if (is_null(row_ndx)) { - m_search_index->insert(row_ndx, null{}, 1, is_append); // Throws - } - else { - T value = get(row_ndx); - m_search_index->insert(row_ndx, value, 1, is_append); // Throws - } - } -} - -template -StringIndex* Column::create_search_index() -{ - if (realm::is_any::value) - return nullptr; - - REALM_ASSERT(!has_search_index()); - REALM_ASSERT(supports_search_index()); - m_search_index.reset(new StringIndex(this, get_alloc())); // Throws - populate_search_index(); - return m_search_index.get(); -} - -template -size_t Column::find_first(T value, size_t begin, size_t end) const -{ - REALM_ASSERT_3(begin, <=, size()); - REALM_ASSERT(end == npos || (begin <= end && end <= size())); - - if (m_search_index && begin == 0 && end == npos) - return m_search_index->find_first(value); - return m_tree.find_first(value, begin, end); -} - -template -void Column::find_all(IntegerColumn& result, T value, size_t begin, size_t end) const -{ - REALM_ASSERT_3(begin, <=, size()); - REALM_ASSERT(end == npos || (begin <= end && end <= size())); - - if (m_search_index && begin == 0 && end == npos) - return m_search_index->find_all(result, value); - return m_tree.find_all(result, value, begin, end); -} - -inline size_t ColumnBase::get_size_from_ref(ref_type root_ref, Allocator& alloc) -{ - const char* root_header = alloc.translate(root_ref); - bool root_is_leaf = !Array::get_is_inner_bptree_node_from_header(root_header); - if (root_is_leaf) - return Array::get_size_from_header(root_header); - return BpTreeNode::get_bptree_size_from_header(root_header); -} - -template -size_t ColumnBase::lower_bound(const L& list, T value) const noexcept -{ - size_t i = 0; - size_t list_size = list.size(); - while (0 < list_size) { - size_t half = list_size / 2; - size_t mid = i + half; - typename L::value_type probe = list.get(mid); - if (probe < value) { - i = mid + 1; - list_size -= half + 1; - } - else { - list_size = half; - } - } - return i; -} - -template -size_t ColumnBase::upper_bound(const L& list, T value) const noexcept -{ - size_t i = 0; - size_t list_size = list.size(); - while (0 < list_size) { - size_t half = list_size / 2; - size_t mid = i + half; - typename L::value_type probe = list.get(mid); - if (!(value < probe)) { - i = mid + 1; - list_size -= half + 1; - } - else { - list_size = half; - } - } - return i; -} - - -inline ref_type ColumnBase::create(Allocator& alloc, size_t column_size, CreateHandler& handler) -{ - size_t rest_size = column_size; - size_t fixed_height = 0; // Not fixed - return build(&rest_size, fixed_height, alloc, handler); -} - -template -Column::Column(Allocator& alloc, ref_type ref, size_t column_ndx) - : ColumnBaseWithIndex(column_ndx) - , m_tree(BpTreeBase::unattached_tag{}) -{ - // fixme, must m_search_index be copied here? - m_tree.init_from_ref(alloc, ref); -} - -template -Column::Column(unattached_root_tag, Allocator& alloc) - : ColumnBaseWithIndex(npos) - , m_tree(alloc) -{ -} - -template -Column::Column(std::unique_ptr root) noexcept - : m_tree(std::move(root)) -{ -} - -template -Column::~Column() noexcept -{ -} - -template -void Column::init_from_parent() -{ - m_tree.init_from_parent(); -} - -template -void Column::init_from_ref(Allocator& alloc, ref_type ref) -{ - m_tree.init_from_ref(alloc, ref); -} - -template -void Column::init_from_mem(Allocator& alloc, MemRef mem) -{ - m_tree.init_from_mem(alloc, mem); -} - -template -void Column::destroy() noexcept -{ - ColumnBaseWithIndex::destroy(); - m_tree.destroy(); -} - -template -void Column::move_assign(Column& col) -{ - ColumnBaseWithIndex::move_assign(col); - m_tree = std::move(col.m_tree); -} - -template -Allocator& Column::get_alloc() const noexcept -{ - return m_tree.get_alloc(); -} - -template -void Column::set_parent(ArrayParent* parent, size_t ndx_in_parent) noexcept -{ - m_tree.set_parent(parent, ndx_in_parent); -} - -template -size_t Column::get_ndx_in_parent() const noexcept -{ - return m_tree.get_ndx_in_parent(); -} - -template -void Column::set_ndx_in_parent(size_t ndx_in_parent) noexcept -{ - ColumnBaseWithIndex::set_ndx_in_parent(ndx_in_parent); - m_tree.set_ndx_in_parent(ndx_in_parent); -} - -template -void Column::detach() noexcept -{ - m_tree.detach(); -} - -template -bool Column::is_attached() const noexcept -{ - return m_tree.is_attached(); -} - -template -ref_type Column::get_ref() const noexcept -{ - return get_root_array()->get_ref(); -} - -template -MemRef Column::get_mem() const noexcept -{ - return get_root_array()->get_mem(); -} - -template -void Column::update_from_parent(size_t old_baseline) noexcept -{ - ColumnBaseWithIndex::update_from_parent(old_baseline); - m_tree.update_from_parent(old_baseline); -} - -template -MemRef Column::clone_deep(Allocator& alloc) const -{ - return m_tree.clone_deep(alloc); -} - -template -size_t Column::size() const noexcept -{ - return m_tree.size(); -} - -template -bool Column::is_nullable() const noexcept -{ - return nullable; -} - -template -T Column::get(size_t ndx) const noexcept -{ - return m_tree.get(ndx); -} - -template -bool Column::is_null(size_t ndx) const noexcept -{ - return nullable && m_tree.is_null(ndx); -} - -template -T Column::back() const noexcept -{ - return m_tree.back(); -} - -template -ref_type Column::get_as_ref(size_t ndx) const noexcept -{ - return to_ref(get(ndx)); -} - -template -uint64_t Column::get_uint(size_t ndx) const noexcept -{ - static_assert(std::is_convertible::value, "T is not convertible to uint."); - return static_cast(get(ndx)); -} - -template -void Column::add(T value) -{ - insert(npos, std::move(value)); -} - -template -void Column::insert_without_updating_index(size_t row_ndx, T value, size_t num_rows) -{ - size_t column_size = this->size(); // Slow - bool is_append = row_ndx == column_size || row_ndx == npos; - size_t ndx_or_npos_if_append = is_append ? npos : row_ndx; - - m_tree.insert(ndx_or_npos_if_append, std::move(value), num_rows); // Throws -} - -template -void Column::insert(size_t row_ndx, T value, size_t num_rows) -{ - size_t column_size = this->size(); // Slow - bool is_append = row_ndx == column_size || row_ndx == npos; - size_t ndx_or_npos_if_append = is_append ? npos : row_ndx; - - m_tree.insert(ndx_or_npos_if_append, value, num_rows); // Throws - - if (has_search_index()) { - row_ndx = is_append ? column_size : row_ndx; - m_search_index->insert(row_ndx, value, num_rows, is_append); // Throws - } -} - -template -void Column::erase_without_updating_index(size_t row_ndx, bool is_last) -{ - m_tree.erase(row_ndx, is_last); -} - -template -void Column::erase(size_t row_ndx) -{ - REALM_ASSERT(size() >= 1); - size_t last_row_ndx = size() - 1; // Note that size() is slow - bool is_last = (row_ndx == last_row_ndx); - erase(row_ndx, is_last); // Throws -} - -template -void Column::erase(size_t row_ndx, bool is_last) -{ - size_t num_rows_to_erase = 1; - do_erase(row_ndx, num_rows_to_erase, is_last); // Throws -} - -template -void Column::move_last_over_without_updating_index(size_t row_ndx, size_t last_row_ndx) -{ - m_tree.move_last_over(row_ndx, last_row_ndx); -} - -template -void Column::move_last_over(size_t row_ndx, size_t last_row_ndx) -{ - REALM_ASSERT_3(row_ndx, <=, last_row_ndx); - REALM_ASSERT_DEBUG(last_row_ndx + 1 == size()); - - if (has_search_index()) { - // remove the value to be overwritten from index - bool is_last = true; // This tells StringIndex::erase() to not adjust subsequent indexes - m_search_index->erase(row_ndx, is_last); // Throws - - // update index to point to new location - if (row_ndx != last_row_ndx) { - T moved_value = get(last_row_ndx); - m_search_index->update_ref(moved_value, last_row_ndx, row_ndx); // Throws - } - } - - move_last_over_without_updating_index(row_ndx, last_row_ndx); -} - -template -void Column::swap_rows(size_t row_ndx_1, size_t row_ndx_2) -{ - REALM_ASSERT_3(row_ndx_1, <, size()); - REALM_ASSERT_3(row_ndx_2, <, size()); - REALM_ASSERT_DEBUG(row_ndx_1 != row_ndx_2); - - if (has_search_index()) { - T value_1 = get(row_ndx_1); - T value_2 = get(row_ndx_2); - size_t column_size = this->size(); - bool row_ndx_1_is_last = row_ndx_1 == column_size - 1; - bool row_ndx_2_is_last = row_ndx_2 == column_size - 1; - m_search_index->erase(row_ndx_1, row_ndx_1_is_last); - m_search_index->insert(row_ndx_1, value_2, 1, row_ndx_1_is_last); - - m_search_index->erase(row_ndx_2, row_ndx_2_is_last); - m_search_index->insert(row_ndx_2, value_1, 1, row_ndx_2_is_last); - } - - swap_rows_without_updating_index(row_ndx_1, row_ndx_2); -} - -template -void Column::swap_rows_without_updating_index(size_t row_ndx_1, size_t row_ndx_2) -{ - // FIXME: This can be optimized with direct getters and setters. - T value_1 = get(row_ndx_1); - T value_2 = get(row_ndx_2); - m_tree.set(row_ndx_1, value_2); - m_tree.set(row_ndx_2, value_1); -} - -template -void Column::clear_without_updating_index() -{ - m_tree.clear(); // Throws -} - -template -void Column::clear() -{ - if (has_search_index()) { - m_search_index->clear(); - } - clear_without_updating_index(); -} - -template -struct NullOrDefaultValue; -template -struct NullOrDefaultValue::value>::type> { - static T null_or_default_value(bool is_null) - { - if (is_null) { - return null::get_null_float(); - } - else { - return T{}; - } - } -}; -template -struct NullOrDefaultValue, void> { - static util::Optional null_or_default_value(bool is_null) - { - if (is_null) { - return util::none; - } - else { - return util::some(T{}); - } - } -}; -template -struct NullOrDefaultValue::value>::type> { - static T null_or_default_value(bool is_null) - { - REALM_ASSERT(!is_null); - return T{}; - } -}; - -// Implementing pure virtual method of ColumnBase. -template -void Column::insert_rows(size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows, bool insert_nulls) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(row_ndx <= prior_num_rows); - - size_t row_ndx_2 = (row_ndx == prior_num_rows ? realm::npos : row_ndx); - T value = NullOrDefaultValue::null_or_default_value(insert_nulls); - insert(row_ndx_2, value, num_rows_to_insert); // Throws -} - -// Implementing pure virtual method of ColumnBase. -template -void Column::erase_rows(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, bool) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(num_rows_to_erase <= prior_num_rows); - REALM_ASSERT(row_ndx <= prior_num_rows - num_rows_to_erase); - - bool is_last = (row_ndx + num_rows_to_erase == prior_num_rows); - do_erase(row_ndx, num_rows_to_erase, is_last); // Throws -} - -// Implementing pure virtual method of ColumnBase. -template -void Column::move_last_row_over(size_t row_ndx, size_t prior_num_rows, bool) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(row_ndx < prior_num_rows); - - size_t last_row_ndx = prior_num_rows - 1; - move_last_over(row_ndx, last_row_ndx); // Throws -} - -// Implementing pure virtual method of ColumnBase. -template -void Column::clear(size_t, bool) -{ - clear(); // Throws -} - - -template -size_t Column::lower_bound(T value) const noexcept -{ - if (root_is_leaf()) { - auto root = static_cast(get_root_array()); - return root->lower_bound(value); - } - return ColumnBase::lower_bound(*this, value); -} - -template -size_t Column::upper_bound(T value) const noexcept -{ - if (root_is_leaf()) { - auto root = static_cast(get_root_array()); - return root->upper_bound(value); - } - return ColumnBase::upper_bound(*this, value); -} - -// For a *sorted* Column, return first element E for which E >= target or return -1 if none -template -size_t Column::find_gte(T target, size_t start) const -{ - // fixme: slow reference implementation. See Array::find_gte for faster version - size_t ref = 0; - size_t idx; - for (idx = start; idx < size(); ++idx) { - if (get(idx) >= target) { - ref = idx; - break; - } - } - if (idx == size()) - ref = not_found; - - return ref; -} - - -template -bool Column::compare(const Column& c) const noexcept -{ - size_t n = size(); - if (c.size() != n) - return false; - for (size_t i = 0; i < n; ++i) { - bool left_is_null = is_null(i); - bool right_is_null = c.is_null(i); - if (left_is_null != right_is_null) { - return false; - } - if (!left_is_null) { - if (get(i) != c.get(i)) - return false; - } - } - return true; -} - -template -int Column::compare_values(size_t row1, size_t row2) const noexcept -{ - return ColumnBase::compare_values(this, row1, row2); -} - -template -class Column::CreateHandler : public ColumnBase::CreateHandler { -public: - CreateHandler(Array::Type leaf_type, T value, Allocator& alloc) - : m_value(value) - , m_alloc(alloc) - , m_leaf_type(leaf_type) - { - } - ref_type create_leaf(size_t size) override - { - MemRef mem = BpTree::create_leaf(m_leaf_type, size, m_value, m_alloc); // Throws - return mem.get_ref(); - } - -private: - const T m_value; - Allocator& m_alloc; - Array::Type m_leaf_type; -}; - -template -ref_type Column::create(Allocator& alloc, Array::Type leaf_type, size_t size, T value) -{ - CreateHandler handler(leaf_type, std::move(value), alloc); - return ColumnBase::create(alloc, size, handler); -} - -template -ref_type Column::write(size_t slice_offset, size_t slice_size, size_t table_size, _impl::OutputStream& out) const -{ - return m_tree.write(slice_offset, slice_size, table_size, out); -} - -template -void Column::refresh_accessor_tree(size_t new_col_ndx, const Spec& spec) -{ - m_tree.init_from_parent(); - ColumnBaseWithIndex::refresh_accessor_tree(new_col_ndx, spec); -} - -template -void Column::do_erase(size_t row_ndx, size_t num_rows_to_erase, bool is_last) -{ - if (has_search_index()) { - for (size_t i = num_rows_to_erase; i > 0; --i) { - size_t row_ndx_2 = row_ndx + i - 1; - m_search_index->erase(row_ndx_2, is_last); // Throws - } - } - for (size_t i = num_rows_to_erase; i > 0; --i) { - size_t row_ndx_2 = row_ndx + i - 1; - erase_without_updating_index(row_ndx_2, is_last); // Throws - } -} - -template -void Column::verify() const -{ -#ifdef REALM_DEBUG - m_tree.verify(); -#endif -} - -// LCOV_EXCL_START - -template -void Column::to_dot(std::ostream& out, StringData title) const -{ -#ifdef REALM_DEBUG - ref_type ref = get_root_array()->get_ref(); - out << "subgraph cluster_integer_column" << ref << " {" << std::endl; - out << " label = \"Integer column"; - if (title.size() != 0) - out << "\\n'" << title << "'"; - out << "\";" << std::endl; - tree_to_dot(out); - out << "}" << std::endl; -#else - static_cast(out); - static_cast(title); -#endif -} - -template -void Column::leaf_to_dot(MemRef leaf_mem, ArrayParent* parent, size_t ndx_in_parent, std::ostream& out) const -{ -#ifdef REALM_DEBUG - BpTree::leaf_to_dot(leaf_mem, parent, ndx_in_parent, out, get_alloc()); -#else - static_cast(leaf_mem); - static_cast(parent); - static_cast(ndx_in_parent); - static_cast(out); -#endif -} - -template -void Column::do_dump_node_structure(std::ostream& out, int level) const -{ -#ifdef REALM_DEBUG - dump_node_structure(*get_root_array(), out, level); -#else - static_cast(out); - static_cast(level); -#endif -} - -#ifdef REALM_DEBUG - -template -void Column::tree_to_dot(std::ostream& out) const -{ - ColumnBase::bptree_to_dot(get_root_array(), out); -} - - -template -MemStats Column::stats() const -{ - MemStats mem_stats; - get_root_array()->stats(mem_stats); - return mem_stats; -} - -namespace _impl { -void leaf_dumper(MemRef mem, Allocator& alloc, std::ostream& out, int level); -} - -template -void Column::dump_node_structure(const Array& root, std::ostream& out, int level) -{ - root.dump_bptree_structure(out, level, &_impl::leaf_dumper); -} - -#endif - -template -std::pair Column::get_to_dot_parent(size_t ndx_in_parent) const -{ - auto root = get_root_array(); - if (root->is_inner_bptree_node()) { - std::pair p = static_cast(root)->get_bptree_leaf(ndx_in_parent); - return std::make_pair(p.first.get_ref(), p.second); - } - else { - return std::make_pair(root->get_ref(), ndx_in_parent); - } -} - -// LCOV_EXCL_STOP ignore debug functions - - -template -ColumnRandIterator::ColumnRandIterator(const Column* src_col, size_t ndx) - : m_col_ndx(ndx) - , m_col(src_col) -{ -} - -template -bool ColumnRandIterator::operator==(const ColumnRandIterator& rhs) const -{ - return (m_col_ndx == rhs.m_col_ndx); -} - -template -bool ColumnRandIterator::operator!=(const ColumnRandIterator& rhs) const -{ - return !(*this == rhs); -} - -template -bool ColumnRandIterator::operator<(const ColumnRandIterator& rhs) const -{ - return m_col_ndx < rhs.m_col_ndx; -} - -template -bool ColumnRandIterator::operator>(const ColumnRandIterator& rhs) const -{ - return rhs < *this; -} - -template -bool ColumnRandIterator::operator<=(const ColumnRandIterator& rhs) const -{ - return !(rhs < *this); -} - -template -bool ColumnRandIterator::operator>=(const ColumnRandIterator& rhs) const -{ - return !(*this < rhs); -} - -template -ColumnRandIterator& ColumnRandIterator::operator+=(ptrdiff_t movement) -{ - m_col_ndx += movement; - return (*this); -} - -template -ColumnRandIterator& ColumnRandIterator::operator-=(ptrdiff_t movement) -{ - m_col_ndx -= movement; - return (*this); -} - -template -ColumnRandIterator& ColumnRandIterator::operator++() -{ - ++m_col_ndx; - return (*this); -} - -template -ColumnRandIterator& ColumnRandIterator::operator--() -{ - --m_col_ndx; - return (*this); -} - -template -ColumnRandIterator ColumnRandIterator::operator++(int) -{ - auto temp(*this); - ++m_col_ndx; - return temp; -} - -template -ColumnRandIterator ColumnRandIterator::operator--(int) -{ - auto temp(*this); - --m_col_ndx; - return temp; -} - -template -ColumnRandIterator ColumnRandIterator::operator+(ptrdiff_t movement) -{ - return ColumnRandIterator(m_col, m_col_ndx + movement); -} - -template -ColumnRandIterator ColumnRandIterator::operator-(ptrdiff_t movement) -{ - return ColumnRandIterator(m_col, m_col_ndx - movement); -} - -template -ptrdiff_t ColumnRandIterator::operator-(const ColumnRandIterator& other) -{ - return m_col_ndx - other.m_col_ndx; -} - -template -const ColumnDataType ColumnRandIterator::operator*() const -{ - return m_col->get(m_col_ndx); -} - -template -const ColumnDataType ColumnRandIterator::operator->() const -{ - return m_col->get(m_col_ndx); -} - -template -const ColumnDataType ColumnRandIterator::operator[](ptrdiff_t offset) const -{ - return m_col->get(m_col_ndx + offset); -} - -template -size_t ColumnRandIterator::get_col_ndx() const -{ - return m_col_ndx; -} - -template -std::ostream& operator<<(std::ostream& out, const ColumnRandIterator& it) -{ - out << "ColumnRandIterator at index: " << it.get_col_ndx(); - return out; -} - -} // namespace realm - -#endif // REALM_COLUMN_HPP diff --git a/Pods/Realm/include/core/realm/column_backlink.hpp b/Pods/Realm/include/core/realm/column_backlink.hpp deleted file mode 100644 index 11ba6e55..00000000 --- a/Pods/Realm/include/core/realm/column_backlink.hpp +++ /dev/null @@ -1,228 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_BACKLINK_HPP -#define REALM_COLUMN_BACKLINK_HPP - -#include - -#include -#include -#include - -namespace realm { - -/// A column of backlinks (BacklinkColumn) is a single B+-tree, and the root of -/// the column is the root of the B+-tree. All leaf nodes are single arrays of -/// type Array with the hasRefs bit set. -/// -/// The individual values in the column are either refs to Columns containing -/// the row indexes in the origin table that links to it, or in the case where -/// there is a single link, a tagged ref encoding the origin row position. -class BacklinkColumn : public IntegerColumn, public ArrayParent { -public: - BacklinkColumn(Allocator&, ref_type, size_t col_ndx = npos); - ~BacklinkColumn() noexcept override - { - } - - static ref_type create(Allocator&, size_t size = 0); - - bool has_backlinks(size_t row_ndx) const noexcept; - size_t get_backlink_count(size_t row_ndx) const noexcept; - size_t get_backlink(size_t row_ndx, size_t backlink_ndx) const noexcept; - - void add_backlink(size_t row_ndx, size_t origin_row_ndx); - void remove_one_backlink(size_t row_ndx, size_t origin_row_ndx); - void remove_all_backlinks(size_t num_rows); - void update_backlink(size_t row_ndx, size_t old_origin_row_ndx, size_t new_origin_row_ndx); - void swap_backlinks(size_t row_ndx, size_t origin_row_ndx_1, size_t origin_row_ndx_2); - - void add_row(); - - // Link origination info - Table& get_origin_table() const noexcept; - void set_origin_table(Table&) noexcept; - LinkColumnBase& get_origin_column() const noexcept; - size_t get_origin_column_index() const noexcept; - void set_origin_column(LinkColumnBase& column) noexcept; - - void insert_rows(size_t, size_t, size_t, bool) override; - void erase_rows(size_t, size_t, size_t, bool) override; - void move_last_row_over(size_t, size_t, bool) override; - void swap_rows(size_t, size_t) override; - void clear(size_t, bool) override; - void adj_acc_insert_rows(size_t, size_t) noexcept override; - void adj_acc_erase_row(size_t) noexcept override; - void adj_acc_move_over(size_t, size_t) noexcept override; - void adj_acc_swap_rows(size_t, size_t) noexcept override; - void adj_acc_clear_root_table() noexcept override; - void mark(int) noexcept override; - - void bump_link_origin_table_version() noexcept override; - - void cascade_break_backlinks_to(size_t row_ndx, CascadeState& state) override; - void cascade_break_backlinks_to_all_rows(size_t num_rows, CascadeState&) override; - - int compare_values(size_t, size_t) const noexcept override; - - void verify() const override; - void verify(const Table&, size_t) const override; -#ifdef REALM_DEBUG - struct VerifyPair { - size_t origin_row_ndx, target_row_ndx; - bool operator<(const VerifyPair&) const noexcept; - }; - void get_backlinks(std::vector&); // Sorts -#endif - -protected: - // ArrayParent overrides - void update_child_ref(size_t child_ndx, ref_type new_ref) override; - ref_type get_child_ref(size_t child_ndx) const noexcept override; - - std::pair get_to_dot_parent(size_t) const override; - -private: - TableRef m_origin_table; - LinkColumnBase* m_origin_column = nullptr; - - template - size_t for_each_link(size_t row_ndx, bool do_destroy, Func&& f); -}; - - -// Implementation - -inline BacklinkColumn::BacklinkColumn(Allocator& alloc, ref_type ref, size_t col_ndx) - : IntegerColumn(alloc, ref, col_ndx) // Throws -{ -} - -inline ref_type BacklinkColumn::create(Allocator& alloc, size_t size) -{ - return IntegerColumn::create(alloc, Array::type_HasRefs, size); // Throws -} - -inline bool BacklinkColumn::has_backlinks(size_t ndx) const noexcept -{ - return IntegerColumn::get(ndx) != 0; -} - -inline Table& BacklinkColumn::get_origin_table() const noexcept -{ - return *m_origin_table; -} - -inline void BacklinkColumn::set_origin_table(Table& table) noexcept -{ - REALM_ASSERT(!m_origin_table); - m_origin_table = table.get_table_ref(); -} - -inline LinkColumnBase& BacklinkColumn::get_origin_column() const noexcept -{ - return *m_origin_column; -} - -inline size_t BacklinkColumn::get_origin_column_index() const noexcept -{ - return m_origin_column ? m_origin_column->get_column_index() : npos; -} - -inline void BacklinkColumn::set_origin_column(LinkColumnBase& column) noexcept -{ - m_origin_column = &column; -} - -inline void BacklinkColumn::add_row() -{ - IntegerColumn::add(0); -} - -inline void BacklinkColumn::adj_acc_insert_rows(size_t row_ndx, size_t num_rows) noexcept -{ - IntegerColumn::adj_acc_insert_rows(row_ndx, num_rows); - - typedef _impl::TableFriend tf; - tf::mark(*m_origin_table); -} - -inline void BacklinkColumn::adj_acc_erase_row(size_t row_ndx) noexcept -{ - IntegerColumn::adj_acc_erase_row(row_ndx); - - typedef _impl::TableFriend tf; - tf::mark(*m_origin_table); -} - -inline void BacklinkColumn::adj_acc_move_over(size_t from_row_ndx, size_t to_row_ndx) noexcept -{ - IntegerColumn::adj_acc_move_over(from_row_ndx, to_row_ndx); - - typedef _impl::TableFriend tf; - tf::mark(*m_origin_table); -} - -inline void BacklinkColumn::adj_acc_swap_rows(size_t row_ndx_1, size_t row_ndx_2) noexcept -{ - Column::adj_acc_swap_rows(row_ndx_1, row_ndx_2); - - using tf = _impl::TableFriend; - tf::mark(*m_origin_table); -} - -inline void BacklinkColumn::adj_acc_clear_root_table() noexcept -{ - IntegerColumn::adj_acc_clear_root_table(); - - typedef _impl::TableFriend tf; - tf::mark(*m_origin_table); -} - -inline void BacklinkColumn::mark(int type) noexcept -{ - if (type & mark_LinkOrigins) { - typedef _impl::TableFriend tf; - tf::mark(*m_origin_table); - } -} - -inline void BacklinkColumn::bump_link_origin_table_version() noexcept -{ - // It is important to mark connected tables as modified. - // Also see LinkColumnBase::bump_link_origin_table_version(). - typedef _impl::TableFriend tf; - if (m_origin_table) { - bool bump_global = false; - tf::bump_version(*m_origin_table, bump_global); - } -} - -#ifdef REALM_DEBUG - -inline bool BacklinkColumn::VerifyPair::operator<(const VerifyPair& p) const noexcept -{ - return origin_row_ndx < p.origin_row_ndx; -} - -#endif // REALM_DEBUG - -} // namespace realm - -#endif // REALM_COLUMN_BACKLINK_HPP diff --git a/Pods/Realm/include/core/realm/column_binary.hpp b/Pods/Realm/include/core/realm/column_binary.hpp deleted file mode 100644 index c891297a..00000000 --- a/Pods/Realm/include/core/realm/column_binary.hpp +++ /dev/null @@ -1,429 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_BINARY_HPP -#define REALM_COLUMN_BINARY_HPP - -#include -#include -#include - -namespace realm { - - -/// A binary column (BinaryColumn) is a single B+-tree, and the root -/// of the column is the root of the B+-tree. Leaf nodes are either of -/// type ArrayBinary (array of small blobs) or ArrayBigBlobs (array of -/// big blobs). -class BinaryColumn : public ColumnBaseSimple { -public: - typedef BinaryData value_type; - - BinaryColumn(Allocator&, ref_type, bool nullable = false, size_t column_ndx = npos); - - size_t size() const noexcept final; - bool is_empty() const noexcept - { - return size() == 0; - } - bool is_nullable() const noexcept override; - - BinaryData get(size_t ndx) const noexcept; - - /// Return data from position 'pos' and onwards. If the blob is distributed - /// across multiple arrays (if bigger than ~ 16M), you will only get data - /// from one array. 'pos' will be updated to be an index to next available - /// data. It will be 0 if no more data. - BinaryData get_at(size_t ndx, size_t& pos) const noexcept; - - bool is_null(size_t ndx) const noexcept override; - StringData get_index_data(size_t, StringIndex::StringConversionBuffer&) const noexcept final; - - void add(BinaryData value); - void set(size_t ndx, BinaryData value, bool add_zero_term = false); - void set_null(size_t ndx) override; - void insert(size_t ndx, BinaryData value); - void erase(size_t row_ndx); - void erase(size_t row_ndx, bool is_last); - void move_last_over(size_t row_ndx); - void swap_rows(size_t row_ndx_1, size_t row_ndx_2) override; - void clear(); - size_t find_first(BinaryData value) const; - - // Requires that the specified entry was inserted as StringData. - StringData get_string(size_t ndx) const noexcept; - - void add_string(StringData value); - void set_string(size_t ndx, StringData value) override; - void insert_string(size_t ndx, StringData value); - - /// Compare two binary columns for equality. - bool compare_binary(const BinaryColumn&) const; - - int compare_values(size_t row1, size_t row2) const noexcept override; - - static ref_type create(Allocator&, size_t size, bool nullable); - - static size_t get_size_from_ref(ref_type root_ref, Allocator&) noexcept; - - // Overrriding method in ColumnBase - ref_type write(size_t, size_t, size_t, _impl::OutputStream&) const override; - - void insert_rows(size_t, size_t, size_t, bool) override; - void erase_rows(size_t, size_t, size_t, bool) override; - void move_last_row_over(size_t, size_t, bool) override; - void clear(size_t, bool) override; - void update_from_parent(size_t) noexcept override; - void refresh_accessor_tree(size_t, const Spec&) override; - - /// In contrast to update_from_parent(), this function is able to handle - /// cases where the accessed payload data has changed. In particular, it - /// handles cases where the B+-tree switches from having one level (root is - /// a leaf node), to having multiple levels (root is an inner node). Note - /// that this is at the expense of loosing the `noexcept` guarantee. - void update_from_ref(ref_type ref); - - void verify() const override; - void to_dot(std::ostream&, StringData title) const override; - void do_dump_node_structure(std::ostream&, int) const override; - -private: - /// \param row_ndx Must be `realm::npos` if appending. - void do_insert(size_t row_ndx, BinaryData value, bool add_zero_term, size_t num_rows); - - // Called by Array::bptree_insert(). - static ref_type leaf_insert(MemRef leaf_mem, ArrayParent&, size_t ndx_in_parent, Allocator&, size_t insert_ndx, - BpTreeNode::TreeInsert& state); - - struct InsertState : BpTreeNode::TreeInsert { - bool m_add_zero_term; - }; - - class EraseLeafElem; - class CreateHandler; - class SliceHandler; - - void do_move_last_over(size_t row_ndx, size_t last_row_ndx); - void do_clear(); - - /// Root must be a leaf. Upgrades the root leaf if - /// necessary. Returns true if, and only if the root is a 'big - /// blobs' leaf upon return. - bool upgrade_root_leaf(size_t value_size); - - bool m_nullable = false; - - void leaf_to_dot(MemRef, ArrayParent*, size_t ndx_in_parent, std::ostream&) const override; - - friend class BpTreeNode; - friend class ColumnBase; -}; - -class BinaryIterator { -public: - BinaryIterator() - { - } - // TODO: When WriteLogCollector is removed, there is no need for this - BinaryIterator(BinaryData binary) - : m_binary(binary) - { - } - - BinaryIterator(BinaryColumn* col, size_t ndx) - : m_binary_col(col) - , m_ndx(ndx) - { - } - - BinaryData get_next() noexcept - { - if (!end_of_data) { - if (m_binary_col) { - BinaryData ret = m_binary_col->get_at(m_ndx, m_pos); - end_of_data = (m_pos == 0); - return ret; - } - else if (!m_binary.is_null()) { - end_of_data = true; - return m_binary; - } - } - return {}; - } - -private: - bool end_of_data = false; - BinaryColumn* m_binary_col = nullptr; - size_t m_ndx = 0; - size_t m_pos = 0; - BinaryData m_binary; -}; - - -// Implementation - -// LCOV_EXCL_START -inline StringData BinaryColumn::get_index_data(size_t, StringIndex::StringConversionBuffer&) const noexcept -{ - REALM_ASSERT(false && "Index not implemented for BinaryColumn."); - REALM_UNREACHABLE(); -} -// LCOV_EXCL_STOP - -inline size_t BinaryColumn::size() const noexcept -{ - if (root_is_leaf()) { - bool is_big = m_array->get_context_flag(); - if (!is_big) { - // Small blobs root leaf - ArrayBinary* leaf = static_cast(m_array.get()); - return leaf->size(); - } - // Big blobs root leaf - ArrayBigBlobs* leaf = static_cast(m_array.get()); - return leaf->size(); - } - // Non-leaf root - return static_cast(m_array.get())->get_bptree_size(); -} - -inline bool BinaryColumn::is_nullable() const noexcept -{ - return m_nullable; -} - -inline void BinaryColumn::update_from_parent(size_t old_baseline) noexcept -{ - if (root_is_leaf()) { - bool is_big = m_array->get_context_flag(); - if (!is_big) { - // Small blobs root leaf - REALM_ASSERT(dynamic_cast(m_array.get())); - ArrayBinary* leaf = static_cast(m_array.get()); - leaf->update_from_parent(old_baseline); - return; - } - // Big blobs root leaf - REALM_ASSERT(dynamic_cast(m_array.get())); - ArrayBigBlobs* leaf = static_cast(m_array.get()); - leaf->update_from_parent(old_baseline); - return; - } - // Non-leaf root - m_array->update_from_parent(old_baseline); -} - -inline BinaryData BinaryColumn::get(size_t ndx) const noexcept -{ - REALM_ASSERT_DEBUG(ndx < size()); - if (root_is_leaf()) { - bool is_big = m_array->get_context_flag(); - BinaryData ret; - if (!is_big) { - // Small blobs root leaf - ArrayBinary* leaf = static_cast(m_array.get()); - ret = leaf->get(ndx); - } - else { - // Big blobs root leaf - ArrayBigBlobs* leaf = static_cast(m_array.get()); - ret = leaf->get(ndx); - } - if (!m_nullable && ret.is_null()) - return BinaryData("", 0); // return empty string (non-null) - return ret; - } - - // Non-leaf root - std::pair p = static_cast(m_array.get())->get_bptree_leaf(ndx); - const char* leaf_header = p.first.get_addr(); - size_t ndx_in_leaf = p.second; - Allocator& alloc = m_array->get_alloc(); - bool is_big = Array::get_context_flag_from_header(leaf_header); - if (!is_big) { - // Small blobs - return ArrayBinary::get(leaf_header, ndx_in_leaf, alloc); - } - // Big blobs - return ArrayBigBlobs::get(leaf_header, ndx_in_leaf, alloc); -} - -inline bool BinaryColumn::is_null(size_t ndx) const noexcept -{ - return m_nullable && get(ndx).is_null(); -} - -inline StringData BinaryColumn::get_string(size_t ndx) const noexcept -{ - BinaryData bin = get(ndx); - REALM_ASSERT_3(0, <, bin.size()); - return StringData(bin.data(), bin.size() - 1); -} - -inline void BinaryColumn::set_string(size_t ndx, StringData value) -{ - if (value.is_null() && !m_nullable) - throw LogicError(LogicError::column_not_nullable); - - BinaryData bin(value.data(), value.size()); - bool add_zero_term = true; - set(ndx, bin, add_zero_term); -} - -inline void BinaryColumn::add(BinaryData value) -{ - if (value.is_null() && !m_nullable) - throw LogicError(LogicError::column_not_nullable); - - size_t row_ndx = realm::npos; - bool add_zero_term = false; - size_t num_rows = 1; - do_insert(row_ndx, value, add_zero_term, num_rows); // Throws -} - -inline void BinaryColumn::insert(size_t row_ndx, BinaryData value) -{ - if (value.is_null() && !m_nullable) - throw LogicError(LogicError::column_not_nullable); - - size_t column_size = this->size(); // Slow - REALM_ASSERT_3(row_ndx, <=, column_size); - size_t row_ndx_2 = row_ndx == column_size ? realm::npos : row_ndx; - bool add_zero_term = false; - size_t num_rows = 1; - do_insert(row_ndx_2, value, add_zero_term, num_rows); // Throws -} - -inline void BinaryColumn::set_null(size_t row_ndx) -{ - set(row_ndx, BinaryData{}); -} - -inline size_t BinaryColumn::find_first(BinaryData value) const -{ - for (size_t t = 0; t < size(); t++) - if (get(t) == value) - return t; - - return not_found; -} - - -inline void BinaryColumn::erase(size_t row_ndx) -{ - size_t last_row_ndx = size() - 1; // Note that size() is slow - bool is_last = row_ndx == last_row_ndx; - erase(row_ndx, is_last); // Throws -} - -inline void BinaryColumn::move_last_over(size_t row_ndx) -{ - size_t last_row_ndx = size() - 1; // Note that size() is slow - do_move_last_over(row_ndx, last_row_ndx); // Throws -} - -inline void BinaryColumn::clear() -{ - do_clear(); // Throws -} - -// Implementing pure virtual method of ColumnBase. -inline void BinaryColumn::insert_rows(size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows, - bool insert_nulls) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(row_ndx <= prior_num_rows); - REALM_ASSERT(!insert_nulls || m_nullable); - - size_t row_ndx_2 = (row_ndx == prior_num_rows ? realm::npos : row_ndx); - BinaryData value = m_nullable ? BinaryData() : BinaryData("", 0); - bool add_zero_term = false; - do_insert(row_ndx_2, value, add_zero_term, num_rows_to_insert); // Throws -} - -// Implementing pure virtual method of ColumnBase. -inline void BinaryColumn::erase_rows(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, bool) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(num_rows_to_erase <= prior_num_rows); - REALM_ASSERT(row_ndx <= prior_num_rows - num_rows_to_erase); - - bool is_last = (row_ndx + num_rows_to_erase == prior_num_rows); - for (size_t i = num_rows_to_erase; i > 0; --i) { - size_t row_ndx_2 = row_ndx + i - 1; - erase(row_ndx_2, is_last); // Throws - } -} - -// Implementing pure virtual method of ColumnBase. -inline void BinaryColumn::move_last_row_over(size_t row_ndx, size_t prior_num_rows, bool) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(row_ndx < prior_num_rows); - - size_t last_row_ndx = prior_num_rows - 1; - do_move_last_over(row_ndx, last_row_ndx); // Throws -} - -// Implementing pure virtual method of ColumnBase. -inline void BinaryColumn::clear(size_t, bool) -{ - do_clear(); // Throws -} - -inline void BinaryColumn::add_string(StringData value) -{ - size_t row_ndx = realm::npos; - BinaryData value_2(value.data(), value.size()); - bool add_zero_term = true; - size_t num_rows = 1; - do_insert(row_ndx, value_2, add_zero_term, num_rows); // Throws -} - -inline void BinaryColumn::insert_string(size_t row_ndx, StringData value) -{ - size_t column_size = this->size(); // Slow - REALM_ASSERT_3(row_ndx, <=, column_size); - size_t row_ndx_2 = row_ndx == column_size ? realm::npos : row_ndx; - BinaryData value_2(value.data(), value.size()); - bool add_zero_term = false; - size_t num_rows = 1; - do_insert(row_ndx_2, value_2, add_zero_term, num_rows); // Throws -} - -inline size_t BinaryColumn::get_size_from_ref(ref_type root_ref, Allocator& alloc) noexcept -{ - const char* root_header = alloc.translate(root_ref); - bool root_is_leaf = !Array::get_is_inner_bptree_node_from_header(root_header); - if (root_is_leaf) { - bool is_big = Array::get_context_flag_from_header(root_header); - if (!is_big) { - // Small blobs leaf - return ArrayBinary::get_size_from_header(root_header, alloc); - } - // Big blobs leaf - return ArrayBigBlobs::get_size_from_header(root_header); - } - return BpTreeNode::get_bptree_size_from_header(root_header); -} - - -} // namespace realm - -#endif // REALM_COLUMN_BINARY_HPP diff --git a/Pods/Realm/include/core/realm/column_fwd.hpp b/Pods/Realm/include/core/realm/column_fwd.hpp deleted file mode 100644 index 1eecf01d..00000000 --- a/Pods/Realm/include/core/realm/column_fwd.hpp +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_FWD_HPP -#define REALM_COLUMN_FWD_HPP - -#include - -namespace realm { - -// Regular classes -class ColumnBase; -class StringColumn; -class StringEnumColumn; -class BinaryColumn; -class SubtableColumn; -class MixedColumn; -class LinkColumn; -class LinkListColumn; - -// Templated classes -template -class Column; -template -class BasicColumn; -template -class ColumnRandIterator; - -namespace util { -template -class Optional; -} - -// Shortcuts, aka typedefs. -using IntegerColumn = Column; -using IntNullColumn = Column>; -using DoubleColumn = Column; -using FloatColumn = Column; -using IntegerColumnIterator = ColumnRandIterator; -} // namespace realm - -#endif // REALM_COLUMN_FWD_HPP diff --git a/Pods/Realm/include/core/realm/column_link.hpp b/Pods/Realm/include/core/realm/column_link.hpp deleted file mode 100644 index 18471bbe..00000000 --- a/Pods/Realm/include/core/realm/column_link.hpp +++ /dev/null @@ -1,179 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_LINK_HPP -#define REALM_COLUMN_LINK_HPP - -#include -#include -#include - -namespace realm { - -/// A link column is an extension of an integer column (Column) and maintains -/// its node structure. -/// -/// The individual values in a link column are indexes of rows in the target -/// table (offset with one to allow zero to indicate null links.) The target -/// table is specified by the table descriptor. -class LinkColumn : public LinkColumnBase { -public: - using LinkColumnBase::LinkColumnBase; - ~LinkColumn() noexcept override; - - static ref_type create(Allocator&, size_t size = 0); - - bool is_nullable() const noexcept override; - - //@{ - - /// is_null_link() is shorthand for `get_link() == realm::npos`, - /// nullify_link() is shorthand foe `set_link(realm::npos)`, and - /// insert_null_link() is shorthand for - /// `insert_link(realm::npos)`. set_link() returns the original link, with - /// `realm::npos` indicating that it was null. - - size_t get_link(size_t row_ndx) const noexcept; - bool is_null(size_t row_ndx) const noexcept override; - bool is_null_link(size_t row_ndx) const noexcept; - size_t set_link(size_t row_ndx, size_t target_row_ndx); - void set_null(size_t row_ndx) override; - void nullify_link(size_t row_ndx); - void insert_link(size_t row_ndx, size_t target_row_ndx); - void insert_null_link(size_t row_ndx); - - //@} - - void insert_rows(size_t, size_t, size_t, bool) override; - void erase_rows(size_t, size_t, size_t, bool) override; - void move_last_row_over(size_t, size_t, bool) override; - void swap_rows(size_t, size_t) override; - void clear(size_t, bool) override; - void cascade_break_backlinks_to(size_t, CascadeState&) override; - void cascade_break_backlinks_to_all_rows(size_t, CascadeState&) override; - - void verify(const Table&, size_t) const override; - -protected: - friend class BacklinkColumn; - void do_nullify_link(size_t row_ndx, size_t old_target_row_ndx) override; - void do_update_link(size_t row_ndx, size_t old_target_row_ndx, size_t new_target_row_ndx) override; - void do_swap_link(size_t row_ndx, size_t target_row_ndx_1, size_t target_row_ndx_2) override; - -private: - void remove_backlinks(size_t row_ndx); -}; - - -// Implementation - -inline LinkColumn::~LinkColumn() noexcept -{ -} - -inline bool LinkColumn::is_nullable() const noexcept -{ - return true; -} - -inline ref_type LinkColumn::create(Allocator& alloc, size_t size) -{ - return IntegerColumn::create(alloc, Array::type_Normal, size); // Throws -} - -inline bool LinkColumn::is_null(size_t row_ndx) const noexcept -{ - // Null is represented by zero - return LinkColumnBase::get(row_ndx) == 0; -} - -inline size_t LinkColumn::get_link(size_t row_ndx) const noexcept -{ - // Map zero to realm::npos, and `n+1` to `n`, where `n` is a target row index. - return to_size_t(LinkColumnBase::get(row_ndx)) - size_t(1); -} - -inline bool LinkColumn::is_null_link(size_t row_ndx) const noexcept -{ - return is_null(row_ndx); -} - -inline size_t LinkColumn::set_link(size_t row_ndx, size_t target_row_ndx) -{ - int_fast64_t old_value = LinkColumnBase::get(row_ndx); - size_t old_target_row_ndx = to_size_t(old_value) - size_t(1); - if (old_value != 0) - m_backlink_column->remove_one_backlink(old_target_row_ndx, row_ndx); // Throws - - int_fast64_t new_value = int_fast64_t(size_t(1) + target_row_ndx); - LinkColumnBase::set(row_ndx, new_value); // Throws - - if (target_row_ndx != realm::npos) - m_backlink_column->add_backlink(target_row_ndx, row_ndx); // Throws - - return old_target_row_ndx; -} - -inline void LinkColumn::set_null(size_t row_ndx) -{ - set_link(row_ndx, realm::npos); // Throws -} - -inline void LinkColumn::nullify_link(size_t row_ndx) -{ - set_null(row_ndx); // Throws -} - -inline void LinkColumn::insert_link(size_t row_ndx, size_t target_row_ndx) -{ - int_fast64_t value = int_fast64_t(size_t(1) + target_row_ndx); - LinkColumnBase::insert(row_ndx, value); // Throws - - if (target_row_ndx != realm::npos) - m_backlink_column->add_backlink(target_row_ndx, row_ndx); // Throws -} - -inline void LinkColumn::insert_null_link(size_t row_ndx) -{ - insert_link(row_ndx, realm::npos); // Throws -} - -inline void LinkColumn::do_update_link(size_t row_ndx, size_t, size_t new_target_row_ndx) -{ - // Row pos is offset by one, to allow null refs - LinkColumnBase::set(row_ndx, new_target_row_ndx + 1); -} - -inline void LinkColumn::do_swap_link(size_t row_ndx, size_t target_row_ndx_1, size_t target_row_ndx_2) -{ - // Row pos is offset by one, to allow null refs - ++target_row_ndx_1; - ++target_row_ndx_2; - - uint64_t value = LinkColumnBase::get_uint(row_ndx); - if (value == target_row_ndx_1) { - LinkColumnBase::set_uint(row_ndx, target_row_ndx_2); - } - else if (value == target_row_ndx_2) { - LinkColumnBase::set_uint(row_ndx, target_row_ndx_1); - } -} - -} // namespace realm - -#endif // REALM_COLUMN_LINK_HPP diff --git a/Pods/Realm/include/core/realm/column_linkbase.hpp b/Pods/Realm/include/core/realm/column_linkbase.hpp deleted file mode 100644 index cff46b21..00000000 --- a/Pods/Realm/include/core/realm/column_linkbase.hpp +++ /dev/null @@ -1,197 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_LINKBASE_HPP -#define REALM_COLUMN_LINKBASE_HPP - -#include - -namespace realm { - -class BacklinkColumn; -class Table; - -// Abstract base class for columns containing links -class LinkColumnBase : public IntegerColumn { -public: - // Create unattached root array aaccessor. - LinkColumnBase(Allocator& alloc, ref_type ref, Table* table, size_t column_ndx); - ~LinkColumnBase() noexcept override; - - bool is_nullable() const noexcept override = 0; - void set_null(size_t) override = 0; - bool is_null(size_t) const noexcept override = 0; - - bool supports_search_index() const noexcept final - { - return false; - } - StringIndex* create_search_index() override; - - bool get_weak_links() const noexcept; - void set_weak_links(bool) noexcept; - - Table& get_target_table() const noexcept; - void set_target_table(Table&) noexcept; - BacklinkColumn& get_backlink_column() const noexcept; - void set_backlink_column(BacklinkColumn&) noexcept; - - void swap_rows(size_t, size_t) override = 0; - - virtual void do_nullify_link(size_t row_ndx, size_t old_target_row_ndx) = 0; - virtual void do_update_link(size_t row_ndx, size_t old_target_row_ndx, size_t new_target_row_ndx) = 0; - virtual void do_swap_link(size_t row_ndx, size_t target_row_ndx_1, size_t target_row_ndx_2) = 0; - - void adj_acc_insert_rows(size_t, size_t) noexcept override; - void adj_acc_erase_row(size_t) noexcept override; - void adj_acc_move_over(size_t, size_t) noexcept override; - void adj_acc_swap_rows(size_t, size_t) noexcept override; - void adj_acc_clear_root_table() noexcept override; - void mark(int) noexcept override; - void refresh_accessor_tree(size_t, const Spec&) override; - void bump_link_origin_table_version() noexcept override; - - void verify(const Table&, size_t) const override; - using IntegerColumn::verify; - -protected: - // A pointer to the table that this column is part of. - Table* const m_table; - - TableRef m_target_table; - BacklinkColumn* m_backlink_column = nullptr; - bool m_weak_links = false; // True if these links are weak (not strong) - - /// Call Table::cascade_break_backlinks_to() for the specified target row if - /// it is not already in \a state.rows, and the number of strong links to it - /// has dropped to zero. - void check_cascade_break_backlinks_to(size_t target_table_ndx, size_t target_row_ndx, CascadeState& state); -}; - - -// Implementation - -inline LinkColumnBase::LinkColumnBase(Allocator& alloc, ref_type ref, Table* table, size_t column_ndx) - : IntegerColumn(alloc, ref, column_ndx) // Throws - , m_table(table) -{ -} - -inline LinkColumnBase::~LinkColumnBase() noexcept -{ -} - -inline StringIndex* LinkColumnBase::create_search_index() -{ - return nullptr; -} - -inline bool LinkColumnBase::get_weak_links() const noexcept -{ - return m_weak_links; -} - -inline void LinkColumnBase::set_weak_links(bool value) noexcept -{ - m_weak_links = value; -} - -inline Table& LinkColumnBase::get_target_table() const noexcept -{ - return *m_target_table; -} - -inline void LinkColumnBase::set_target_table(Table& table) noexcept -{ - REALM_ASSERT(!m_target_table); - m_target_table = table.get_table_ref(); -} - -inline BacklinkColumn& LinkColumnBase::get_backlink_column() const noexcept -{ - return *m_backlink_column; -} - -inline void LinkColumnBase::set_backlink_column(BacklinkColumn& column) noexcept -{ - m_backlink_column = &column; -} - -inline void LinkColumnBase::adj_acc_insert_rows(size_t row_ndx, size_t num_rows) noexcept -{ - IntegerColumn::adj_acc_insert_rows(row_ndx, num_rows); - - typedef _impl::TableFriend tf; - tf::mark(*m_target_table); -} - -inline void LinkColumnBase::adj_acc_erase_row(size_t row_ndx) noexcept -{ - IntegerColumn::adj_acc_erase_row(row_ndx); - - typedef _impl::TableFriend tf; - tf::mark(*m_target_table); -} - -inline void LinkColumnBase::adj_acc_move_over(size_t from_row_ndx, size_t to_row_ndx) noexcept -{ - IntegerColumn::adj_acc_move_over(from_row_ndx, to_row_ndx); - - typedef _impl::TableFriend tf; - tf::mark(*m_target_table); -} - -inline void LinkColumnBase::adj_acc_swap_rows(size_t row_ndx_1, size_t row_ndx_2) noexcept -{ - IntegerColumn::adj_acc_swap_rows(row_ndx_1, row_ndx_2); - - typedef _impl::TableFriend tf; - tf::mark(*m_target_table); -} - -inline void LinkColumnBase::adj_acc_clear_root_table() noexcept -{ - IntegerColumn::adj_acc_clear_root_table(); - - typedef _impl::TableFriend tf; - tf::mark(*m_target_table); -} - -inline void LinkColumnBase::mark(int type) noexcept -{ - if (type & mark_LinkTargets) { - typedef _impl::TableFriend tf; - tf::mark(*m_target_table); - } -} - -inline void LinkColumnBase::bump_link_origin_table_version() noexcept -{ - // It is important to mark connected tables as modified. - // Also see BacklinkColumn::bump_link_origin_table_version(). - typedef _impl::TableFriend tf; - if (m_target_table) { - bool bump_global = false; - tf::bump_version(*m_target_table, bump_global); - } -} - - -} // namespace realm - -#endif // REALM_COLUMN_LINKBASE_HPP diff --git a/Pods/Realm/include/core/realm/column_linklist.hpp b/Pods/Realm/include/core/realm/column_linklist.hpp deleted file mode 100644 index 445066ed..00000000 --- a/Pods/Realm/include/core/realm/column_linklist.hpp +++ /dev/null @@ -1,243 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_LINKLIST_HPP -#define REALM_COLUMN_LINKLIST_HPP - -#include -#include - -#include -#include -#include -#include -#include - -namespace realm { - -namespace _impl { -class TransactLogConvenientEncoder; -} - - -/// A column of link lists (LinkListColumn) is a single B+-tree, and the root of -/// the column is the root of the B+-tree. All leaf nodes are single arrays of -/// type Array with the hasRefs bit set. -/// -/// The individual values in the column are either refs to Columns containing the -/// row positions in the target table, or in the case where they are empty, a zero -/// ref. -class LinkListColumn : public LinkColumnBase, public ArrayParent { -public: - using LinkColumnBase::LinkColumnBase; - LinkListColumn(Allocator& alloc, ref_type ref, Table* table, size_t column_ndx); - ~LinkListColumn() noexcept override; - - static ref_type create(Allocator&, size_t size = 0); - - bool is_nullable() const noexcept final; - - bool has_links(size_t row_ndx) const noexcept; - size_t get_link_count(size_t row_ndx) const noexcept; - - ConstLinkViewRef get(size_t row_ndx) const; - LinkViewRef get(size_t row_ndx); - - bool is_null(size_t row_ndx) const noexcept final; - void set_null(size_t row_ndx) final; - - /// Compare two columns for equality. - bool compare_link_list(const LinkListColumn&) const; - - void to_json_row(size_t row_ndx, std::ostream& out) const; - - void insert_rows(size_t, size_t, size_t, bool) override; - void erase_rows(size_t, size_t, size_t, bool) override; - void move_last_row_over(size_t, size_t, bool) override; - void swap_rows(size_t, size_t) override; - void clear(size_t, bool) override; - void cascade_break_backlinks_to(size_t, CascadeState&) override; - void cascade_break_backlinks_to_all_rows(size_t, CascadeState&) override; - void update_from_parent(size_t) noexcept override; - void adj_acc_clear_root_table() noexcept override; - void adj_acc_insert_rows(size_t, size_t) noexcept override; - void adj_acc_erase_row(size_t) noexcept override; - void adj_acc_move_over(size_t, size_t) noexcept override; - void adj_acc_swap_rows(size_t, size_t) noexcept override; - void adj_acc_merge_rows(size_t, size_t) noexcept override; - void refresh_accessor_tree(size_t, const Spec&) override; - - void verify() const override; - void verify(const Table&, size_t) const override; - -protected: - void do_discard_child_accessors() noexcept override; - -private: - struct list_entry { - size_t m_row_ndx; - std::weak_ptr m_list; - bool operator<(const list_entry& other) const - { - return m_row_ndx < other.m_row_ndx; - } - }; - - // The accessors stored in `m_list_accessors` are sorted by their row index. - // When a LinkList accessor is destroyed because the last shared_ptr pointing - // to it dies, its entry is implicitly replaced by a tombstone (an entry with - // an empty `m_list`). These tombstones are pruned at a later time by - // `prune_list_accessor_tombstones`. This is done to amortize the O(n) cost - // of `std::vector::erase` that would otherwise be incurred each time an - // accessor is removed. - mutable std::vector m_list_accessors; - mutable std::atomic m_list_accessors_contains_tombstones; - - std::shared_ptr get_ptr(size_t row_ndx) const; - - void do_nullify_link(size_t row_ndx, size_t old_target_row_ndx) override; - void do_update_link(size_t row_ndx, size_t old_target_row_ndx, size_t new_target_row_ndx) override; - void do_swap_link(size_t row_ndx, size_t target_row_ndx_1, size_t target_row_ndx_2) override; - - void unregister_linkview(); - ref_type get_row_ref(size_t row_ndx) const noexcept; - void set_row_ref(size_t row_ndx, ref_type new_ref); - void add_backlink(size_t target_row, size_t source_row); - void remove_backlink(size_t target_row, size_t source_row); - - // ArrayParent overrides - void update_child_ref(size_t child_ndx, ref_type new_ref) override; - ref_type get_child_ref(size_t child_ndx) const noexcept override; - - // These helpers are needed because of the way the B+-tree of links is - // traversed in cascade_break_backlinks_to() and - // cascade_break_backlinks_to_all_rows(). - void cascade_break_backlinks_to__leaf(size_t row_ndx, const Array& link_list_leaf, CascadeState&); - void cascade_break_backlinks_to_all_rows__leaf(const Array& link_list_leaf, CascadeState&); - - void discard_child_accessors() noexcept; - - template - void adj_insert_rows(size_t row_ndx, size_t num_rows_inserted) noexcept; - - template - void adj_erase_rows(size_t row_ndx, size_t num_rows_erased) noexcept; - - template - void adj_move_over(size_t from_row_ndx, size_t to_row_ndx) noexcept; - - template - void adj_swap(size_t row_ndx_1, size_t row_ndx_2) noexcept; - - void prune_list_accessor_tombstones() noexcept; - void validate_list_accessors() const noexcept; - - std::pair get_to_dot_parent(size_t) const override; - - friend class BacklinkColumn; - friend class LinkView; - friend class _impl::TransactLogConvenientEncoder; -}; - - -// Implementation - -inline LinkListColumn::LinkListColumn(Allocator& alloc, ref_type ref, Table* table, size_t column_ndx) - : LinkColumnBase(alloc, ref, table, column_ndx) -{ - m_list_accessors_contains_tombstones.store(false); -} - -inline LinkListColumn::~LinkListColumn() noexcept -{ - discard_child_accessors(); -} - -inline ref_type LinkListColumn::create(Allocator& alloc, size_t size) -{ - return IntegerColumn::create(alloc, Array::type_HasRefs, size); // Throws -} - -inline bool LinkListColumn::is_nullable() const noexcept -{ - return false; -} - -inline bool LinkListColumn::has_links(size_t row_ndx) const noexcept -{ - ref_type ref = LinkColumnBase::get_as_ref(row_ndx); - return (ref != 0); -} - -inline size_t LinkListColumn::get_link_count(size_t row_ndx) const noexcept -{ - ref_type ref = LinkColumnBase::get_as_ref(row_ndx); - if (ref == 0) - return 0; - return ColumnBase::get_size_from_ref(ref, get_alloc()); -} - -inline ConstLinkViewRef LinkListColumn::get(size_t row_ndx) const -{ - return get_ptr(row_ndx); -} - -inline LinkViewRef LinkListColumn::get(size_t row_ndx) -{ - return get_ptr(row_ndx); -} - -inline bool LinkListColumn::is_null(size_t) const noexcept -{ - return false; -} - -inline void LinkListColumn::set_null(size_t) -{ - throw LogicError{LogicError::column_not_nullable}; -} - -inline void LinkListColumn::do_discard_child_accessors() noexcept -{ - discard_child_accessors(); -} - -inline ref_type LinkListColumn::get_row_ref(size_t row_ndx) const noexcept -{ - return LinkColumnBase::get_as_ref(row_ndx); -} - -inline void LinkListColumn::set_row_ref(size_t row_ndx, ref_type new_ref) -{ - LinkColumnBase::set(row_ndx, new_ref); // Throws -} - -inline void LinkListColumn::add_backlink(size_t target_row, size_t source_row) -{ - m_backlink_column->add_backlink(target_row, source_row); // Throws -} - -inline void LinkListColumn::remove_backlink(size_t target_row, size_t source_row) -{ - m_backlink_column->remove_one_backlink(target_row, source_row); // Throws -} - - -} // namespace realm - -#endif // REALM_COLUMN_LINKLIST_HPP diff --git a/Pods/Realm/include/core/realm/column_mixed.hpp b/Pods/Realm/include/core/realm/column_mixed.hpp deleted file mode 100644 index 326edad6..00000000 --- a/Pods/Realm/include/core/realm/column_mixed.hpp +++ /dev/null @@ -1,268 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_MIXED_HPP -#define REALM_COLUMN_MIXED_HPP - -#include - -#include -#include -#include -#include -#include -#include - - -namespace realm { - - -// Pre-declarations -class BinaryColumn; - - -/// A mixed column (MixedColumn) is composed of three subcolumns. The first -/// subcolumn is an integer column (Column) and stores value types. The second -/// one stores values and is a subtable parent column (SubtableColumnBase), -/// which is a subclass of an integer column (Column). The last one is a binary -/// column (BinaryColumn) and stores additional data for values of type string -/// or binary data. The last subcolumn is optional. The root of a mixed column -/// is an array node of type Array that stores the root refs of the subcolumns. -class MixedColumn : public ColumnBaseSimple { -public: - /// Create a mixed column wrapper and attach it to a preexisting - /// underlying structure of arrays. - /// - /// \param alloc The memory allocator to change the underlying - /// structure in memory. - /// - /// \param ref The memory reference of the MixedColumn for which - /// this accessor should be creator for. - /// - /// \param table If this column is used as part of a table you - /// must pass a pointer to that table. Otherwise you must pass - /// null - /// - /// \param column_ndx If this column is used as part of a table - /// you must pass the logical index of the column within that - /// table. Otherwise you should pass zero. - MixedColumn(Allocator& alloc, ref_type ref, Table* table, size_t column_ndx); - - ~MixedColumn() noexcept override; - - DataType get_type(size_t ndx) const noexcept; - size_t size() const noexcept final - { - return m_types->size(); - } - bool is_empty() const noexcept - { - return size() == 0; - } - - int64_t get_int(size_t ndx) const noexcept; - bool get_bool(size_t ndx) const noexcept; - OldDateTime get_olddatetime(size_t ndx) const noexcept; - Timestamp get_timestamp(size_t ndx) const noexcept; - float get_float(size_t ndx) const noexcept; - double get_double(size_t ndx) const noexcept; - StringData get_string(size_t ndx) const noexcept; - BinaryData get_binary(size_t ndx) const noexcept; - StringData get_index_data(size_t ndx, StringIndex::StringConversionBuffer& buffer) const noexcept override; - - /// The returned array ref is zero if the specified row does not - /// contain a subtable. - ref_type get_subtable_ref(size_t row_ndx) const noexcept; - - /// The returned size is zero if the specified row does not - /// contain a subtable. - size_t get_subtable_size(size_t row_ndx) const noexcept; - - Table* get_subtable_accessor(size_t row_ndx) const noexcept override; - - void discard_subtable_accessor(size_t row_ndx) noexcept override; - - /// If the value at the specified index is a subtable, return a - /// pointer to that accessor for that subtable. Otherwise return - /// null. The accessor will be created if it does not already - /// exist. - /// - /// The returned table pointer must **always** end up being - /// wrapped in some instantiation of BasicTableRef<>. - Table* get_subtable_ptr(size_t row_ndx); - - const Table* get_subtable_ptr(size_t subtable_ndx) const; - - void set_int(size_t ndx, int64_t value); - void set_bool(size_t ndx, bool value); - void set_olddatetime(size_t ndx, OldDateTime value); - void set_timestamp(size_t ndx, Timestamp value); - void set_float(size_t ndx, float value); - void set_double(size_t ndx, double value); - void set_string(size_t ndx, StringData value) override; - void set_binary(size_t ndx, BinaryData value); - void set_subtable(size_t ndx, const Table* value); - - void insert_int(size_t ndx, int_fast64_t value); - void insert_bool(size_t ndx, bool value); - void insert_olddatetime(size_t ndx, OldDateTime value); - void insert_timestamp(size_t ndx, Timestamp value); - void insert_float(size_t ndx, float value); - void insert_double(size_t ndx, double value); - void insert_string(size_t ndx, StringData value); - void insert_binary(size_t ndx, BinaryData value); - void insert_subtable(size_t ndx, const Table* value); - - void erase(size_t row_ndx); - void move_last_over(size_t row_ndx); - void clear(); - - /// Compare two mixed columns for equality. - bool compare_mixed(const MixedColumn&) const; - - int compare_values(size_t row1, size_t row2) const noexcept override; - - void discard_child_accessors() noexcept; - - static ref_type create(Allocator&, size_t size = 0); - - static size_t get_size_from_ref(ref_type root_ref, Allocator&) noexcept; - - // Overriding method in ColumnBase - ref_type write(size_t, size_t, size_t, _impl::OutputStream&) const override; - - void insert_rows(size_t, size_t, size_t, bool) override; - void erase_rows(size_t, size_t, size_t, bool) override; - void move_last_row_over(size_t, size_t, bool) override; - void swap_rows(size_t, size_t) override; - void clear(size_t, bool) override; - void update_from_parent(size_t) noexcept override; - void adj_acc_insert_rows(size_t, size_t) noexcept override; - void adj_acc_erase_row(size_t) noexcept override; - void adj_acc_move_over(size_t, size_t) noexcept override; - void adj_acc_swap_rows(size_t, size_t) noexcept override; - void adj_acc_clear_root_table() noexcept override; - void mark(int) noexcept override; - void refresh_accessor_tree(size_t, const Spec&) override; - - void verify() const override; - void verify(const Table&, size_t) const override; - void to_dot(std::ostream&, StringData title) const override; - void do_dump_node_structure(std::ostream&, int) const override; - -private: - enum MixedColType { - // NOTE: below numbers must be kept in sync with ColumnType - // Column types used in Mixed - mixcol_Int = 0, - mixcol_Bool = 1, - mixcol_String = 2, - // 3, used for STRING_ENUM in ColumnType - mixcol_Binary = 4, - mixcol_Table = 5, - mixcol_Mixed = 6, - mixcol_OldDateTime = 7, - mixcol_Timestamp = 8, - mixcol_Float = 9, - mixcol_Double = 10, // Positive Double - mixcol_DoubleNeg = 11, // Negative Double - mixcol_IntNeg = 12 // Negative Integers - }; - - class RefsColumn; - - /// Stores the MixedColType of each value at the given index. For - /// values that uses all 64 bits, the type also encodes the sign - /// bit by having distinct types for positive negative values. - std::unique_ptr m_types; - - /// Stores the data for each entry. For a subtable, the stored - /// value is the ref of the subtable. For string, binary data, - /// the stored value is an index within `m_binary_data`. Likewise, - /// for timestamp, an index into `m_timestamp` is stored. For other - /// types the stored value is itself. Since we only have 63 bits - /// available for a non-ref value, the sign of numeric values is - /// encoded as part of the type in `m_types`. - std::unique_ptr m_data; - - /// For string and binary data types, the bytes are stored here. - std::unique_ptr m_binary_data; - - /// Timestamps are stored here. - std::unique_ptr m_timestamp_data; - - void do_erase(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows); - void do_move_last_over(size_t row_ndx, size_t prior_num_rows); - void do_swap_rows(size_t, size_t); - void do_clear(size_t num_rows); - - void create(Allocator&, ref_type, Table*, size_t column_ndx); - void ensure_binary_data_column(); - void ensure_timestamp_column(); - - MixedColType clear_value(size_t ndx, MixedColType new_type); // Returns old type - void clear_value_and_discard_subtab_acc(size_t ndx, MixedColType new_type); - - // Get/set/insert 64-bit values in m_data/m_types - int64_t get_value(size_t ndx) const noexcept; - void set_value(size_t ndx, int64_t value, MixedColType); - void set_int64(size_t ndx, int64_t value, MixedColType pos_type, MixedColType neg_type); - - void insert_value(size_t row_ndx, int_fast64_t types_value, int_fast64_t data_value); - void insert_int(size_t ndx, int_fast64_t value, MixedColType type); - void insert_pos_neg(size_t ndx, int_fast64_t value, MixedColType pos_type, MixedColType neg_type); - - void do_discard_child_accessors() noexcept override; - -#ifdef REALM_DEBUG - void do_verify(const Table*, size_t col_ndx) const; -#endif - void leaf_to_dot(MemRef, ArrayParent*, size_t, std::ostream&) const override; -}; - -// LCOV_EXCL_START -inline StringData MixedColumn::get_index_data(size_t, StringIndex::StringConversionBuffer&) const noexcept -{ - REALM_ASSERT(false && "Index not supported for MixedColumn yet."); - REALM_UNREACHABLE(); - return {}; -} -// LCOV_EXCL_STOP - - -class MixedColumn::RefsColumn : public SubtableColumnBase { -public: - RefsColumn(Allocator& alloc, ref_type ref, Table* table, size_t column_ndx); - ~RefsColumn() noexcept override; - - using SubtableColumnBase::get_subtable_ptr; - - void refresh_accessor_tree(size_t, const Spec&) override; - - friend class MixedColumn; -}; - - -} // namespace realm - - -// Implementation -#include - - -#endif // REALM_COLUMN_MIXED_HPP diff --git a/Pods/Realm/include/core/realm/column_mixed_tpl.hpp b/Pods/Realm/include/core/realm/column_mixed_tpl.hpp deleted file mode 100644 index ca5d4d4e..00000000 --- a/Pods/Realm/include/core/realm/column_mixed_tpl.hpp +++ /dev/null @@ -1,505 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -namespace realm { - -inline MixedColumn::MixedColumn(Allocator& alloc, ref_type ref, Table* table, size_t column_ndx) - : ColumnBaseSimple(column_ndx) -{ - create(alloc, ref, table, column_ndx); -} - -inline void MixedColumn::adj_acc_insert_rows(size_t row_ndx, size_t num_rows) noexcept -{ - m_data->adj_acc_insert_rows(row_ndx, num_rows); -} - -inline void MixedColumn::adj_acc_erase_row(size_t row_ndx) noexcept -{ - m_data->adj_acc_erase_row(row_ndx); -} - -inline void MixedColumn::adj_acc_swap_rows(size_t row_ndx_1, size_t row_ndx_2) noexcept -{ - m_data->adj_acc_swap_rows(row_ndx_1, row_ndx_2); -} - -inline void MixedColumn::adj_acc_move_over(size_t from_row_ndx, size_t to_row_ndx) noexcept -{ - m_data->adj_acc_move_over(from_row_ndx, to_row_ndx); -} - -inline void MixedColumn::adj_acc_clear_root_table() noexcept -{ - m_data->adj_acc_clear_root_table(); -} - -inline ref_type MixedColumn::get_subtable_ref(size_t row_ndx) const noexcept -{ - REALM_ASSERT_3(row_ndx, <, m_types->size()); - if (m_types->get(row_ndx) != type_Table) - return 0; - return m_data->get_as_ref(row_ndx); -} - -inline size_t MixedColumn::get_subtable_size(size_t row_ndx) const noexcept -{ - ref_type top_ref = get_subtable_ref(row_ndx); - if (top_ref == 0) - return 0; - return _impl::TableFriend::get_size_from_ref(top_ref, m_data->get_alloc()); -} - -inline Table* MixedColumn::get_subtable_accessor(size_t row_ndx) const noexcept -{ - return m_data->get_subtable_accessor(row_ndx); -} - -inline void MixedColumn::discard_subtable_accessor(size_t row_ndx) noexcept -{ - m_data->discard_subtable_accessor(row_ndx); -} - -inline Table* MixedColumn::get_subtable_ptr(size_t row_ndx) -{ - REALM_ASSERT_3(row_ndx, <, m_types->size()); - if (m_types->get(row_ndx) != type_Table) - return 0; - return m_data->get_subtable_ptr(row_ndx); // Throws -} - -inline const Table* MixedColumn::get_subtable_ptr(size_t subtable_ndx) const -{ - return const_cast(this)->get_subtable_ptr(subtable_ndx); -} - -inline void MixedColumn::discard_child_accessors() noexcept -{ - m_data->discard_child_accessors(); -} - - -// -// Getters -// - -#define REALM_BIT63 0x8000000000000000ULL - -inline int64_t MixedColumn::get_value(size_t ndx) const noexcept -{ - REALM_ASSERT_3(ndx, <, m_types->size()); - - // Shift the unsigned value right - ensuring 0 gets in from left. - // Shifting signed integers right doesn't ensure 0's. - uint64_t value = uint64_t(m_data->get(ndx)) >> 1; - return int64_t(value); -} - -inline int64_t MixedColumn::get_int(size_t ndx) const noexcept -{ - // Get first 63 bits of the integer value - int64_t value = get_value(ndx); - - // restore 'sign'-bit from the column-type - MixedColType col_type = MixedColType(m_types->get(ndx)); - if (col_type == mixcol_IntNeg) { - // FIXME: Bad cast of result of '|' from unsigned to signed - value |= REALM_BIT63; // set sign bit (63) - } - else { - REALM_ASSERT_3(col_type, ==, mixcol_Int); - } - return value; -} - -inline bool MixedColumn::get_bool(size_t ndx) const noexcept -{ - REALM_ASSERT_3(m_types->get(ndx), ==, mixcol_Bool); - - return (get_value(ndx) != 0); -} - -inline OldDateTime MixedColumn::get_olddatetime(size_t ndx) const noexcept -{ - REALM_ASSERT_3(m_types->get(ndx), ==, mixcol_OldDateTime); - - return OldDateTime(get_value(ndx)); -} - -inline float MixedColumn::get_float(size_t ndx) const noexcept -{ - static_assert(std::numeric_limits::is_iec559, "'float' is not IEEE"); - static_assert((sizeof(float) * CHAR_BIT == 32), "Assume 32 bit float."); - REALM_ASSERT_3(m_types->get(ndx), ==, mixcol_Float); - - return type_punning(get_value(ndx)); -} - -inline double MixedColumn::get_double(size_t ndx) const noexcept -{ - static_assert(std::numeric_limits::is_iec559, "'double' is not IEEE"); - static_assert((sizeof(double) * CHAR_BIT == 64), "Assume 64 bit double."); - - int64_t int_val = get_value(ndx); - - // restore 'sign'-bit from the column-type - MixedColType col_type = MixedColType(m_types->get(ndx)); - if (col_type == mixcol_DoubleNeg) - int_val |= REALM_BIT63; // set sign bit (63) - else { - REALM_ASSERT_3(col_type, ==, mixcol_Double); - } - return type_punning(int_val); -} - -inline StringData MixedColumn::get_string(size_t ndx) const noexcept -{ - REALM_ASSERT_3(ndx, <, m_types->size()); - REALM_ASSERT_3(m_types->get(ndx), ==, mixcol_String); - REALM_ASSERT(m_binary_data); - - size_t data_ndx = size_t(int64_t(m_data->get(ndx)) >> 1); - return m_binary_data->get_string(data_ndx); -} - -inline BinaryData MixedColumn::get_binary(size_t ndx) const noexcept -{ - REALM_ASSERT_3(ndx, <, m_types->size()); - REALM_ASSERT_3(m_types->get(ndx), ==, mixcol_Binary); - REALM_ASSERT(m_binary_data); - - size_t data_ndx = size_t(uint64_t(m_data->get(ndx)) >> 1); - return m_binary_data->get(data_ndx); -} - -inline Timestamp MixedColumn::get_timestamp(size_t ndx) const noexcept -{ - REALM_ASSERT_3(ndx, <, m_types->size()); - REALM_ASSERT_3(m_types->get(ndx), ==, mixcol_Timestamp); - REALM_ASSERT(m_timestamp_data); - size_t data_ndx = size_t(uint64_t(m_data->get(ndx)) >> 1); - return m_timestamp_data->get(data_ndx); -} - -// -// Setters -// - -// Set a int64 value. -// Store 63 bit of the value in m_data. Store sign bit in m_types. - -inline void MixedColumn::set_int64(size_t ndx, int64_t value, MixedColType pos_type, MixedColType neg_type) -{ - REALM_ASSERT_3(ndx, <, m_types->size()); - - // If sign-bit is set in value, 'store' it in the column-type - MixedColType coltype = ((value & REALM_BIT63) == 0) ? pos_type : neg_type; - - // Remove refs or binary data (sets type to double) - clear_value_and_discard_subtab_acc(ndx, coltype); // Throws - - // Shift value one bit and set lowest bit to indicate that this is not a ref - value = (value << 1) + 1; - m_data->set(ndx, value); -} - -inline void MixedColumn::set_int(size_t ndx, int64_t value) -{ - set_int64(ndx, value, mixcol_Int, mixcol_IntNeg); // Throws -} - -inline void MixedColumn::set_double(size_t ndx, double value) -{ - int64_t val64 = type_punning(value); - set_int64(ndx, val64, mixcol_Double, mixcol_DoubleNeg); // Throws -} - -inline void MixedColumn::set_value(size_t ndx, int64_t value, MixedColType coltype) -{ - REALM_ASSERT_3(ndx, <, m_types->size()); - - // Remove refs or binary data (sets type to float) - clear_value_and_discard_subtab_acc(ndx, coltype); // Throws - - // Shift value one bit and set lowest bit to indicate that this is not a ref - int64_t v = (value << 1) + 1; - m_data->set(ndx, v); // Throws -} - -inline void MixedColumn::set_float(size_t ndx, float value) -{ - int64_t val64 = type_punning(value); - set_value(ndx, val64, mixcol_Float); // Throws -} - -inline void MixedColumn::set_bool(size_t ndx, bool value) -{ - set_value(ndx, (value ? 1 : 0), mixcol_Bool); // Throws -} - -inline void MixedColumn::set_olddatetime(size_t ndx, OldDateTime value) -{ - set_value(ndx, int64_t(value.get_olddatetime()), mixcol_OldDateTime); // Throws -} - -inline void MixedColumn::set_subtable(size_t ndx, const Table* t) -{ - REALM_ASSERT_3(ndx, <, m_types->size()); - typedef _impl::TableFriend tf; - ref_type ref; - if (t) { - ref = tf::clone(*t, get_alloc()); // Throws - } - else { - ref = tf::create_empty_table(get_alloc()); // Throws - } - // Remove any previous refs or binary data - clear_value_and_discard_subtab_acc(ndx, mixcol_Table); // Throws - m_data->set(ndx, ref); // Throws -} - -// -// Inserts -// - -inline void MixedColumn::insert_value(size_t row_ndx, int_fast64_t types_value, int_fast64_t data_value) -{ - size_t types_size = m_types->size(); // Slow - bool is_append = row_ndx == types_size; - size_t row_ndx_2 = is_append ? realm::npos : row_ndx; - size_t num_rows = 1; - m_types->insert_without_updating_index(row_ndx_2, types_value, num_rows); // Throws - m_data->do_insert(row_ndx_2, data_value, num_rows); // Throws -} - -// Insert a int64 value. -// Store 63 bit of the value in m_data. Store sign bit in m_types. - -inline void MixedColumn::insert_int(size_t ndx, int_fast64_t value, MixedColType type) -{ - int_fast64_t types_value = type; - // Shift value one bit and set lowest bit to indicate that this is not a ref - int_fast64_t data_value = 1 + (value << 1); - insert_value(ndx, types_value, data_value); // Throws -} - -inline void MixedColumn::insert_pos_neg(size_t ndx, int_fast64_t value, MixedColType pos_type, MixedColType neg_type) -{ - // 'store' the sign-bit in the integer-type - MixedColType type = (value & REALM_BIT63) == 0 ? pos_type : neg_type; - int_fast64_t types_value = type; - // Shift value one bit and set lowest bit to indicate that this is not a ref - int_fast64_t data_value = 1 + (value << 1); - insert_value(ndx, types_value, data_value); // Throws -} - -inline void MixedColumn::insert_int(size_t ndx, int_fast64_t value) -{ - insert_pos_neg(ndx, value, mixcol_Int, mixcol_IntNeg); // Throws -} - -inline void MixedColumn::insert_double(size_t ndx, double value) -{ - int_fast64_t value_2 = type_punning(value); - insert_pos_neg(ndx, value_2, mixcol_Double, mixcol_DoubleNeg); // Throws -} - -inline void MixedColumn::insert_float(size_t ndx, float value) -{ - int_fast64_t value_2 = type_punning(value); - insert_int(ndx, value_2, mixcol_Float); // Throws -} - -inline void MixedColumn::insert_bool(size_t ndx, bool value) -{ - int_fast64_t value_2 = int_fast64_t(value); - insert_int(ndx, value_2, mixcol_Bool); // Throws -} - -inline void MixedColumn::insert_olddatetime(size_t ndx, OldDateTime value) -{ - int_fast64_t value_2 = int_fast64_t(value.get_olddatetime()); - insert_int(ndx, value_2, mixcol_OldDateTime); // Throws -} - -inline void MixedColumn::insert_timestamp(size_t ndx, Timestamp value) -{ - ensure_timestamp_column(); - size_t data_ndx = m_timestamp_data->size(); - m_timestamp_data->add(value); // Throws - insert_int(ndx, int_fast64_t(data_ndx), mixcol_Timestamp); -} - -inline void MixedColumn::insert_string(size_t ndx, StringData value) -{ - ensure_binary_data_column(); - size_t blob_ndx = m_binary_data->size(); - m_binary_data->add_string(value); // Throws - - int_fast64_t value_2 = int_fast64_t(blob_ndx); - insert_int(ndx, value_2, mixcol_String); // Throws -} - -inline void MixedColumn::insert_binary(size_t ndx, BinaryData value) -{ - ensure_binary_data_column(); - size_t blob_ndx = m_binary_data->size(); - m_binary_data->add(value); // Throws - - int_fast64_t value_2 = int_fast64_t(blob_ndx); - insert_int(ndx, value_2, mixcol_Binary); // Throws -} - -inline void MixedColumn::insert_subtable(size_t ndx, const Table* t) -{ - typedef _impl::TableFriend tf; - ref_type ref; - if (t) { - ref = tf::clone(*t, get_alloc()); // Throws - } - else { - ref = tf::create_empty_table(get_alloc()); // Throws - } - int_fast64_t types_value = mixcol_Table; - int_fast64_t data_value = int_fast64_t(ref); - insert_value(ndx, types_value, data_value); // Throws -} - -inline void MixedColumn::erase(size_t row_ndx) -{ - size_t num_rows_to_erase = 1; - size_t prior_num_rows = size(); // Note that size() is slow - do_erase(row_ndx, num_rows_to_erase, prior_num_rows); // Throws -} - -inline void MixedColumn::move_last_over(size_t row_ndx) -{ - size_t prior_num_rows = size(); // Note that size() is slow - do_move_last_over(row_ndx, prior_num_rows); // Throws -} - -inline void MixedColumn::swap_rows(size_t row_ndx_1, size_t row_ndx_2) -{ - do_swap_rows(row_ndx_1, row_ndx_2); -} - -inline void MixedColumn::clear() -{ - size_t num_rows = size(); // Note that size() is slow - do_clear(num_rows); // Throws -} - -inline size_t MixedColumn::get_size_from_ref(ref_type root_ref, Allocator& alloc) noexcept -{ - const char* root_header = alloc.translate(root_ref); - ref_type types_ref = to_ref(Array::get(root_header, 0)); - return IntegerColumn::get_size_from_ref(types_ref, alloc); -} - -inline void MixedColumn::clear_value_and_discard_subtab_acc(size_t row_ndx, MixedColType new_type) -{ - MixedColType old_type = clear_value(row_ndx, new_type); - if (old_type == mixcol_Table) - m_data->discard_subtable_accessor(row_ndx); -} - -// Implementing pure virtual method of ColumnBase. -inline void MixedColumn::insert_rows(size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows, - bool insert_nulls) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(row_ndx <= prior_num_rows); - REALM_ASSERT(!insert_nulls); - - size_t row_ndx_2 = (row_ndx == prior_num_rows ? realm::npos : row_ndx); - - int_fast64_t type_value = mixcol_Int; - m_types->insert_without_updating_index(row_ndx_2, type_value, num_rows_to_insert); // Throws - - // The least significant bit indicates that the rest of the bits form an - // integer value, so 1 is actually zero. - int_fast64_t data_value = 1; - m_data->do_insert(row_ndx_2, data_value, num_rows_to_insert); // Throws -} - -// Implementing pure virtual method of ColumnBase. -inline void MixedColumn::erase_rows(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, bool) -{ - do_erase(row_ndx, num_rows_to_erase, prior_num_rows); // Throws -} - -// Implementing pure virtual method of ColumnBase. -inline void MixedColumn::move_last_row_over(size_t row_ndx, size_t prior_num_rows, bool) -{ - do_move_last_over(row_ndx, prior_num_rows); // Throws -} - -// Implementing pure virtual method of ColumnBase. -inline void MixedColumn::clear(size_t num_rows, bool) -{ - do_clear(num_rows); // Throws -} - -inline void MixedColumn::mark(int type) noexcept -{ - m_data->mark(type); -} - -inline void MixedColumn::refresh_accessor_tree(size_t col_ndx, const Spec& spec) -{ - ColumnBaseSimple::refresh_accessor_tree(col_ndx, spec); - - get_root_array()->init_from_parent(); - m_types->refresh_accessor_tree(col_ndx, spec); // Throws - m_data->refresh_accessor_tree(col_ndx, spec); // Throws - if (m_binary_data) { - REALM_ASSERT_3(get_root_array()->size(), >=, 3); - m_binary_data->refresh_accessor_tree(col_ndx, spec); // Throws - } - if (m_timestamp_data) { - REALM_ASSERT_3(get_root_array()->size(), >=, 4); - m_timestamp_data->refresh_accessor_tree(col_ndx, spec); // Throws - } - - - // See if m_binary_data needs to be created. - if (get_root_array()->size() >= 3) { - ref_type ref = get_root_array()->get_as_ref(2); - m_binary_data.reset(new BinaryColumn(get_alloc(), ref)); // Throws - m_binary_data->set_parent(get_root_array(), 2); - } - - // See if m_timestamp_data needs to be created. - if (get_root_array()->size() >= 4) { - ref_type ref = get_root_array()->get_as_ref(3); - // When adding/creating a Mixed column the user cannot specify nullability, so the "true" below - // makes it implicitly nullable, which may not be wanted. But it's OK since Mixed columns are not - // publicly supported - m_timestamp_data.reset(new TimestampColumn(true /*fixme*/, get_alloc(), ref)); // Throws - m_timestamp_data->set_parent(get_root_array(), 3); - } -} - -inline void MixedColumn::RefsColumn::refresh_accessor_tree(size_t col_ndx, const Spec& spec) -{ - SubtableColumnBase::refresh_accessor_tree(col_ndx, spec); // Throws - size_t spec_ndx_in_parent = 0; // Ignored because these are root tables - m_subtable_map.refresh_accessor_tree(spec_ndx_in_parent); // Throws -} - -} // namespace realm diff --git a/Pods/Realm/include/core/realm/column_string.hpp b/Pods/Realm/include/core/realm/column_string.hpp deleted file mode 100644 index 50bab6fc..00000000 --- a/Pods/Realm/include/core/realm/column_string.hpp +++ /dev/null @@ -1,378 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_STRING_HPP -#define REALM_COLUMN_STRING_HPP - -#include -#include -#include -#include -#include -#include - -namespace realm { - -// Pre-declarations -class StringIndex; - - -/// A string column (StringColumn) is a single B+-tree, and -/// the root of the column is the root of the B+-tree. Leaf nodes are -/// either of type ArrayString (array of small strings), -/// ArrayStringLong (array of medium strings), or ArrayBigBlobs (array -/// of big strings). -/// -/// A string column can optionally be equipped with a search index. If -/// it is, then the root ref of the index is stored in -/// Table::m_columns immediately after the root ref of the string -/// column. -class StringColumn : public ColumnBaseSimple { -public: - typedef StringData value_type; - - StringColumn(Allocator&, ref_type, bool nullable = false, size_t column_ndx = npos); - ~StringColumn() noexcept override; - - void destroy() noexcept override; - - size_t size() const noexcept final; - bool is_empty() const noexcept - { - return size() == 0; - } - - bool is_null(size_t ndx) const noexcept final; - void set_null(size_t ndx) final; - StringData get(size_t ndx) const noexcept; - void set(size_t ndx, StringData); - void add(); - void add(StringData value); - void insert(size_t ndx); - void insert(size_t ndx, StringData value); - void erase(size_t row_ndx); - void move_last_over(size_t row_ndx); - void swap_rows(size_t row_ndx_1, size_t row_ndx_2) override; - void clear(); - - size_t count(StringData value) const; - size_t find_first(StringData value, size_t begin = 0, size_t end = npos) const; - void find_all(IntegerColumn& result, StringData value, size_t begin = 0, size_t end = npos) const; - FindRes find_all_no_copy(StringData value, InternalFindResult& result) const; - - int compare_values(size_t, size_t) const noexcept override; - - //@{ - /// Find the lower/upper bound for the specified value assuming - /// that the elements are already sorted in ascending order - /// according to StringData::operator<(). - size_t lower_bound_string(StringData value) const noexcept; - size_t upper_bound_string(StringData value) const noexcept; - //@} - - void set_string(size_t, StringData) override; - - bool is_nullable() const noexcept final; - - // Search index - StringData get_index_data(size_t ndx, StringIndex::StringConversionBuffer& buffer) const noexcept final; - bool has_search_index() const noexcept override; - void set_search_index_ref(ref_type, ArrayParent*, size_t, bool) override; - void set_search_index_allow_duplicate_values(bool) noexcept override; - StringIndex* get_search_index() noexcept override; - const StringIndex* get_search_index() const noexcept override; - std::unique_ptr release_search_index() noexcept; - bool supports_search_index() const noexcept final - { - return true; - } - StringIndex* create_search_index() override; - - // Simply inserts all column values in the index in a loop - void populate_search_index(); - void destroy_search_index() noexcept override; - - // Optimizing data layout. enforce == true will enforce enumeration; - // enforce == false will auto-evaluate if it should be enumerated or not - bool auto_enumerate(ref_type& keys, ref_type& values, bool enforce = false) const; - - /// Compare two string columns for equality. - bool compare_string(const StringColumn&) const; - - enum LeafType { - leaf_type_Small, ///< ArrayString - leaf_type_Medium, ///< ArrayStringLong - leaf_type_Big ///< ArrayBigBlobs - }; - - std::unique_ptr get_leaf(size_t ndx, size_t& out_ndx_in_parent, LeafType& out_leaf_type) const; - - static ref_type create(Allocator&, size_t size = 0); - - static size_t get_size_from_ref(ref_type root_ref, Allocator&) noexcept; - - // Overrriding method in ColumnBase - ref_type write(size_t, size_t, size_t, _impl::OutputStream&) const override; - - void insert_rows(size_t, size_t, size_t, bool) override; - void erase_rows(size_t, size_t, size_t, bool) override; - void move_last_row_over(size_t, size_t, bool) override; - void clear(size_t, bool) override; - void set_ndx_in_parent(size_t ndx_in_parent) noexcept override; - void update_from_parent(size_t old_baseline) noexcept override; - void refresh_accessor_tree(size_t, const Spec&) override; - - void verify() const override; - void verify(const Table&, size_t) const override; - void to_dot(std::ostream&, StringData title) const override; - void do_dump_node_structure(std::ostream&, int) const override; - -private: - std::unique_ptr m_search_index; - bool m_nullable; - - LeafType get_block(size_t ndx, ArrayParent**, size_t& off, bool use_retval = false) const; - - /// If you are appending and have the size of the column readily available, - /// call the 4 argument version instead. If you are not appending, either - /// one is fine. - /// - /// \param row_ndx Must be `realm::npos` if appending. - void do_insert(size_t row_ndx, StringData value, size_t num_rows); - - /// If you are appending and you do not have the size of the column readily - /// available, call the 3 argument version instead. If you are not - /// appending, either one is fine. - /// - /// \param is_append Must be true if, and only if `row_ndx` is equal to the - /// size of the column (before insertion). - void do_insert(size_t row_ndx, StringData value, size_t num_rows, bool is_append); - - /// \param row_ndx Must be `realm::npos` if appending. - void bptree_insert(size_t row_ndx, StringData value, size_t num_rows); - - // Called by Array::bptree_insert(). - static ref_type leaf_insert(MemRef leaf_mem, ArrayParent&, size_t ndx_in_parent, Allocator&, size_t insert_ndx, - BpTreeNode::TreeInsert& state); - - class EraseLeafElem; - class CreateHandler; - class SliceHandler; - - void do_erase(size_t row_ndx, bool is_last); - void do_move_last_over(size_t row_ndx, size_t last_row_ndx); - void do_swap_rows(size_t row_ndx_1, size_t row_ndx_2); - void do_clear(); - - /// Root must be a leaf. Upgrades the root leaf as - /// necessary. Returns the type of the root leaf as it is upon - /// return. - LeafType upgrade_root_leaf(size_t value_size); - - void refresh_root_accessor(); - - void leaf_to_dot(MemRef, ArrayParent*, size_t ndx_in_parent, std::ostream&) const override; - - friend class BpTreeNode; - friend class ColumnBase; -}; - - -// Implementation: - -inline size_t StringColumn::size() const noexcept -{ - if (root_is_leaf()) { - bool long_strings = m_array->has_refs(); - if (!long_strings) { - // Small strings root leaf - ArrayString* leaf = static_cast(m_array.get()); - return leaf->size(); - } - bool is_big = m_array->get_context_flag(); - if (!is_big) { - // Medium strings root leaf - ArrayStringLong* leaf = static_cast(m_array.get()); - return leaf->size(); - } - // Big strings root leaf - ArrayBigBlobs* leaf = static_cast(m_array.get()); - return leaf->size(); - } - // Non-leaf root - BpTreeNode* node = static_cast(m_array.get()); - return node->get_bptree_size(); -} - -inline void StringColumn::add(StringData value) -{ - REALM_ASSERT(!(value.is_null() && !m_nullable)); - size_t row_ndx = realm::npos; - size_t num_rows = 1; - do_insert(row_ndx, value, num_rows); // Throws -} - -inline void StringColumn::add() -{ - add(m_nullable ? realm::null() : StringData("")); -} - -inline void StringColumn::insert(size_t row_ndx, StringData value) -{ - REALM_ASSERT(!(value.is_null() && !m_nullable)); - size_t column_size = this->size(); - REALM_ASSERT_3(row_ndx, <=, column_size); - size_t num_rows = 1; - bool is_append = row_ndx == column_size; - do_insert(row_ndx, value, num_rows, is_append); // Throws -} - -inline void StringColumn::insert(size_t row_ndx) -{ - insert(row_ndx, m_nullable ? realm::null() : StringData("")); -} - -inline void StringColumn::erase(size_t row_ndx) -{ - size_t last_row_ndx = size() - 1; // Note that size() is slow - bool is_last = row_ndx == last_row_ndx; - do_erase(row_ndx, is_last); // Throws -} - -inline void StringColumn::move_last_over(size_t row_ndx) -{ - size_t last_row_ndx = size() - 1; // Note that size() is slow - do_move_last_over(row_ndx, last_row_ndx); // Throws -} - -inline void StringColumn::swap_rows(size_t row_ndx_1, size_t row_ndx_2) -{ - do_swap_rows(row_ndx_1, row_ndx_2); // Throws -} - -inline void StringColumn::clear() -{ - do_clear(); // Throws -} - -inline int StringColumn::compare_values(size_t row1, size_t row2) const noexcept -{ - StringData a = get(row1); - StringData b = get(row2); - - if (a.is_null() && !b.is_null()) - return 1; - else if (b.is_null() && !a.is_null()) - return -1; - else if (a.is_null() && b.is_null()) - return 0; - - if (a == b) - return 0; - return utf8_compare(a, b) ? 1 : -1; -} - -inline void StringColumn::set_string(size_t row_ndx, StringData value) -{ - REALM_ASSERT(!(value.is_null() && !m_nullable)); - set(row_ndx, value); // Throws -} - -inline bool StringColumn::has_search_index() const noexcept -{ - return m_search_index != 0; -} - -inline StringIndex* StringColumn::get_search_index() noexcept -{ - return m_search_index.get(); -} - -inline const StringIndex* StringColumn::get_search_index() const noexcept -{ - return m_search_index.get(); -} - -inline size_t StringColumn::get_size_from_ref(ref_type root_ref, Allocator& alloc) noexcept -{ - const char* root_header = alloc.translate(root_ref); - bool root_is_leaf = !Array::get_is_inner_bptree_node_from_header(root_header); - if (root_is_leaf) { - bool long_strings = Array::get_hasrefs_from_header(root_header); - if (!long_strings) { - // Small strings leaf - return ArrayString::get_size_from_header(root_header); - } - bool is_big = Array::get_context_flag_from_header(root_header); - if (!is_big) { - // Medium strings leaf - return ArrayStringLong::get_size_from_header(root_header, alloc); - } - // Big strings leaf - return ArrayBigBlobs::get_size_from_header(root_header); - } - - return BpTreeNode::get_bptree_size_from_header(root_header); -} - -// Implementing pure virtual method of ColumnBase. -inline void StringColumn::insert_rows(size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows, - bool insert_nulls) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(row_ndx <= prior_num_rows); - REALM_ASSERT(!insert_nulls || m_nullable); - - StringData value = m_nullable ? realm::null() : StringData(""); - bool is_append = (row_ndx == prior_num_rows); - do_insert(row_ndx, value, num_rows_to_insert, is_append); // Throws -} - -// Implementing pure virtual method of ColumnBase. -inline void StringColumn::erase_rows(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, bool) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(num_rows_to_erase <= prior_num_rows); - REALM_ASSERT(row_ndx <= prior_num_rows - num_rows_to_erase); - - bool is_last = (row_ndx + num_rows_to_erase == prior_num_rows); - for (size_t i = num_rows_to_erase; i > 0; --i) { - size_t row_ndx_2 = row_ndx + i - 1; - do_erase(row_ndx_2, is_last); // Throws - } -} - -// Implementing pure virtual method of ColumnBase. -inline void StringColumn::move_last_row_over(size_t row_ndx, size_t prior_num_rows, bool) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(row_ndx < prior_num_rows); - - size_t last_row_ndx = prior_num_rows - 1; - do_move_last_over(row_ndx, last_row_ndx); // Throws -} - -// Implementing pure virtual method of ColumnBase. -inline void StringColumn::clear(size_t, bool) -{ - do_clear(); // Throws -} - -} // namespace realm - -#endif // REALM_COLUMN_STRING_HPP diff --git a/Pods/Realm/include/core/realm/column_string_enum.hpp b/Pods/Realm/include/core/realm/column_string_enum.hpp deleted file mode 100644 index be27ba09..00000000 --- a/Pods/Realm/include/core/realm/column_string_enum.hpp +++ /dev/null @@ -1,311 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_STRING_ENUM_HPP -#define REALM_COLUMN_STRING_ENUM_HPP - -#include - -namespace realm { - -// Pre-declarations -class StringIndex; - - -/// From the point of view of the application, an enumerated strings column -/// (StringEnumColumn) is like a string column (StringColumn), yet it manages -/// its strings in such a way that each unique string is stored only once. In -/// fact, an enumerated strings column is a combination of two subcolumns; a -/// regular string column (StringColumn) that stores the unique strings, and an -/// integer column that stores one unique string index for each entry in the -/// enumerated strings column. -/// -/// In terms of the underlying node structure, the subcolumn containing the -/// unique strings is not a true part of the enumerated strings column. Instead -/// it is a part of the spec structure that describes the table of which the -/// enumerated strings column is a part. This way, the unique strings can be -/// shared across enumerated strings columns of multiple subtables. This also -/// means that the root of an enumerated strings column coincides with the root -/// of the integer subcolumn, and in some sense, an enumerated strings column is -/// just the integer subcolumn. -/// -/// An enumerated strings column can optionally be equipped with a -/// search index. If it is, then the root ref of the index is stored -/// in Table::m_columns immediately after the root ref of the -/// enumerated strings column. -class StringEnumColumn : public IntegerColumn { -public: - typedef StringData value_type; - - StringEnumColumn(Allocator&, ref_type ref, ref_type keys_ref, bool nullable, size_t column_ndx = npos); - ~StringEnumColumn() noexcept override; - void destroy() noexcept override; - MemRef clone_deep(Allocator& alloc) const override; - - int compare_values(size_t row1, size_t row2) const noexcept override - { - StringData a = get(row1); - StringData b = get(row2); - - if (a.is_null() && !b.is_null()) - return 1; - else if (b.is_null() && !a.is_null()) - return -1; - else if (a.is_null() && b.is_null()) - return 0; - - if (a == b) - return 0; - - return utf8_compare(a, b) ? 1 : -1; - } - - StringData get(size_t ndx) const noexcept; - bool is_null(size_t ndx) const noexcept final; - void set(size_t ndx, StringData value); - void set_null(size_t ndx) override; - void add(); - void add(StringData value); - void insert(size_t ndx); - void insert(size_t ndx, StringData value); - void erase(size_t row_ndx); - void move_last_over(size_t row_ndx); - void clear(); - bool is_nullable() const noexcept final; - - size_t count(StringData value) const; - size_t find_first(StringData value, size_t begin = 0, size_t end = npos) const; - void find_all(IntegerColumn& res, StringData value, size_t begin = 0, size_t end = npos) const; - FindRes find_all_no_copy(StringData value, InternalFindResult& result) const; - - size_t count(size_t key_index) const; - size_t find_first(size_t key_index, size_t begin = 0, size_t end = -1) const; - void find_all(IntegerColumn& res, size_t key_index, size_t begin = 0, size_t end = -1) const; - - //@{ - /// Find the lower/upper bound for the specified value assuming - /// that the elements are already sorted in ascending order - /// according to StringData::operator<(). - size_t lower_bound_string(StringData value) const noexcept; - size_t upper_bound_string(StringData value) const noexcept; - //@} - - void set_string(size_t, StringData) override; - - void adjust_keys_ndx_in_parent(int diff) noexcept; - - // Search index - StringData get_index_data(size_t ndx, StringIndex::StringConversionBuffer& buffer) const noexcept final; - void set_search_index_allow_duplicate_values(bool) noexcept override; - bool supports_search_index() const noexcept final - { - return true; - } - StringIndex* create_search_index() override; - void install_search_index(std::unique_ptr) noexcept; - void destroy_search_index() noexcept override; - - // Compare two string columns for equality - bool compare_string(const StringColumn&) const; - bool compare_string(const StringEnumColumn&) const; - - void insert_rows(size_t, size_t, size_t, bool) override; - void erase_rows(size_t, size_t, size_t, bool) override; - void move_last_row_over(size_t, size_t, bool) override; - void clear(size_t, bool) override; - void update_from_parent(size_t) noexcept override; - void refresh_accessor_tree(size_t, const Spec&) override; - - size_t get_key_ndx(StringData value) const; - size_t get_key_ndx_or_add(StringData value); - - StringColumn& get_keys(); - const StringColumn& get_keys() const; - -#ifdef REALM_DEBUG - void verify() const override; - void verify(const Table&, size_t) const override; - void do_dump_node_structure(std::ostream&, int) const override; - void to_dot(std::ostream&, StringData title) const override; -#endif - -private: - // Member variables - StringColumn m_keys; - bool m_nullable; - - /// If you are appending and have the size of the column readily available, - /// call the 4 argument version instead. If you are not appending, either - /// one is fine. - /// - /// \param row_ndx Must be `realm::npos` if appending. - void do_insert(size_t row_ndx, StringData value, size_t num_rows); - - /// If you are appending and you do not have the size of the column readily - /// available, call the 3 argument version instead. If you are not - /// appending, either one is fine. - /// - /// \param is_append Must be true if, and only if `row_ndx` is equal to the - /// size of the column (before insertion). - void do_insert(size_t row_ndx, StringData value, size_t num_rows, bool is_append); - - void do_erase(size_t row_ndx, bool is_last); - void do_move_last_over(size_t row_ndx, size_t last_row_ndx); - void do_clear(); -}; - - -// Implementation: - -inline StringData StringEnumColumn::get(size_t ndx) const noexcept -{ - REALM_ASSERT_3(ndx, <, IntegerColumn::size()); - size_t key_ndx = to_size_t(IntegerColumn::get(ndx)); - StringData sd = m_keys.get(key_ndx); - REALM_ASSERT_DEBUG(!(!m_nullable && sd.is_null())); - return sd; -} - -inline bool StringEnumColumn::is_null(size_t ndx) const noexcept -{ - return is_nullable() && get(ndx).is_null(); -} - -inline void StringEnumColumn::add() -{ - add(m_nullable ? realm::null() : StringData("")); -} - -inline void StringEnumColumn::add(StringData value) -{ - REALM_ASSERT_DEBUG(!(!m_nullable && value.is_null())); - size_t row_ndx = realm::npos; - size_t num_rows = 1; - do_insert(row_ndx, value, num_rows); // Throws -} - -inline void StringEnumColumn::insert(size_t row_ndx) -{ - insert(row_ndx, m_nullable ? realm::null() : StringData("")); -} - -inline void StringEnumColumn::insert(size_t row_ndx, StringData value) -{ - REALM_ASSERT_DEBUG(!(!m_nullable && value.is_null())); - size_t column_size = this->size(); - REALM_ASSERT_3(row_ndx, <=, column_size); - size_t num_rows = 1; - bool is_append = row_ndx == column_size; - do_insert(row_ndx, value, num_rows, is_append); // Throws -} - -inline void StringEnumColumn::erase(size_t row_ndx) -{ - size_t last_row_ndx = size() - 1; // Note that size() is slow - bool is_last = row_ndx == last_row_ndx; - do_erase(row_ndx, is_last); // Throws -} - -inline void StringEnumColumn::move_last_over(size_t row_ndx) -{ - size_t last_row_ndx = size() - 1; // Note that size() is slow - do_move_last_over(row_ndx, last_row_ndx); // Throws -} - -inline void StringEnumColumn::clear() -{ - do_clear(); // Throws -} - -// Overriding virtual method of Column. -inline void StringEnumColumn::insert_rows(size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows, - bool insert_nulls) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(row_ndx <= prior_num_rows); - REALM_ASSERT(!insert_nulls || m_nullable); - - StringData value = m_nullable ? realm::null() : StringData(""); - bool is_append = (row_ndx == prior_num_rows); - do_insert(row_ndx, value, num_rows_to_insert, is_append); // Throws -} - -// Overriding virtual method of Column. -inline void StringEnumColumn::erase_rows(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, bool) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(num_rows_to_erase <= prior_num_rows); - REALM_ASSERT(row_ndx <= prior_num_rows - num_rows_to_erase); - - bool is_last = (row_ndx + num_rows_to_erase == prior_num_rows); - for (size_t i = num_rows_to_erase; i > 0; --i) { - size_t row_ndx_2 = row_ndx + i - 1; - do_erase(row_ndx_2, is_last); // Throws - } -} - -// Overriding virtual method of Column. -inline void StringEnumColumn::move_last_row_over(size_t row_ndx, size_t prior_num_rows, bool) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(row_ndx < prior_num_rows); - - size_t last_row_ndx = prior_num_rows - 1; - do_move_last_over(row_ndx, last_row_ndx); // Throws -} - -// Overriding virtual method of Column. -inline void StringEnumColumn::clear(size_t, bool) -{ - do_clear(); // Throws -} - -inline size_t StringEnumColumn::lower_bound_string(StringData value) const noexcept -{ - return ColumnBase::lower_bound(*this, value); -} - -inline size_t StringEnumColumn::upper_bound_string(StringData value) const noexcept -{ - return ColumnBase::upper_bound(*this, value); -} - -inline void StringEnumColumn::set_string(size_t row_ndx, StringData value) -{ - set(row_ndx, value); // Throws -} - -inline void StringEnumColumn::set_null(size_t row_ndx) -{ - set(row_ndx, realm::null{}); -} - -inline StringColumn& StringEnumColumn::get_keys() -{ - return m_keys; -} - -inline const StringColumn& StringEnumColumn::get_keys() const -{ - return m_keys; -} - - -} // namespace realm - -#endif // REALM_COLUMN_STRING_ENUM_HPP diff --git a/Pods/Realm/include/core/realm/column_table.hpp b/Pods/Realm/include/core/realm/column_table.hpp deleted file mode 100644 index ca5e38b8..00000000 --- a/Pods/Realm/include/core/realm/column_table.hpp +++ /dev/null @@ -1,601 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_TABLE_HPP -#define REALM_COLUMN_TABLE_HPP - -#include - -#include -#include -#include -#include - -namespace realm { - - -/// Base class for any type of column that can contain subtables. -// FIXME: Don't derive from IntegerColumn, but define a BpTree specialization. -class SubtableColumnBase : public IntegerColumn, public Table::Parent { -public: - void discard_child_accessors() noexcept; - - ~SubtableColumnBase() noexcept override; - - static ref_type create(Allocator&, size_t size = 0); - - Table* get_subtable_accessor(size_t) const noexcept override; - - void insert_rows(size_t, size_t, size_t, bool) override; - void erase_rows(size_t, size_t, size_t, bool) override; - void move_last_row_over(size_t, size_t, bool) override; - void clear(size_t, bool) override; - void swap_rows(size_t, size_t) override; - void discard_subtable_accessor(size_t) noexcept override; - void update_from_parent(size_t) noexcept override; - void adj_acc_insert_rows(size_t, size_t) noexcept override; - void adj_acc_erase_row(size_t) noexcept override; - void adj_acc_move_over(size_t, size_t) noexcept override; - void adj_acc_clear_root_table() noexcept override; - void adj_acc_swap_rows(size_t, size_t) noexcept override; - void mark(int) noexcept override; - bool supports_search_index() const noexcept override - { - return false; - } - StringIndex* create_search_index() override - { - return nullptr; - } - - void verify() const override; - void verify(const Table&, size_t) const override; - -protected: - /// A pointer to the table that this column is part of. For a free-standing - /// column, this pointer is null. - Table* const m_table; - - struct SubtableMap { - ~SubtableMap() noexcept - { - } - bool empty() const noexcept - { - return m_entries.empty(); - } - Table* find(size_t subtable_ndx) const noexcept; - void add(size_t subtable_ndx, Table*); - // Returns true if, and only if at least one entry was detached and - // removed from the map. - bool detach_and_remove_all() noexcept; - // Returns true if, and only if the entry was found and removed, and it - // was the last entry in the map. - bool detach_and_remove(size_t subtable_ndx) noexcept; - // Returns true if, and only if the entry was found and removed, and it - // was the last entry in the map. - bool remove(Table*) noexcept; - void update_from_parent(size_t old_baseline) const noexcept; - template - void adj_insert_rows(size_t row_ndx, size_t num_rows_inserted) noexcept; - // Returns true if, and only if an entry was found and removed, and it - // was the last entry in the map. - template - bool adj_erase_rows(size_t row_ndx, size_t num_rows_erased) noexcept; - // Returns true if, and only if an entry was found and removed, and it - // was the last entry in the map. - template - bool adj_move_over(size_t from_row_ndx, size_t to_row_ndx) noexcept; - template - void adj_swap_rows(size_t row_ndx_1, size_t row_ndx_2) noexcept; - - void update_accessors(const size_t* col_path_begin, const size_t* col_path_end, - _impl::TableFriend::AccessorUpdater&); - void recursive_mark() noexcept; - void refresh_accessor_tree(size_t spec_ndx_in_parent); - - private: - struct SubtableEntry { - size_t m_subtable_ndx; - Table* m_table; - }; - typedef std::vector entries; - entries m_entries; - }; - - /// Contains all existing accessors that are attached to a subtable in this - /// column. It can map a row index into a pointer to the corresponding - /// accessor when it exists. - /// - /// There is an invariant in force: Either `m_table` is null, or there is an - /// additional referece count on `*m_table` when, and only when the map is - /// non-empty. - mutable SubtableMap m_subtable_map; - - SubtableColumnBase(Allocator&, ref_type, Table*, size_t column_ndx); - - /// Get a pointer to the accessor of the specified subtable. The - /// accessor will be created if it does not already exist. - /// - /// The returned table pointer must **always** end up being - /// wrapped in some instantiation of BasicTableRef<>. - /// - /// NOTE: This method must be used only for subtables with - /// independent specs, i.e. for elements of a MixedColumn. - Table* get_subtable_ptr(size_t subtable_ndx); - - // Overriding method in ArrayParent - void update_child_ref(size_t, ref_type) override; - - // Overriding method in ArrayParent - ref_type get_child_ref(size_t) const noexcept override; - - // Overriding method in Table::Parent - Table* get_parent_table(size_t*) noexcept override; - - // Overriding method in Table::Parent - void child_accessor_destroyed(Table*) noexcept override; - - /// Assumes that the two tables have the same spec. - static bool compare_subtable_rows(const Table&, const Table&); - - /// Construct a copy of the columns array of the specified table - /// and return just the ref to that array. - /// - /// In the clone, no string column will be of the enumeration - /// type. - ref_type clone_table_columns(const Table*); - - size_t* record_subtable_path(size_t* begin, size_t* end) noexcept override; - - void update_table_accessors(const size_t* col_path_begin, const size_t* col_path_end, - _impl::TableFriend::AccessorUpdater&); - - /// \param row_ndx Must be `realm::npos` if appending. - /// \param value The value to place in any newly created rows. - /// \param num_rows The number of rows to insert. - void do_insert(size_t row_ndx, int_fast64_t value, size_t num_rows); - - std::pair get_to_dot_parent(size_t ndx_in_parent) const override; - - friend class Table; -}; - - -class SubtableColumn : public SubtableColumnBase { -public: - /// Create a subtable column accessor and attach it to a - /// preexisting underlying structure of arrays. - /// - /// \param alloc The allocator to provide new memory. - /// - /// \param ref The memory reference of the underlying subtable that - /// we are creating an accessor for. - /// - /// \param table If this column is used as part of a table you must - /// pass a pointer to that table. Otherwise you must pass null. - /// - /// \param column_ndx If this column is used as part of a table - /// you must pass the logical index of the column within that - /// table. Otherwise you should pass zero. - SubtableColumn(Allocator& alloc, ref_type ref, Table* table, size_t column_ndx); - - ~SubtableColumn() noexcept override - { - } - - size_t get_subtable_size(size_t ndx) const noexcept; - - /// Get a pointer to the accessor of the specified subtable. The - /// accessor will be created if it does not already exist. - /// - /// The returned table pointer must **always** end up being - /// wrapped in some instantiation of BasicTableRef<>. - Table* get_subtable_ptr(size_t subtable_ndx); - - const Table* get_subtable_ptr(size_t subtable_ndx) const; - - // When passing a table to add() or insert() it is assumed that - // the table spec is compatible with this column. The number of - // columns must be the same, and the corresponding columns must - // have the same data type (as returned by - // Table::get_column_type()). - - void add(const Table* value = nullptr); - void insert(size_t ndx, const Table* value = nullptr); - void set(size_t ndx, const Table*); - void clear_table(size_t ndx); - - using SubtableColumnBase::insert; - - void erase_rows(size_t, size_t, size_t, bool) override; - void move_last_row_over(size_t, size_t, bool) override; - - /// Compare two subtable columns for equality. - bool compare_table(const SubtableColumn&) const; - - void refresh_accessor_tree(size_t, const Spec&) override; - -#ifdef REALM_DEBUG - void verify(const Table&, size_t) const override; - void do_dump_node_structure(std::ostream&, int) const override; - void to_dot(std::ostream&, StringData title) const override; -#endif - -private: - mutable size_t m_subspec_ndx; // Unknown if equal to `npos` - - size_t get_subspec_ndx() const noexcept; - - void destroy_subtable(size_t ndx) noexcept; - - void do_discard_child_accessors() noexcept override; -}; - - -// Implementation - -// Overriding virtual method of Column. -inline void SubtableColumnBase::insert_rows(size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows, - bool insert_nulls) -{ - REALM_ASSERT_DEBUG(prior_num_rows == size()); - REALM_ASSERT(row_ndx <= prior_num_rows); - REALM_ASSERT(!insert_nulls); - - size_t row_ndx_2 = (row_ndx == prior_num_rows ? realm::npos : row_ndx); - int_fast64_t value = 0; - do_insert(row_ndx_2, value, num_rows_to_insert); // Throws -} - -// Overriding virtual method of Column. -inline void SubtableColumnBase::erase_rows(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, - bool broken_reciprocal_backlinks) -{ - IntegerColumn::erase_rows(row_ndx, num_rows_to_erase, prior_num_rows, broken_reciprocal_backlinks); // Throws - - const bool fix_ndx_in_parent = true; - bool last_entry_removed = m_subtable_map.adj_erase_rows(row_ndx, num_rows_to_erase); - typedef _impl::TableFriend tf; - if (last_entry_removed) - tf::unbind_ptr(*m_table); -} - -// Overriding virtual method of Column. -inline void SubtableColumnBase::move_last_row_over(size_t row_ndx, size_t prior_num_rows, - bool broken_reciprocal_backlinks) -{ - IntegerColumn::move_last_row_over(row_ndx, prior_num_rows, broken_reciprocal_backlinks); // Throws - - const bool fix_ndx_in_parent = true; - size_t last_row_ndx = prior_num_rows - 1; - bool last_entry_removed = m_subtable_map.adj_move_over(last_row_ndx, row_ndx); - typedef _impl::TableFriend tf; - if (last_entry_removed) - tf::unbind_ptr(*m_table); -} - -inline void SubtableColumnBase::clear(size_t, bool) -{ - discard_child_accessors(); - clear_without_updating_index(); // Throws - // FIXME: This one is needed because - // IntegerColumn::clear_without_updating_index() forgets about the - // leaf type. A better solution should probably be sought after. - get_root_array()->set_type(Array::type_HasRefs); -} - -inline void SubtableColumnBase::swap_rows(size_t row_ndx_1, size_t row_ndx_2) -{ - IntegerColumn::swap_rows(row_ndx_1, row_ndx_2); // Throws - - const bool fix_ndx_in_parent = true; - m_subtable_map.adj_swap_rows(row_ndx_1, row_ndx_2); -} - -inline void SubtableColumnBase::mark(int type) noexcept -{ - if (type & mark_Recursive) - m_subtable_map.recursive_mark(); -} - -inline void SubtableColumnBase::adj_acc_insert_rows(size_t row_ndx, size_t num_rows) noexcept -{ - // This function must assume no more than minimal consistency of the - // accessor hierarchy. This means in particular that it cannot access the - // underlying node structure. See AccessorConsistencyLevels. - - const bool fix_ndx_in_parent = false; - m_subtable_map.adj_insert_rows(row_ndx, num_rows); -} - -inline void SubtableColumnBase::adj_acc_erase_row(size_t row_ndx) noexcept -{ - // This function must assume no more than minimal consistency of the - // accessor hierarchy. This means in particular that it cannot access the - // underlying node structure. See AccessorConsistencyLevels. - - const bool fix_ndx_in_parent = false; - size_t num_rows_erased = 1; - bool last_entry_removed = m_subtable_map.adj_erase_rows(row_ndx, num_rows_erased); - typedef _impl::TableFriend tf; - if (last_entry_removed) - tf::unbind_ptr(*m_table); -} - -inline void SubtableColumnBase::adj_acc_move_over(size_t from_row_ndx, size_t to_row_ndx) noexcept -{ - // This function must assume no more than minimal consistency of the - // accessor hierarchy. This means in particular that it cannot access the - // underlying node structure. See AccessorConsistencyLevels. - - const bool fix_ndx_in_parent = false; - bool last_entry_removed = m_subtable_map.adj_move_over(from_row_ndx, to_row_ndx); - typedef _impl::TableFriend tf; - if (last_entry_removed) - tf::unbind_ptr(*m_table); -} - -inline void SubtableColumnBase::adj_acc_clear_root_table() noexcept -{ - // This function must assume no more than minimal consistency of the - // accessor hierarchy. This means in particular that it cannot access the - // underlying node structure. See AccessorConsistencyLevels. - - IntegerColumn::adj_acc_clear_root_table(); - discard_child_accessors(); -} - -inline void SubtableColumnBase::adj_acc_swap_rows(size_t row_ndx_1, size_t row_ndx_2) noexcept -{ - const bool fix_ndx_in_parent = false; - m_subtable_map.adj_swap_rows(row_ndx_1, row_ndx_2); -} - -inline Table* SubtableColumnBase::get_subtable_accessor(size_t row_ndx) const noexcept -{ - // This function must assume no more than minimal consistency of the - // accessor hierarchy. This means in particular that it cannot access the - // underlying node structure. See AccessorConsistencyLevels. - - Table* subtable = m_subtable_map.find(row_ndx); - return subtable; -} - -inline void SubtableColumnBase::discard_subtable_accessor(size_t row_ndx) noexcept -{ - // This function must assume no more than minimal consistency of the - // accessor hierarchy. This means in particular that it cannot access the - // underlying node structure. See AccessorConsistencyLevels. - - bool last_entry_removed = m_subtable_map.detach_and_remove(row_ndx); - typedef _impl::TableFriend tf; - if (last_entry_removed) - tf::unbind_ptr(*m_table); -} - -inline void SubtableColumnBase::SubtableMap::add(size_t subtable_ndx, Table* table) -{ - SubtableEntry e; - e.m_subtable_ndx = subtable_ndx; - e.m_table = table; - m_entries.push_back(e); -} - -template -void SubtableColumnBase::SubtableMap::adj_insert_rows(size_t row_ndx, size_t num_rows_inserted) noexcept -{ - for (auto& entry : m_entries) { - if (entry.m_subtable_ndx >= row_ndx) { - entry.m_subtable_ndx += num_rows_inserted; - typedef _impl::TableFriend tf; - if (fix_ndx_in_parent) - tf::set_ndx_in_parent(*(entry.m_table), entry.m_subtable_ndx); - } - } -} - -template -bool SubtableColumnBase::SubtableMap::adj_erase_rows(size_t row_ndx, size_t num_rows_erased) noexcept -{ - if (m_entries.empty()) - return false; - typedef _impl::TableFriend tf; - auto end = m_entries.end(); - auto i = m_entries.begin(); - do { - if (i->m_subtable_ndx >= row_ndx + num_rows_erased) { - i->m_subtable_ndx -= num_rows_erased; - if (fix_ndx_in_parent) - tf::set_ndx_in_parent(*(i->m_table), i->m_subtable_ndx); - } - else if (i->m_subtable_ndx >= row_ndx) { - // Must hold a counted reference while detaching - TableRef table(i->m_table); - tf::detach(*table); - // Move last over - *i = *--end; - continue; - } - ++i; - } while (i != end); - m_entries.erase(end, m_entries.end()); - return m_entries.empty(); -} - - -template -bool SubtableColumnBase::SubtableMap::adj_move_over(size_t from_row_ndx, size_t to_row_ndx) noexcept -{ - typedef _impl::TableFriend tf; - - size_t i = 0, n = m_entries.size(); - // We return true if, and only if we remove the last entry in the map. We - // need special handling for the case, where the set of entries are already - // empty, otherwise the final return statement would return true in this - // case, even though we didn't actually remove an entry. - if (n == 0) - return false; - - while (i < n) { - SubtableEntry& e = m_entries[i]; - if (REALM_UNLIKELY(e.m_subtable_ndx == to_row_ndx)) { - // Must hold a counted reference while detaching - TableRef table(e.m_table); - tf::detach(*table); - // Delete entry by moving last over (faster and avoids invalidating - // iterators) - e = m_entries[--n]; - m_entries.pop_back(); - } - else { - if (REALM_UNLIKELY(e.m_subtable_ndx == from_row_ndx)) { - e.m_subtable_ndx = to_row_ndx; - if (fix_ndx_in_parent) - tf::set_ndx_in_parent(*(e.m_table), e.m_subtable_ndx); - } - ++i; - } - } - return m_entries.empty(); -} - -template -void SubtableColumnBase::SubtableMap::adj_swap_rows(size_t row_ndx_1, size_t row_ndx_2) noexcept -{ - using tf = _impl::TableFriend; - for (auto& entry : m_entries) { - if (REALM_UNLIKELY(entry.m_subtable_ndx == row_ndx_1)) { - entry.m_subtable_ndx = row_ndx_2; - if (fix_ndx_in_parent) - tf::set_ndx_in_parent(*(entry.m_table), entry.m_subtable_ndx); - } - else if (REALM_UNLIKELY(entry.m_subtable_ndx == row_ndx_2)) { - entry.m_subtable_ndx = row_ndx_1; - if (fix_ndx_in_parent) - tf::set_ndx_in_parent(*(entry.m_table), entry.m_subtable_ndx); - } - } -} - -inline SubtableColumnBase::SubtableColumnBase(Allocator& alloc, ref_type ref, Table* table, size_t column_ndx) - : IntegerColumn(alloc, ref, column_ndx) // Throws - , m_table(table) -{ -} - -inline void SubtableColumnBase::update_child_ref(size_t child_ndx, ref_type new_ref) -{ - set(child_ndx, new_ref); -} - -inline ref_type SubtableColumnBase::get_child_ref(size_t child_ndx) const noexcept -{ - return get_as_ref(child_ndx); -} - -inline void SubtableColumnBase::discard_child_accessors() noexcept -{ - bool last_entry_removed = m_subtable_map.detach_and_remove_all(); - if (last_entry_removed && m_table) - _impl::TableFriend::unbind_ptr(*m_table); -} - -inline SubtableColumnBase::~SubtableColumnBase() noexcept -{ - discard_child_accessors(); -} - -inline bool SubtableColumnBase::compare_subtable_rows(const Table& a, const Table& b) -{ - return _impl::TableFriend::compare_rows(a, b); -} - -inline ref_type SubtableColumnBase::clone_table_columns(const Table* t) -{ - return _impl::TableFriend::clone_columns(*t, get_root_array()->get_alloc()); -} - -inline ref_type SubtableColumnBase::create(Allocator& alloc, size_t size) -{ - return IntegerColumn::create(alloc, Array::type_HasRefs, size); // Throws -} - -inline size_t* SubtableColumnBase::record_subtable_path(size_t* begin, size_t* end) noexcept -{ - if (end == begin) - return 0; // Error, not enough space in buffer - *begin++ = get_column_index(); - if (end == begin) - return 0; // Error, not enough space in buffer - return _impl::TableFriend::record_subtable_path(*m_table, begin, end); -} - -inline void SubtableColumnBase::update_table_accessors(const size_t* col_path_begin, const size_t* col_path_end, - _impl::TableFriend::AccessorUpdater& updater) -{ - // This function must assume no more than minimal consistency of the - // accessor hierarchy. This means in particular that it cannot access the - // underlying node structure. See AccessorConsistencyLevels. - - m_subtable_map.update_accessors(col_path_begin, col_path_end, updater); // Throws -} - -inline void SubtableColumnBase::do_insert(size_t row_ndx, int_fast64_t value, size_t num_rows) -{ - IntegerColumn::insert_without_updating_index(row_ndx, value, num_rows); // Throws - bool is_append = row_ndx == realm::npos; - if (!is_append) { - const bool fix_ndx_in_parent = true; - m_subtable_map.adj_insert_rows(row_ndx, num_rows); - } -} - - -inline SubtableColumn::SubtableColumn(Allocator& alloc, ref_type ref, Table* table, size_t column_ndx) - : SubtableColumnBase(alloc, ref, table, column_ndx) - , m_subspec_ndx(realm::npos) -{ -} - -inline const Table* SubtableColumn::get_subtable_ptr(size_t subtable_ndx) const -{ - return const_cast(this)->get_subtable_ptr(subtable_ndx); -} - -inline void SubtableColumn::refresh_accessor_tree(size_t col_ndx, const Spec& spec) -{ - SubtableColumnBase::refresh_accessor_tree(col_ndx, spec); // Throws - m_subspec_ndx = spec.get_subspec_ndx(col_ndx); - m_subtable_map.refresh_accessor_tree(m_subspec_ndx); // Throws -} - -inline size_t SubtableColumn::get_subspec_ndx() const noexcept -{ - if (REALM_UNLIKELY(m_subspec_ndx == realm::npos)) { - typedef _impl::TableFriend tf; - const Spec& spec = tf::get_spec(*m_table); - m_subspec_ndx = spec.get_subspec_ndx(get_column_index()); - } - return m_subspec_ndx; -} - - -} // namespace realm - -#endif // REALM_COLUMN_TABLE_HPP diff --git a/Pods/Realm/include/core/realm/column_timestamp.hpp b/Pods/Realm/include/core/realm/column_timestamp.hpp deleted file mode 100644 index fa488599..00000000 --- a/Pods/Realm/include/core/realm/column_timestamp.hpp +++ /dev/null @@ -1,156 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_TIMESTAMP_HPP -#define REALM_COLUMN_TIMESTAMP_HPP - -#include -#include - -namespace realm { - -// Inherits from ColumnTemplate to get a compare_values() that can be called without knowing the -// column type -class TimestampColumn : public ColumnBaseSimple { -public: - TimestampColumn(bool nullable, Allocator& alloc, ref_type ref, size_t col_ndx = npos); - - static ref_type create(Allocator& alloc, size_t size, bool nullable); - static size_t get_size_from_ref(ref_type root_ref, Allocator& alloc) noexcept; - - /// Get the number of entries in this column. This operation is relatively - /// slow. - size_t size() const noexcept override; - /// Whether or not this column is nullable. - bool is_nullable() const noexcept override; - /// Whether or not the value at \a row_ndx is NULL. If the column is not - /// nullable, always returns false. - bool is_null(size_t row_ndx) const noexcept override; - /// Sets the value at \a row_ndx to be NULL. - /// \throw LogicError Thrown if this column is not nullable. - void set_null(size_t row_ndx) override; - void insert_rows(size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows, bool nullable) override; - void erase_rows(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, - bool broken_reciprocal_backlinks) override; - void move_last_row_over(size_t row_ndx, size_t prior_num_rows, bool broken_reciprocal_backlinks) override; - void clear(size_t num_rows, bool broken_reciprocal_backlinks) override; - void swap_rows(size_t row_ndx_1, size_t row_ndx_2) override; - void destroy() noexcept override; - - bool has_search_index() const noexcept final - { - return bool(m_search_index); - } - StringIndex* get_search_index() noexcept final - { - return m_search_index.get(); - } - StringIndex* get_search_index() const noexcept final - { - return m_search_index.get(); - } - void destroy_search_index() noexcept override; - void set_search_index_ref(ref_type ref, ArrayParent* parent, size_t ndx_in_parent, - bool allow_duplicate_values) final; - void populate_search_index(); - StringIndex* create_search_index() override; - bool supports_search_index() const noexcept final - { - return true; - } - - StringData get_index_data(size_t, StringIndex::StringConversionBuffer& buffer) const noexcept override; - ref_type write(size_t slice_offset, size_t slice_size, size_t table_size, _impl::OutputStream&) const override; - void update_from_parent(size_t old_baseline) noexcept override; - void set_ndx_in_parent(size_t ndx) noexcept override; - void refresh_accessor_tree(size_t new_col_ndx, const Spec&) override; - - void verify() const override; - void to_dot(std::ostream&, StringData title = StringData()) const override; - void do_dump_node_structure(std::ostream&, int level) const override; - void leaf_to_dot(MemRef, ArrayParent*, size_t ndx_in_parent, std::ostream&) const override; - - void add(const Timestamp& ts = Timestamp{}); - Timestamp get(size_t row_ndx) const noexcept; - void set(size_t row_ndx, const Timestamp& ts); - bool compare(const TimestampColumn& c) const noexcept; - int compare_values(size_t row1, size_t row2) const noexcept override; - - Timestamp maximum(size_t* result_index) const; - Timestamp minimum(size_t* result_index) const; - size_t count(Timestamp) const; - void erase(size_t row_ndx, bool is_last); - - template - size_t find(Timestamp value, size_t begin, size_t end) const noexcept - { - // FIXME: Here we can do all sorts of clever optimizations. Use bithack-search on seconds, then for each match - // check nanoseconds, etc. Lots of possibilities. Below code is naive and slow but works. - - Condition cond; - for (size_t t = begin; t < end; t++) { - Timestamp ts = get(t); - if (cond(ts, value, ts.is_null(), value.is_null())) - return t; - } - return npos; - } - - typedef Timestamp value_type; - -private: - std::unique_ptr>> m_seconds; - std::unique_ptr> m_nanoseconds; - - std::unique_ptr m_search_index; - bool m_nullable; - - template - class CreateHandler; - - template - Timestamp minmax(size_t* result_index) const noexcept - { - // Condition is realm::Greater for maximum and realm::Less for minimum. Any non-null value is both larger - // and smaller than a null value. - if (size() == 0) { - if (result_index) - *result_index = npos; - return Timestamp{}; - } - - Timestamp best = get(0); - size_t best_index = best.is_null() ? npos : 0; - - for (size_t i = 1; i < size(); ++i) { - Timestamp candidate = get(i); - // Condition() will return false if any of the two values are null. - if ((best.is_null() && !candidate.is_null()) || Condition()(candidate, best, candidate.is_null(), best.is_null())) { - best = candidate; - best_index = i; - } - } - if (result_index) - *result_index = best_index; - return best; - } -}; - -} // namespace realm - -#endif // REALM_COLUMN_TIMESTAMP_HPP diff --git a/Pods/Realm/include/core/realm/column_tpl.hpp b/Pods/Realm/include/core/realm/column_tpl.hpp deleted file mode 100644 index 2411007d..00000000 --- a/Pods/Realm/include/core/realm/column_tpl.hpp +++ /dev/null @@ -1,143 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_TPL_HPP -#define REALM_COLUMN_TPL_HPP - -#include - -#include -#include -#include - -namespace realm { - -template -class FloatDoubleNode; -template -class IntegerNode; -template -class SequentialGetter; - -template -struct ColumnTypeTraits2; - -template -struct ColumnTypeTraits2 { - typedef IntegerColumn column_type; - typedef ArrayInteger array_type; -}; -template -struct ColumnTypeTraits2 { - typedef IntegerColumn column_type; - typedef ArrayInteger array_type; -}; -template -struct ColumnTypeTraits2 { - typedef FloatColumn column_type; - typedef ArrayFloat array_type; -}; -template -struct ColumnTypeTraits2 { - typedef DoubleColumn column_type; - typedef ArrayDouble array_type; -}; - - -namespace _impl { - -template -struct FindInLeaf { - using LeafType = typename ColType::LeafType; - - template - static bool find(const LeafType& leaf, T target, size_t local_start, size_t local_end, size_t leaf_start, - QueryState& state) - { - Condition cond; - bool cont = true; - // todo, make an additional loop with hard coded `false` instead of is_null(v) for non-nullable columns - bool null_target = null::is_null_float(target); - for (size_t local_index = local_start; cont && local_index < local_end; local_index++) { - auto v = leaf.get(local_index); - if (cond(v, target, null::is_null_float(v), null_target)) { - cont = state.template match(leaf_start + local_index, 0, static_cast(v)); - } - } - return cont; - } -}; - -template <> -struct FindInLeaf { - using LeafType = IntegerColumn::LeafType; - - template - static bool find(const LeafType& leaf, T target, size_t local_start, size_t local_end, size_t leaf_start, - QueryState& state) - { - const int c = Condition::condition; - return leaf.find(c, action, target, local_start, local_end, leaf_start, &state); - } -}; - -template <> -struct FindInLeaf { - using LeafType = IntNullColumn::LeafType; - - template - static bool find(const LeafType& leaf, T target, size_t local_start, size_t local_end, size_t leaf_start, - QueryState& state) - { - constexpr int cond = Condition::condition; - return leaf.find(cond, action, target, local_start, local_end, leaf_start, &state); - } -}; - -} // namespace _impl - -template -R aggregate(const ColType& column, T target, size_t start, size_t end, size_t limit, size_t* return_ndx) -{ - if (end == npos) - end = column.size(); - - QueryState state; - state.init(action, nullptr, limit); - SequentialGetter sg{&column}; - - bool cont = true; - for (size_t s = start; cont && s < end;) { - sg.cache_next(s); - size_t start2 = s - sg.m_leaf_start; - size_t end2 = sg.local_end(end); - cont = _impl::FindInLeaf::template find(*sg.m_leaf_ptr, target, start2, end2, - sg.m_leaf_start, state); - s = sg.m_leaf_start + end2; - } - - if (return_ndx) - *return_ndx = action == act_Sum ? state.m_match_count : state.m_minmax_index; - - return state.m_state; -} - - -} // namespace realm - -#endif // REALM_COLUMN_TPL_HPP diff --git a/Pods/Realm/include/core/realm/column_type.hpp b/Pods/Realm/include/core/realm/column_type.hpp deleted file mode 100644 index 5a6e21cb..00000000 --- a/Pods/Realm/include/core/realm/column_type.hpp +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_TYPE_HPP -#define REALM_COLUMN_TYPE_HPP - -namespace realm { - - -// Note: Enumeration value assignments must be kept in sync with -// . -enum ColumnType { - // Column types - col_type_Int = 0, - col_type_Bool = 1, - col_type_String = 2, - col_type_StringEnum = 3, // double refs - col_type_Binary = 4, - col_type_Table = 5, - col_type_Mixed = 6, - col_type_OldDateTime = 7, - col_type_Timestamp = 8, - col_type_Float = 9, - col_type_Double = 10, - col_type_Reserved4 = 11, // Decimal - col_type_Link = 12, - col_type_LinkList = 13, - col_type_BackLink = 14 -}; - - -// Column attributes can be combined using bitwise or. -enum ColumnAttr { - col_attr_None = 0, - col_attr_Indexed = 1, - - /// Specifies that this column forms a unique constraint. It requires - /// `col_attr_Indexed`. - col_attr_Unique = 2, - - /// Reserved for future use. - col_attr_Reserved = 4, - - /// Specifies that the links of this column are strong, not weak. Applies - /// only to link columns (`type_Link` and `type_LinkList`). - col_attr_StrongLinks = 8, - - /// Specifies that elements in the column can be null. - col_attr_Nullable = 16 -}; - - -} // namespace realm - -#endif // REALM_COLUMN_TYPE_HPP diff --git a/Pods/Realm/include/core/realm/column_type_traits.hpp b/Pods/Realm/include/core/realm/column_type_traits.hpp deleted file mode 100644 index df9c2361..00000000 --- a/Pods/Realm/include/core/realm/column_type_traits.hpp +++ /dev/null @@ -1,163 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_COLUMN_TYPE_TRAITS_HPP -#define REALM_COLUMN_TYPE_TRAITS_HPP - -#include -#include -#include - -namespace realm { - -class OldDateTime; -class ArrayBinary; -class ArrayInteger; -class ArrayIntNull; -template -class BasicArray; - -template -struct ColumnTypeTraits; - -template <> -struct ColumnTypeTraits { - using column_type = Column; - using leaf_type = ArrayInteger; - using sum_type = int64_t; - using minmax_type = int64_t; - static const DataType id = type_Int; - static const ColumnType column_id = col_type_Int; - static const ColumnType real_column_type = col_type_Int; -}; - -template <> -struct ColumnTypeTraits> { - using column_type = Column>; - using leaf_type = ArrayIntNull; - using sum_type = int64_t; - using minmax_type = int64_t; - static const DataType id = type_Int; - static const ColumnType column_id = col_type_Int; - static const ColumnType real_column_type = col_type_Int; -}; - -template <> -struct ColumnTypeTraits : ColumnTypeTraits { - static const DataType id = type_Bool; - static const ColumnType column_id = col_type_Bool; -}; - -template <> -struct ColumnTypeTraits> : ColumnTypeTraits> { - static const DataType id = type_Bool; - static const ColumnType column_id = col_type_Bool; -}; - -template <> -struct ColumnTypeTraits { - using column_type = FloatColumn; - using leaf_type = BasicArray; - using sum_type = double; - using minmax_type = float; - static const DataType id = type_Float; - static const ColumnType column_id = col_type_Float; - static const ColumnType real_column_type = col_type_Float; -}; - -template <> -struct ColumnTypeTraits { - using column_type = DoubleColumn; - using leaf_type = BasicArray; - using sum_type = double; - using minmax_type = double; - static const DataType id = type_Double; - static const ColumnType column_id = col_type_Double; - static const ColumnType real_column_type = col_type_Double; -}; - -template <> -struct ColumnTypeTraits : ColumnTypeTraits { - static const DataType id = type_OldDateTime; - static const ColumnType column_id = col_type_OldDateTime; -}; - -template <> -struct ColumnTypeTraits> : ColumnTypeTraits> { - static const DataType id = type_OldDateTime; - static const ColumnType column_id = col_type_OldDateTime; -}; - -template <> -struct ColumnTypeTraits { - using column_type = StringEnumColumn; - using leaf_type = ArrayInteger; - using sum_type = int64_t; - static const DataType id = type_String; - static const ColumnType column_id = col_type_String; - static const ColumnType real_column_type = col_type_String; -}; - -template <> -struct ColumnTypeTraits { - using column_type = BinaryColumn; - using leaf_type = ArrayBinary; - static const DataType id = type_Binary; - static const ColumnType column_id = col_type_Binary; - static const ColumnType real_column_type = col_type_Binary; -}; - -template -struct GetColumnType; -template <> -struct GetColumnType { - using type = IntegerColumn; -}; -template <> -struct GetColumnType { - using type = IntNullColumn; -}; -template -struct GetColumnType { - // FIXME: Null definition - using type = FloatColumn; -}; -template -struct GetColumnType { - // FIXME: Null definition - using type = DoubleColumn; -}; - -// Only purpose is to return 'double' if and only if source column (T) is float and you're doing a sum (A) -template -struct ColumnTypeTraitsSum { - typedef T sum_type; -}; - -template <> -struct ColumnTypeTraitsSum { - typedef double sum_type; -}; - -template -struct ColumnTypeTraitsSum, A> { - using sum_type = int64_t; -}; -} - -#endif // REALM_COLUMN_TYPE_TRAITS_HPP diff --git a/Pods/Realm/include/core/realm/data_type.hpp b/Pods/Realm/include/core/realm/data_type.hpp deleted file mode 100644 index 580982fb..00000000 --- a/Pods/Realm/include/core/realm/data_type.hpp +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_DATA_TYPE_HPP -#define REALM_DATA_TYPE_HPP - -namespace realm { - -// Note: Value assignments must be kept in sync with -// Note: Value assignments must be kept in sync with -// Note: Value assignments must be kept in sync with -// Note: Value assignments must be kept in sync with "com/realm/ColumnType.java" -// Note: Any change to this enum is a file-format breaking change. -enum DataType { - type_Int = 0, - type_Bool = 1, - type_Float = 9, - type_Double = 10, - type_String = 2, - type_Binary = 4, - type_OldDateTime = 7, - type_Timestamp = 8, - type_Table = 5, - type_Mixed = 6, - type_Link = 12, - type_LinkList = 13 -}; - -/// See Descriptor::set_link_type(). -enum LinkType { - link_Strong, - link_Weak, -}; - -} // namespace realm - -#endif // REALM_DATA_TYPE_HPP diff --git a/Pods/Realm/include/core/realm/descriptor.hpp b/Pods/Realm/include/core/realm/descriptor.hpp deleted file mode 100644 index 10433eb6..00000000 --- a/Pods/Realm/include/core/realm/descriptor.hpp +++ /dev/null @@ -1,820 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_DESCRIPTOR_HPP -#define REALM_DESCRIPTOR_HPP - -#include - -#include -#include -#include - - -namespace realm { - -namespace _impl { -class DescriptorFriend; -} - - -/// Accessor for table type descriptors. -/// -/// A table type descriptor is an entity that specifies the dynamic -/// type of a Realm table. Objects of this class are accessors -/// through which the descriptor can be inspected and -/// changed. Accessors can become detached, see is_attached() for more -/// on this. The descriptor itself is stored inside the database file, -/// or elsewhere in case of a free-standing table or a table in a -/// free-standing group. -/// -/// The dynamic type consists first, and foremost of an ordered list -/// of column descriptors. Each column descriptor specifies the name -/// and type of the column. -/// -/// When a table has a subtable column, every cell in than column -/// contains a subtable. All those subtables have the same dynamic -/// type, and therefore have a shared descriptor. See is_root() for -/// more on this. -/// -/// The Table class contains convenience methods, such as -/// Table::get_column_count() and Table::add_column(), that allow you -/// to inspect and change the dynamic type of simple tables without -/// resorting to use of descriptors. For example, the following two -/// statements have the same effect: -/// -/// table->add_column(type, name); -/// table->get_descriptor()->add_column(type, name); -/// -/// Note, however, that this equivalence holds only as long as no -/// shared subtable descriptors are involved. -/// -/// \sa Table::get_descriptor() -class Descriptor : public std::enable_shared_from_this { -public: - /// Get the number of columns in the associated tables. - size_t get_column_count() const noexcept; - - /// Get the type of the column at the specified index. - /// - /// The consequences of specifying a column index that is out of - /// range, are undefined. - DataType get_column_type(size_t column_ndx) const noexcept; - - /// Get the name of the column at the specified index. - /// - /// The consequences of specifying a column index that is out of - /// range, are undefined. - StringData get_column_name(size_t column_ndx) const noexcept; - - /// Search for a column with the specified name. - /// - /// This function finds the first column with the specified name, - /// and returns its index. If there are no such columns, it - /// returns `not_found`. - size_t get_column_index(StringData name) const noexcept; - - /// Get the index of the column to which links in the column at the - /// specified index refer. - /// - /// The consequences of specifying a column index that is out of - /// range, are undefined. - /// - /// The consequences of specifying a column index that does not refer - /// to a link column, are undefined. - size_t get_column_link_target(size_t column_ndx) const noexcept; - - /// Get whether or not the specified column is nullable. - /// - /// The consequences of specifying a column index that is out of - /// range, are undefined. - bool is_nullable(size_t column_ndx) const noexcept; - - /// \defgroup descriptor_column_accessors Accessing Columns Via A Descriptor - /// - /// add_column() and add_column_link() are a shorthands for calling - /// insert_column() and insert_column_link(), respectively, with a column - /// index equal to the original number of columns. The returned value is - /// that column index. - /// - /// insert_column() inserts a new column into all the tables associated with - /// this descriptor. If any of the tables are not empty, the new column will - /// be filled with the default value associated with the specified data - /// type. This function cannot be used to insert link-type columns. For - /// that, you have to use insert_column_link() instead. - /// - /// This function modifies the dynamic type of all the tables that - /// share this descriptor. It does this by inserting a new column - /// with the specified name and type into the descriptor at the - /// specified index, and into each of the tables that share this - /// descriptor. - /// - /// insert_column_link() is like insert_column(), but inserts a link-type - /// column to a group-level table. It is not possible to add link-type - /// columns to tables that are not group-level tables. This functions must - /// be used in place of insert_column() when the column type is `type_Link` - /// or `type_LinkList`. A link-type column is associated with a particular - /// target table. All links in a link-type column refer to rows in the - /// target table of that column. The target table must also be a group-level - /// table, and it must belong to the same group as the origin table. - /// - /// \param name Name of new column. All strings are valid column names as - /// long as they are valid UTF-8 encodings and the number of bytes does not - /// exceed `max_column_name_length`. An attempt to add a column with a name - /// that is longer than `max_column_name_length` will cause an exception to - /// be thrown. - /// - /// \param subdesc If a non-null pointer is passed, and the - /// specified type is `type_Table`, then this function - /// automatically retrieves the descriptor associated with the new - /// subtable column, and stores a reference to its accessor in - /// `*subdesc`. - /// - /// \param col_ndx Insert the new column at this index. Preexisting columns - /// at indexes equal to, or greater than `col_ndx` will be shifted to the - /// next higher index. It is an error to specify an index that is greater - /// than the number of columns prior to the insertion. - /// - /// \param link_type See set_link_type(). - /// - /// \sa Table::add_column() - /// \sa Table::insert_column() - /// \sa Table::add_column_link() - /// \sa Table::insert_column_link() - /// \sa is_root() - //@{ - - static const size_t max_column_name_length = 63; - - size_t add_column(DataType type, StringData name, DescriptorRef* subdesc = nullptr, bool nullable = false); - - void insert_column(size_t col_ndx, DataType type, StringData name, DescriptorRef* subdesc = nullptr, - bool nullable = false); - - size_t add_column_link(DataType type, StringData name, Table& target, LinkType = link_Weak); - void insert_column_link(size_t col_ndx, DataType type, StringData name, Table& target, LinkType = link_Weak); - //@} - - /// Remove the specified column from each of the associated - /// tables. If the removed column is the only column in the - /// descriptor, then the table size will drop to zero for all - /// tables that were not already empty. - /// - /// This function modifies the dynamic type of all the tables that - /// share this descriptor. It does this by removing the column at - /// the specified index from the descriptor, and from each of the - /// tables that share this descriptor. The consequences of - /// specifying a column index that is out of range, are undefined. - /// - /// If the removed column was a subtable column, then the - /// associated descriptor accessor will be detached, if it - /// exists. This function will also detach all accessors of - /// subtables of the root table. Only the accessor of the root - /// table will remain attached. The root table is the table - /// associated with the root descriptor. - /// - /// \param col_ndx The index of the column to be removed. It is an error to - /// specify an index that is greater than, or equal to the number of - /// columns. - /// - /// \sa is_root() - /// \sa Table::remove_column() - void remove_column(size_t col_ndx); - - /// Rename the specified column. - /// - /// This function modifies the dynamic type of all the tables that - /// share this descriptor. The consequences of specifying a column - /// index that is out of range, are undefined. - /// - /// This function will detach all accessors of subtables of the - /// root table. Only the accessor of the root table will remain - /// attached. The root table is the table associated with the root - /// descriptor. - /// - /// \param col_ndx The index of the column to be renamed. It is an error to - /// specify an index that is greater than, or equal to the number of - /// columns. - /// - /// \param new_name The new name of the column. - /// - /// \sa is_root() - /// \sa Table::rename_column() - void rename_column(size_t col_ndx, StringData new_name); - - /// There are two kinds of links, 'weak' and 'strong'. A strong link is one - /// that implies ownership, i.e., that the origin row (parent) owns the - /// target row (child). Simply stated, this means that when the origin row - /// (parent) is removed, so is the target row (child). If there are multiple - /// strong links to a target row, the origin rows share ownership, and the - /// target row is removed when the last owner disappears. Weak links do not - /// imply ownership, and will be nullified or removed when the target row - /// disappears. - /// - /// To put this in precise terms; when a strong link is broken, and the - /// target row has no other strong links to it, the target row is removed. A - /// row that is implicitly removed in this way, is said to be - /// *cascade-removed*. When a weak link is broken, nothing is - /// cascade-removed. - /// - /// A link is considered broken if - /// - /// - the link is nullified, removed, or replaced by a different link - /// (Row::nullify_link(), Row::set_link(), LinkView::remove_link(), - /// LinkView::set_link(), LinkView::clear()), or if - /// - /// - the origin row is explicitly removed (Row::move_last_over(), - /// Table::clear()), or if - /// - /// - the origin row is cascade-removed, or if - /// - /// - the origin column is removed from the table (Table::remove_column()), - /// or if - /// - /// - the origin table is removed from the group. - /// - /// Note that a link is *not* considered broken when it is replaced by a - /// link to the same target row. I.e., no no rows will be cascade-removed - /// due to such an operation. - /// - /// When a row is explicitly removed (such as by Table::move_last_over()), - /// all links to it are automatically removed or nullified. For single link - /// columns (type_Link), links to the removed row are nullified. For link - /// list columns (type_LinkList), links to the removed row are removed from - /// the list. - /// - /// When a row is cascade-removed there can no longer be any strong links to - /// it, but if there are any weak links, they will be removed or nullified. - /// - /// It is important to understand that this cascade-removal scheme is too - /// simplistic to enable detection and removal of orphaned link-cycles. In - /// this respect, it suffers from the same limitations as a reference - /// counting scheme generally does. - /// - /// It is also important to understand, that the possible presence of a link - /// cycle can cause a row to be cascade-removed as a consequence of being - /// modified. This happens, for example, if two rows, A and B, have strong - /// links to each other, and there are no other strong links to either of - /// them. In this case, if A->B is changed to A->C, then both A and B will - /// be cascade-removed. This can lead to obscure bugs in some applications, - /// such as in the following case: - /// - /// table.set_link(col_ndx_1, row_ndx, ...); - /// table.set_int(col_ndx_2, row_ndx, ...); // Oops, `row_ndx` may no longer refer to the same row - /// - /// To be safe, applications, that may encounter cycles, are advised to - /// adopt the following pattern: - /// - /// Row row = table[row_ndx]; - /// row.set_link(col_ndx_1, ...); - /// if (row) - /// row.set_int(col_ndx_2, ...); // Ok, because we check whether the row has disappeared - /// - /// \param col_ndx The index of the link column (`type_Link` or - /// `type_LinkList`) to be modified. It is an error to specify an index that - /// is greater than, or equal to the number of columns, or to specify the - /// index of a non-link column. - /// - /// \param link_type The type of links the column should store. - void set_link_type(size_t col_ndx, LinkType link_type); - - //@{ - /// Get the descriptor for the specified subtable column. - /// - /// This function provides access to the shared subtable - /// descriptor for the subtables in the specified column. The - /// specified column must be a column whose type is 'table'. The - /// consequences of specifying a column of a different type, or - /// specifying an index that is out of range, are undefined. - /// - /// Note that this function cannot be used with 'mixed' columns, - /// since subtables of that kind have independent dynamic types, - /// and therefore, have independent descriptors. You can only get - /// access to the descriptor of a subtable in a mixed column by - /// first getting access to the subtable itself. - /// - /// \sa is_root() - DescriptorRef get_subdescriptor(size_t column_ndx); - ConstDescriptorRef get_subdescriptor(size_t column_ndx) const; - //@} - - //@{ - /// Returns the parent table descriptor, if any. - /// - /// If this descriptor is the *root descriptor*, then this - /// function returns null. Otherwise it returns the accessor of - /// the parent descriptor. - /// - /// \sa is_root() - DescriptorRef get_parent() noexcept; - ConstDescriptorRef get_parent() const noexcept; - //@} - - //@{ - /// Get the table associated with the root descriptor. - /// - /// \sa get_parent() - /// \sa is_root() - TableRef get_root_table() noexcept; - ConstTableRef get_root_table() const noexcept; - //@} - - //@{ - /// Get the target table associated with the specified link column. This - /// descriptor must be a root descriptor (is_root()), and the specified - /// column must be a link column (`type_Link` or `type_LinkList`). - TableRef get_link_target(size_t col_ndx) noexcept; - ConstTableRef get_link_target(size_t col_ndx) const noexcept; - //@} - - /// Is this a root descriptor? - /// - /// Descriptors of tables with independent dynamic type are root - /// descriptors. Root descriptors are never shared. Tables that - /// are direct members of groups have independent dynamic - /// types. The same is true for free-standing tables and subtables - /// in columns of type 'mixed'. - /// - /// When a table has a column of type 'table', the cells in that - /// column contain subtables. All those subtables have the same - /// dynamic type, and they share a single dynamic type - /// descriptor. Such shared descriptors are never root - /// descriptors. - /// - /// A type descriptor can even be shared by subtables with - /// different parent tables, but only if the parent tables - /// themselves have a shared type descriptor. For example, if a - /// table has a column `foo` of type 'table', and each of the - /// subtables in `foo` has a column `bar` of type 'table', then - /// all the subtables in all the `bar` columns share the same - /// dynamic type descriptor. - /// - /// \sa Table::has_shared_type() - bool is_root() const noexcept; - - /// Determine whether this accessor is still attached. - /// - /// A table descriptor accessor may get detached from the - /// underlying descriptor for various reasons (see below). When it - /// does, it no longer refers to that descriptor, and can no - /// longer be used, except for calling is_attached(). The - /// consequences of calling other methods on a detached accessor - /// are undefined. Descriptor accessors obtained by calling - /// functions in the Realm API are always in the 'attached' - /// state immediately upon return from those functions. - /// - /// A descriptor accessor that is obtained directly from a table - /// becomes detached if the table becomes detached. A shared - /// subtable descriptor accessor that is obtained by a call to - /// get_subdescriptor() becomes detached if the parent descriptor - /// accessor becomes detached, or if the corresponding subtable - /// column is removed. A descriptor accessor does not get detached - /// under any other circumstances. - bool is_attached() const noexcept; - - //@{ - /// \brief Compare two table descriptors. - /// - /// Two table descriptors are equal if they have the same number of columns, - /// and for each column index, the two columns have the same name, data - /// type, and set of attributes. - /// - /// For link columns (`type_Link` and `type_LinkList`), the target table - /// (get_link_target()) of the two columns must be the same. - /// - /// For subtable columns (`type_Table`), the two corresponding - /// subdescriptors must themselves be equal, as if by a recursive call to - /// operator==(). - /// - /// The consequences of comparing a detached descriptor are - /// undefined. - bool operator==(const Descriptor&) const noexcept; - bool operator!=(const Descriptor&) const noexcept; - //@} - - /// If the specified column is optimized to store only unique values, then - /// this function returns the number of unique values currently - /// stored. Otherwise it returns zero. This function is mainly intended for - /// debugging purposes. - size_t get_num_unique_values(size_t column_ndx) const; - - ~Descriptor() noexcept; - -private: - // for initialization through make_shared - struct PrivateTag { - }; - -public: - Descriptor(const PrivateTag&) - : Descriptor() - { - } - -private: - // Table associated with root descriptor. Detached iff null. - TableRef m_root_table; - DescriptorRef m_parent; // Null iff detached or root descriptor. - Spec* m_spec; // Valid if attached. Owned iff valid and `m_parent`. - - // Whenever a subtable descriptor accessor is created, it is - // stored in this map. This ensures that when get_subdescriptor() - // is called to created multiple DescriptorRef objects that - // overlap in time, then they will all refer to the same - // descriptor object. - // - // It also enables the necessary recursive detaching of descriptor - // objects. - struct subdesc_entry { - size_t m_column_ndx; - std::weak_ptr m_subdesc; - subdesc_entry(size_t column_ndx, DescriptorRef); - }; - typedef std::vector subdesc_map; - mutable subdesc_map m_subdesc_map; - - Descriptor() noexcept; - - // Called by the root table if this becomes the root - // descriptor. Otherwise it is called by the descriptor that - // becomes its parent. - // - // Puts this descriptor accessor into the attached state. This - // attaches it to the underlying structure of array nodes. It does - // not establish the parents reference to this descriptor, that is - // the job of the parent. When this function returns, - // is_attached() will return true. - // - // Not idempotent. - // - // The specified table is not allowed to be a subtable with a - // shareable spec. That is, Table::has_shared_spec() must return - // false. - // - // The specified spec must be the spec of the specified table or - // of one of its direct or indirect subtable columns. - // - // When the specified spec is the spec of the root table, the - // parent must be specified as null. When the specified spec is - // not the root spec, a proper parent must be specified. - void attach(Table*, DescriptorRef parent, Spec*) noexcept; - - // Detach accessor from underlying descriptor. Caller must ensure - // that a reference count exists upon return, for example by - // obtaining an extra reference count before the call. - // - // This function is called either by the root table if this is the - // root descriptor, or by the parent descriptor, if it is not. - // - // Puts this descriptor accessor into the detached state. This - // detaches it from the underlying structure of array nodes. It - // also calls detach_subdesc_accessors(). When this function - // returns, is_attached() will return false. - // - // Not idempotent. - void detach() noexcept; - - // Recursively detach all subtable descriptor accessors that - // exist, that is, all subtable descriptor accessors that have - // this descriptor as ancestor. - void detach_subdesc_accessors() noexcept; - - // Record the path in terms of subtable column indexes from the - // root descriptor to this descriptor. If this descriptor is a - // root descriptor, the path is empty. Returns zero if the path is - // too long to fit in the specified buffer. Otherwise the path - // indexes will be stored between `begin_2`and `end`, where - // `begin_2` is the returned pointer. - size_t* record_subdesc_path(size_t* begin, size_t* end) const noexcept; - - // Returns a pointer to the accessor of the specified - // subdescriptor if that accessor exists, otherwise this function - // return null. - DescriptorRef get_subdesc_accessor(size_t column_ndx) noexcept; - - void move_column(size_t from_ndx, size_t to_ndx); - - void adj_insert_column(size_t col_ndx) noexcept; - void adj_erase_column(size_t col_ndx) noexcept; - void adj_move_column(size_t col_ndx_1, size_t col_ndx_2) noexcept; - - friend class util::bind_ptr; - friend class util::bind_ptr; - friend class _impl::DescriptorFriend; -}; - - -// Implementation: - -inline size_t Descriptor::get_column_count() const noexcept -{ - REALM_ASSERT(is_attached()); - return m_spec->get_public_column_count(); -} - -inline StringData Descriptor::get_column_name(size_t ndx) const noexcept -{ - REALM_ASSERT(is_attached()); - return m_spec->get_column_name(ndx); -} - -inline DataType Descriptor::get_column_type(size_t ndx) const noexcept -{ - REALM_ASSERT(is_attached()); - return m_spec->get_public_column_type(ndx); -} - -inline bool Descriptor::is_nullable(size_t ndx) const noexcept -{ - REALM_ASSERT(is_attached()); - return m_spec->get_column_attr(ndx) & col_attr_Nullable; -} - -inline size_t Descriptor::get_column_index(StringData name) const noexcept -{ - REALM_ASSERT(is_attached()); - return m_spec->get_column_index(name); -} - -inline size_t Descriptor::get_column_link_target(size_t column_ndx) const noexcept -{ - REALM_ASSERT(is_attached()); - return m_spec->get_opposite_link_table_ndx(column_ndx); -} - -inline size_t Descriptor::add_column(DataType type, StringData name, DescriptorRef* subdesc, bool nullable) -{ - size_t col_ndx = m_spec->get_public_column_count(); - insert_column(col_ndx, type, name, subdesc, nullable); // Throws - return col_ndx; -} - -inline void Descriptor::insert_column(size_t col_ndx, DataType type, StringData name, DescriptorRef* subdesc, - bool nullable) -{ - typedef _impl::TableFriend tf; - - if (REALM_UNLIKELY(!is_attached())) - throw LogicError(LogicError::detached_accessor); - if (REALM_UNLIKELY(col_ndx > get_column_count())) - throw LogicError(LogicError::column_index_out_of_range); - if (REALM_UNLIKELY(tf::is_link_type(ColumnType(type)))) - throw LogicError(LogicError::illegal_type); - - LinkTargetInfo invalid_link; - tf::insert_column(*this, col_ndx, type, name, invalid_link, nullable); // Throws - adj_insert_column(col_ndx); - if (subdesc && type == type_Table) - *subdesc = get_subdescriptor(col_ndx); -} - -inline size_t Descriptor::add_column_link(DataType type, StringData name, Table& target, LinkType link_type) -{ - size_t col_ndx = m_spec->get_public_column_count(); - insert_column_link(col_ndx, type, name, target, link_type); // Throws - return col_ndx; -} - -inline void Descriptor::insert_column_link(size_t col_ndx, DataType type, StringData name, Table& target, - LinkType link_type) -{ - typedef _impl::TableFriend tf; - - if (REALM_UNLIKELY(!is_attached() || !target.is_attached())) - throw LogicError(LogicError::detached_accessor); - if (REALM_UNLIKELY(col_ndx > get_column_count())) - throw LogicError(LogicError::column_index_out_of_range); - if (REALM_UNLIKELY(!tf::is_link_type(ColumnType(type)))) - throw LogicError(LogicError::illegal_type); - if (REALM_UNLIKELY(!is_root())) - throw LogicError(LogicError::wrong_kind_of_descriptor); - // Both origin and target must be group-level tables, and in the same group. - Group* origin_group = tf::get_parent_group(*get_root_table()); - Group* target_group = tf::get_parent_group(target); - if (!origin_group || !target_group) - throw LogicError(LogicError::wrong_kind_of_table); - if (origin_group != target_group) - throw LogicError(LogicError::group_mismatch); - - LinkTargetInfo link(&target); - tf::insert_column(*this, col_ndx, type, name, link); // Throws - adj_insert_column(col_ndx); - - tf::set_link_type(*get_root_table(), col_ndx, link_type); // Throws -} - -inline void Descriptor::remove_column(size_t col_ndx) -{ - typedef _impl::TableFriend tf; - - if (REALM_UNLIKELY(!is_attached())) - throw LogicError(LogicError::detached_accessor); - if (REALM_UNLIKELY(col_ndx >= get_column_count())) - throw LogicError(LogicError::column_index_out_of_range); - - tf::erase_column(*this, col_ndx); // Throws - adj_erase_column(col_ndx); -} - -inline void Descriptor::rename_column(size_t col_ndx, StringData name) -{ - typedef _impl::TableFriend tf; - - if (REALM_UNLIKELY(!is_attached())) - throw LogicError(LogicError::detached_accessor); - if (REALM_UNLIKELY(col_ndx >= get_column_count())) - throw LogicError(LogicError::column_index_out_of_range); - - tf::rename_column(*this, col_ndx, name); // Throws -} - -inline void Descriptor::move_column(size_t from_ndx, size_t to_ndx) -{ - REALM_ASSERT(is_attached()); - typedef _impl::TableFriend tf; - tf::move_column(*this, from_ndx, to_ndx); // Throws - adj_move_column(from_ndx, to_ndx); -} - -inline void Descriptor::set_link_type(size_t col_ndx, LinkType link_type) -{ - typedef _impl::TableFriend tf; - - if (REALM_UNLIKELY(!is_attached())) - throw LogicError(LogicError::detached_accessor); - if (REALM_UNLIKELY(col_ndx >= get_column_count())) - throw LogicError(LogicError::column_index_out_of_range); - if (REALM_UNLIKELY(!tf::is_link_type(ColumnType(get_column_type(col_ndx))))) - throw LogicError(LogicError::illegal_type); - - tf::set_link_type(*get_root_table(), col_ndx, link_type); // Throws -} - -inline ConstDescriptorRef Descriptor::get_subdescriptor(size_t column_ndx) const -{ - return const_cast(this)->get_subdescriptor(column_ndx); -} - -inline DescriptorRef Descriptor::get_parent() noexcept -{ - return m_parent; -} - -inline ConstDescriptorRef Descriptor::get_parent() const noexcept -{ - return const_cast(this)->get_parent(); -} - -inline TableRef Descriptor::get_root_table() noexcept -{ - return m_root_table; -} - -inline ConstTableRef Descriptor::get_root_table() const noexcept -{ - return const_cast(this)->get_root_table(); -} - -inline TableRef Descriptor::get_link_target(size_t col_ndx) noexcept -{ - REALM_ASSERT(is_attached()); - REALM_ASSERT(is_root()); - return get_root_table()->get_link_target(col_ndx); -} - -inline ConstTableRef Descriptor::get_link_target(size_t col_ndx) const noexcept -{ - REALM_ASSERT(is_attached()); - REALM_ASSERT(is_root()); - return get_root_table()->get_link_target(col_ndx); -} - -inline bool Descriptor::is_root() const noexcept -{ - return !m_parent; -} - -inline Descriptor::Descriptor() noexcept -{ -} - -inline void Descriptor::attach(Table* table, DescriptorRef parent, Spec* spec) noexcept -{ - REALM_ASSERT(!is_attached()); - REALM_ASSERT(!table->has_shared_type()); - m_root_table.reset(table); - m_parent = parent; - m_spec = spec; -} - -inline bool Descriptor::is_attached() const noexcept -{ - return bool(m_root_table); -} - -inline Descriptor::subdesc_entry::subdesc_entry(size_t n, DescriptorRef d) - : m_column_ndx(n) - , m_subdesc(d) -{ -} - -inline bool Descriptor::operator==(const Descriptor& d) const noexcept -{ - REALM_ASSERT(is_attached()); - REALM_ASSERT(d.is_attached()); - return *m_spec == *d.m_spec; -} - -inline bool Descriptor::operator!=(const Descriptor& d) const noexcept -{ - return !(*this == d); -} - -// The purpose of this class is to give internal access to some, but -// not all of the non-public parts of the Descriptor class. -class _impl::DescriptorFriend { -public: - static DescriptorRef create() - { - return std::make_shared(Descriptor::PrivateTag()); // Throws - } - - static void attach(Descriptor& desc, Table* table, DescriptorRef parent, Spec* spec) noexcept - { - desc.attach(table, parent, spec); - } - - static void detach(Descriptor& desc) noexcept - { - desc.detach(); - } - - static Table& get_root_table(Descriptor& desc) noexcept - { - return *desc.m_root_table; - } - - static const Table& get_root_table(const Descriptor& desc) noexcept - { - return *desc.m_root_table; - } - - static Spec& get_spec(Descriptor& desc) noexcept - { - return *desc.m_spec; - } - - static const Spec& get_spec(const Descriptor& desc) noexcept - { - return *desc.m_spec; - } - - static size_t* record_subdesc_path(const Descriptor& desc, size_t* begin, size_t* end) noexcept - { - return desc.record_subdesc_path(begin, end); - } - - static DescriptorRef get_subdesc_accessor(Descriptor& desc, size_t column_ndx) noexcept - { - return desc.get_subdesc_accessor(column_ndx); - } - - static void move_column(Descriptor& desc, size_t from_ndx, size_t to_ndx) - { - return desc.move_column(from_ndx, to_ndx); - } - - static void adj_insert_column(Descriptor& desc, size_t col_ndx) noexcept - { - desc.adj_insert_column(col_ndx); - } - - static void adj_erase_column(Descriptor& desc, size_t col_ndx) noexcept - { - desc.adj_erase_column(col_ndx); - } - - static void adj_move_column(Descriptor& desc, size_t col_ndx_1, size_t col_ndx_2) noexcept - { - desc.adj_move_column(col_ndx_1, col_ndx_2); - } -}; - -} // namespace realm - -#endif // REALM_DESCRIPTOR_HPP diff --git a/Pods/Realm/include/core/realm/descriptor_fwd.hpp b/Pods/Realm/include/core/realm/descriptor_fwd.hpp deleted file mode 100644 index 29377248..00000000 --- a/Pods/Realm/include/core/realm/descriptor_fwd.hpp +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_DESCRIPTOR_FWD_HPP -#define REALM_DESCRIPTOR_FWD_HPP - -#include - - -namespace realm { - -class Descriptor; -typedef std::shared_ptr DescriptorRef; -typedef std::shared_ptr ConstDescriptorRef; - -} // namespace realm - -#endif // REALM_DESCRIPTOR_FWD_HPP diff --git a/Pods/Realm/include/core/realm/disable_sync_to_disk.hpp b/Pods/Realm/include/core/realm/disable_sync_to_disk.hpp deleted file mode 100644 index f642d6f1..00000000 --- a/Pods/Realm/include/core/realm/disable_sync_to_disk.hpp +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_DISABLE_SYNC_TO_DISK_HPP -#define REALM_DISABLE_SYNC_TO_DISK_HPP - -#include - -namespace realm { - -/// Completely disable synchronization with storage device to speed up unit -/// testing. This is an unsafe mode of operation, and should never be used in -/// production. This function is thread safe. -void disable_sync_to_disk(); - -/// Returns true after disable_sync_to_disk() has been called. This function is -/// thread safe. -bool get_disable_sync_to_disk() noexcept; - -} // namespace realm - -#endif // REALM_DISABLE_SYNC_TO_DISK_HPP diff --git a/Pods/Realm/include/core/realm/exceptions.hpp b/Pods/Realm/include/core/realm/exceptions.hpp deleted file mode 100644 index a2dcd550..00000000 --- a/Pods/Realm/include/core/realm/exceptions.hpp +++ /dev/null @@ -1,270 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_EXCEPTIONS_HPP -#define REALM_EXCEPTIONS_HPP - -#include - -#include - -namespace realm { - -/// Thrown by various functions to indicate that a specified table does not -/// exist. -class NoSuchTable : public std::exception { -public: - const char* what() const noexcept override; -}; - - -/// Thrown by various functions to indicate that a specified table name is -/// already in use. -class TableNameInUse : public std::exception { -public: - const char* what() const noexcept override; -}; - - -// Thrown by functions that require a table to **not** be the target of link -// columns, unless those link columns are part of the table itself. -class CrossTableLinkTarget : public std::exception { -public: - const char* what() const noexcept override; -}; - - -/// Thrown by various functions to indicate that the dynamic type of a table -/// does not match a particular other table type (dynamic or static). -class DescriptorMismatch : public std::exception { -public: - const char* what() const noexcept override; -}; - - -/// The \c FileFormatUpgradeRequired exception can be thrown by the \c -/// SharedGroup constructor when opening a database that uses a deprecated file -/// format, and the user has indicated he does not want automatic upgrades to -/// be performed. This exception indicates that until an upgrade of the file -/// format is performed, the database will be unavailable for read or write -/// operations. -class FileFormatUpgradeRequired : public std::exception { -public: - const char* what() const noexcept override; -}; - - -/// Thrown when a sync agent attempts to join a session in which there is -/// already a sync agent. A session may only contain one sync agent at any given -/// time. -class MultipleSyncAgents : public std::exception { -public: - const char* what() const noexcept override; -}; - - -/// Thrown when memory can no longer be mapped to. When mmap/remap fails. -class AddressSpaceExhausted : public std::runtime_error { -public: - AddressSpaceExhausted(const std::string& msg); - /// runtime_error::what() returns the msg provided in the constructor. -}; - - -/// The \c LogicError exception class is intended to be thrown only when -/// applications (or bindings) violate rules that are stated (or ought to have -/// been stated) in the documentation of the public API, and only in cases -/// where the violation could have been easily and efficiently predicted by the -/// application. In other words, this exception class is for the cases where -/// the error is due to incorrect use of the public API. -/// -/// This class is not supposed to be caught by applications. It is not even -/// supposed to be considered part of the public API, and therefore the -/// documentation of the public API should **not** mention the \c LogicError -/// exception class by name. Note how this contrasts with other exception -/// classes, such as \c NoSuchTable, which are part of the public API, and are -/// supposed to be mentioned in the documentation by name. The \c LogicError -/// exception is part of Realm's private API. -/// -/// In other words, the \c LogicError class should exclusively be used in -/// replacement (or in addition to) asserts (debug or not) in order to -/// guarantee program interruption, while still allowing for complete -/// test-cases to be written and run. -/// -/// To this effect, the special `CHECK_LOGIC_ERROR()` macro is provided as a -/// test framework plugin to allow unit tests to check that the functions in -/// the public API do throw \c LogicError when rules are violated. -/// -/// The reason behind hiding this class from the public API is to prevent users -/// from getting used to the idea that "Undefined Behaviour" equates a specific -/// exception being thrown. The whole point of properly documenting "Undefined -/// Behaviour" cases is to help the user know what the limits are, without -/// constraining the database to handle every and any use-case thrown at it. -/// -/// FIXME: This exception class should probably be moved to the `_impl` -/// namespace, in order to avoid some confusion. -class LogicError : public std::exception { -public: - enum ErrorKind { - string_too_big, - binary_too_big, - table_name_too_long, - column_name_too_long, - table_index_out_of_range, - row_index_out_of_range, - column_index_out_of_range, - string_position_out_of_range, - link_index_out_of_range, - bad_version, - illegal_type, - - /// Indicates that an argument has a value that is illegal in combination - /// with another argument, or with the state of an involved object. - illegal_combination, - - /// Indicates a data type mismatch, such as when `Table::find_pkey_int()` is - /// called and the type of the primary key is not `type_Int`. - type_mismatch, - - /// Indicates that two involved tables are not in the same group. - group_mismatch, - - /// Indicates that an involved descriptor is of the wrong kind, i.e., if - /// it is a subtable descriptor, and the function requires a root table - /// descriptor. - wrong_kind_of_descriptor, - - /// Indicates that an involved table is of the wrong kind, i.e., if it - /// is a subtable, and the function requires a root table, or if it is a - /// free-standing table, and the function requires a group-level table. - wrong_kind_of_table, - - /// Indicates that an involved accessor is was detached, i.e., was not - /// attached to an underlying object. - detached_accessor, - - /// Indicates that a specified row index of a target table (a link) is - /// out of range. This is used for disambiguation in cases such as - /// Table::set_link() where one specifies both a row index of the origin - /// table, and a row index of the target table. - target_row_index_out_of_range, - - // Indicates that an involved column lacks a search index. - no_search_index, - - /// Indicates that a modification was attempted that would have produced a - /// duplicate primary value. - unique_constraint_violation, - - /// User attempted to insert null in non-nullable column - column_not_nullable, - - /// Group::open() is called on a group accessor that is already in the - /// attached state. Or Group::open() or Group::commit() is called on a - /// group accessor that is managed by a SharedGroup object. - wrong_group_state, - - /// No active transaction on a particular SharedGroup object (e.g., - /// SharedGroup::commit()), or the active transaction on the SharedGroup - /// object is of the wrong type (read/write), or an attampt was made to - /// initiate a new transaction while one is already in progress on the - /// same SharedGroup object. - wrong_transact_state, - - /// Attempted use of a continuous transaction through a SharedGroup - /// object with no history. See Replication::get_history(). - no_history, - - /// Durability setting (as passed to the SharedGroup constructor) was - /// not consistent across the session. - mixed_durability, - - /// History type (as specified by the Replication implementation passed - /// to the SharedGroup constructor) was not consistent across the - /// session. - mixed_history_type, - - /// Adding rows to a table with no columns is not supported. - table_has_no_columns - }; - - LogicError(ErrorKind message); - - const char* what() const noexcept override; - ErrorKind kind() const noexcept; - -private: - ErrorKind m_kind; -}; - - -// Implementation: - -// LCOV_EXCL_START (Wording of what() strings are not to be tested) - -inline const char* NoSuchTable::what() const noexcept -{ - return "No such table exists"; -} - -inline const char* TableNameInUse::what() const noexcept -{ - return "The specified table name is already in use"; -} - -inline const char* CrossTableLinkTarget::what() const noexcept -{ - return "Table is target of cross-table link columns"; -} - -inline const char* DescriptorMismatch::what() const noexcept -{ - return "Table descriptor mismatch"; -} - -inline const char* FileFormatUpgradeRequired::what() const noexcept -{ - return "Database upgrade required but prohibited"; -} - -inline const char* MultipleSyncAgents::what() const noexcept -{ - return "Multiple sync agents attempted to join the same session"; -} - -// LCOV_EXCL_STOP - -inline AddressSpaceExhausted::AddressSpaceExhausted(const std::string& msg) - : std::runtime_error(msg) -{ -} - -inline LogicError::LogicError(LogicError::ErrorKind k) - : m_kind(k) -{ -} - -inline LogicError::ErrorKind LogicError::kind() const noexcept -{ - return m_kind; -} - - -} // namespace realm - -#endif // REALM_EXCEPTIONS_HPP diff --git a/Pods/Realm/include/core/realm/group.hpp b/Pods/Realm/include/core/realm/group.hpp deleted file mode 100644 index 490dd263..00000000 --- a/Pods/Realm/include/core/realm/group.hpp +++ /dev/null @@ -1,1371 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_GROUP_HPP -#define REALM_GROUP_HPP - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace realm { - -class SharedGroup; -namespace _impl { -class GroupFriend; -class TransactLogConvenientEncoder; -class TransactLogParser; -} - - -/// A group is a collection of named tables. -/// -/// Tables occur in the group in an unspecified order, but an order that -/// generally remains fixed. The order is guaranteed to remain fixed between two -/// points in time if no tables are added to, or removed from the group during -/// that time. When tables are added to, or removed from the group, the order -/// may change arbitrarily. -/// -/// If `table` is a table accessor attached to a group-level table, and `group` -/// is a group accessor attached to the group, then the following is guaranteed, -/// even after a change in the table order: -/// -/// \code{.cpp} -/// -/// table == group.get_table(table.get_index_in_group()) -/// -/// \endcode -/// -class Group : private Table::Parent { -public: - /// Construct a free-standing group. This group instance will be - /// in the attached state, but neither associated with a file, nor - /// with an external memory buffer. - Group(); - - enum OpenMode { - /// Open in read-only mode. Fail if the file does not already exist. - mode_ReadOnly, - /// Open in read/write mode. Create the file if it doesn't exist. - mode_ReadWrite, - /// Open in read/write mode. Fail if the file does not already exist. - mode_ReadWriteNoCreate - }; - - /// Equivalent to calling open(const std::string&, const char*, OpenMode) - /// on an unattached group accessor. - explicit Group(const std::string& file, const char* encryption_key = nullptr, OpenMode = mode_ReadOnly); - - /// Equivalent to calling open(BinaryData, bool) on an unattached - /// group accessor. Note that if this constructor throws, the - /// ownership of the memory buffer will remain with the caller, - /// regardless of whether \a take_ownership is set to `true` or - /// `false`. - explicit Group(BinaryData, bool take_ownership = true); - - struct unattached_tag { - }; - - /// Create a Group instance in its unattached state. It may then - /// be attached to a database file later by calling one of the - /// open() methods. You may test whether this instance is - /// currently in its attached state by calling - /// is_attached(). Calling any other method (except the - /// destructor) while in the unattached state has undefined - /// behavior. - Group(unattached_tag) noexcept; - - // FIXME: Implement a proper copy constructor (fairly trivial). - Group(const Group&) = delete; - - ~Group() noexcept override; - - /// Attach this Group instance to the specified database file. - /// - /// By default, the specified file is opened in read-only mode - /// (mode_ReadOnly). This allows opening a file even when the - /// caller lacks permission to write to that file. The opened - /// group may still be modified freely, but the changes cannot be - /// written back to the same file using the commit() function. An - /// attempt to do that, will cause an exception to be thrown. When - /// opening in read-only mode, it is an error if the specified - /// file does not already exist in the file system. - /// - /// Alternatively, the file can be opened in read/write mode - /// (mode_ReadWrite). This allows use of the commit() function, - /// but, of course, it also requires that the caller has - /// permission to write to the specified file. When opening in - /// read-write mode, an attempt to create the specified file will - /// be made, if it does not already exist in the file system. - /// - /// In any case, if the file already exists, it must contain a - /// valid Realm database. In many cases invalidity will be - /// detected and cause the InvalidDatabase exception to be thrown, - /// but you should not rely on it. - /// - /// Note that changes made to the database via a Group instance - /// are not automatically committed to the specified file. You - /// may, however, at any time, explicitly commit your changes by - /// calling the commit() method, provided that the specified - /// open-mode is not mode_ReadOnly. Alternatively, you may call - /// write() to write the entire database to a new file. Writing - /// the database to a new file does not end, or in any other way - /// change the association between the Group instance and the file - /// that was specified in the call to open(). - /// - /// A file that is passed to Group::open(), may not be modified by - /// a third party until after the Group object is - /// destroyed. Behavior is undefined if a file is modified by a - /// third party while any Group object is associated with it. - /// - /// Calling open() on a Group instance that is already in the - /// attached state has undefined behavior. - /// - /// Accessing a Realm database file through manual construction - /// of a Group object does not offer any level of thread safety or - /// transaction safety. When any of those kinds of safety are a - /// concern, consider using a SharedGroup instead. When accessing - /// a database file in read/write mode through a manually - /// constructed Group object, it is entirely the responsibility of - /// the application that the file is not accessed in any way by a - /// third party during the life-time of that group object. It is, - /// on the other hand, safe to concurrently access a database file - /// by multiple manually created Group objects, as long as all of - /// them are opened in read-only mode, and there is no other party - /// that modifies the file concurrently. - /// - /// Do not call this function on a group instance that is managed - /// by a shared group. Doing so will result in undefined behavior. - /// - /// Even if this function throws, it may have the side-effect of - /// creating the specified file, and the file may get left behind - /// in an invalid state. Of course, this can only happen if - /// read/write mode (mode_ReadWrite) was requested, and the file - /// did not already exist. - /// - /// \param file File system path to a Realm database file. - /// - /// \param encryption_key 32-byte key used to encrypt and decrypt - /// the database file, or nullptr to disable encryption. - /// - /// \param mode Specifying a mode that is not mode_ReadOnly - /// requires that the specified file can be opened in read/write - /// mode. In general there is no reason to open a group in - /// read/write mode unless you want to be able to call - /// Group::commit(). - /// - /// \throw util::File::AccessError If the file could not be - /// opened. If the reason corresponds to one of the exception - /// types that are derived from util::File::AccessError, the - /// derived exception type is thrown. Note that InvalidDatabase is - /// among these derived exception types. - void open(const std::string& file, const char* encryption_key = nullptr, OpenMode mode = mode_ReadOnly); - - /// Attach this Group instance to the specified memory buffer. - /// - /// This is similar to constructing a group from a file except - /// that in this case the database is assumed to be stored in the - /// specified memory buffer. - /// - /// If \a take_ownership is `true`, you pass the ownership of the - /// specified buffer to the group. In this case the buffer will - /// eventually be freed using std::free(), so the buffer you pass, - /// must have been allocated using std::malloc(). - /// - /// On the other hand, if \a take_ownership is set to `false`, it - /// is your responsibility to keep the memory buffer alive during - /// the lifetime of the group, and in case the buffer needs to be - /// deallocated afterwards, that is your responsibility too. - /// - /// If this function throws, the ownership of the memory buffer - /// will remain with the caller, regardless of whether \a - /// take_ownership is set to `true` or `false`. - /// - /// Calling open() on a Group instance that is already in the - /// attached state has undefined behavior. - /// - /// Do not call this function on a group instance that is managed - /// by a shared group. Doing so will result in undefined behavior. - /// - /// \throw InvalidDatabase If the specified buffer does not appear - /// to contain a valid database. - void open(BinaryData, bool take_ownership = true); - - /// A group may be created in the unattached state, and then later - /// attached to a file with a call to open(). Calling any method - /// other than open(), and is_attached() on an unattached instance - /// results in undefined behavior. - bool is_attached() const noexcept; - - /// Returns true if, and only if the number of tables in this - /// group is zero. - bool is_empty() const noexcept; - - /// Returns the number of tables in this group. - size_t size() const noexcept; - - /// \defgroup group_table_access Table Accessors - /// - /// has_table() returns true if, and only if this group contains a table - /// with the specified name. - /// - /// find_table() returns the index of the first table in this group with the - /// specified name, or `realm::not_found` if this group does not contain a - /// table with the specified name. - /// - /// get_table_name() returns the name of table at the specified index. - /// - /// The versions of get_table(), that accepts a \a name argument, return the - /// first table with the specified name, or null if no such table exists. - /// - /// add_table() adds a table with the specified name to this group. It - /// throws TableNameInUse if \a require_unique_name is true and \a name - /// clashes with the name of an existing table. If \a require_unique_name is - /// false, it is possible to add more than one table with the same - /// name. Whenever a table is added, the order of the preexisting tables may - /// change arbitrarily, and the new table may not end up as the last one - /// either. But know that you can always call Table::get_index_in_group() on - /// the returned table accessor to find out at which index it ends up. - /// - /// get_or_add_table() checks if a table exists in this group with the specified - /// name. If it doesn't exist, a table is created. - /// - /// get_or_insert_table() works slightly differently from get_or_add_table(), - /// in that it considers the position of the requested table as part of that - /// table's identifying "key", in addition to the name. - /// - /// remove_table() removes the specified table from this group. A table can - /// be removed only when it is not the target of a link column of a - /// different table. Whenever a table is removed, the order of the remaining - /// tables may change arbitrarily. - /// - /// rename_table() changes the name of a preexisting table. If \a - /// require_unique_name is false, it becomes possible to have more than one - /// table with a given name in a single group. - /// - /// The template functions work exactly like their non-template namesakes - /// except as follows: The template versions of get_table() and - /// get_or_add_table() throw DescriptorMismatch if the dynamic type of the - /// specified table does not match the statically specified custom table - /// type. The template versions of add_table() and get_or_add_table() set - /// the dynamic type (descriptor) to match the statically specified custom - /// table type. - /// - /// \tparam T An instance of the BasicTable class template. - /// - /// \param index Index of table in this group. - /// - /// \param name Name of table. All strings are valid table names as long as - /// they are valid UTF-8 encodings and the number of bytes does not exceed - /// `max_table_name_length`. A call to add_table() or get_or_add_table() - /// with a name that is longer than `max_table_name_length` will cause an - /// exception to be thrown. - /// - /// \param new_name New name for preexisting table. - /// - /// \param require_unique_name When set to true (the default), it becomes - /// impossible to add a table with a name that is already in use, or to - /// rename a table to a name that is already in use. - /// - /// \param was_added When specified, the boolean variable is set to true if - /// the table was added, and to false otherwise. If the function throws, the - /// boolean variable retains its original value. - /// - /// \return get_table(), add_table(), and get_or_add_table() return a table - /// accessor attached to the requested (or added) table. get_table() may - /// return null. - /// - /// \throw DescriptorMismatch Thrown by get_table() and get_or_add_table() - /// tf the dynamic table type does not match the statically specified custom - /// table type (\a T). - /// - /// \throw NoSuchTable Thrown by remove_table() and rename_table() if there - /// is no table with the specified \a name. - /// - /// \throw TableNameInUse Thrown by add_table() if \a require_unique_name is - /// true and \a name clashes with the name of a preexisting table. Thrown by - /// rename_table() if \a require_unique_name is true and \a new_name clashes - /// with the name of a preexisting table. - /// - /// \throw CrossTableLinkTarget Thrown by remove_table() if the specified - /// table is the target of a link column of a different table. - /// - //@{ - - static const size_t max_table_name_length = 63; - - bool has_table(StringData name) const noexcept; - size_t find_table(StringData name) const noexcept; - StringData get_table_name(size_t table_ndx) const; - - TableRef get_table(size_t index); - ConstTableRef get_table(size_t index) const; - - TableRef get_table(StringData name); - ConstTableRef get_table(StringData name) const; - - TableRef add_table(StringData name, bool require_unique_name = true); - TableRef insert_table(size_t index, StringData name, bool require_unique_name = true); - TableRef get_or_add_table(StringData name, bool* was_added = nullptr); - TableRef get_or_insert_table(size_t index, StringData name, bool* was_added = nullptr); - - template - BasicTableRef get_table(size_t index); - - template - BasicTableRef get_table(size_t index) const; - - template - BasicTableRef get_table(StringData name); - - template - BasicTableRef get_table(StringData name) const; - - template - BasicTableRef add_table(StringData name, bool require_unique_name = true); - - template - BasicTableRef insert_table(size_t index, StringData name, bool require_unique_name = true); - - template - BasicTableRef get_or_add_table(StringData name, bool* was_added = nullptr); - - template - BasicTableRef get_or_insert_table(size_t index, StringData name, bool* was_added = nullptr); - - void remove_table(size_t index); - void remove_table(StringData name); - - void rename_table(size_t index, StringData new_name, bool require_unique_name = true); - void rename_table(StringData name, StringData new_name, bool require_unique_name = true); - - //@} - - /// Move the table at \a from_index such that it ends up at \a - /// to_index. Other tables are shifted as necessary in such a way that their - /// order is preserved. - /// - /// Note that \a to_index is the desired final index of the moved table, - /// therefore, `move_table(1,1)` is a no-op, while `move_table(1,2)` moves - /// the table at index 1 by one position, such that it ends up at index 2. A - /// side-effect of that, is that the table, that was originally at index 2, - /// is moved to index 1. - void move_table(size_t from_index, size_t to_index); - - // Serialization - - /// Write this database to the specified output stream. - /// - /// \param out The destination output stream to write to. - /// - /// \param pad If true, the file is padded to ensure the footer is aligned - /// to the end of a page - void write(std::ostream& out, bool pad = false) const; - - /// Write this database to a new file. It is an error to specify a - /// file that already exists. This is to protect against - /// overwriting a database file that is currently open, which - /// would cause undefined behaviour. - /// - /// \param file A filesystem path. - /// - /// \param encryption_key 32-byte key used to encrypt the database file, - /// or nullptr to disable encryption. - /// - /// \throw util::File::AccessError If the file could not be - /// opened. If the reason corresponds to one of the exception - /// types that are derived from util::File::AccessError, the - /// derived exception type is thrown. In particular, - /// util::File::Exists will be thrown if the file exists already. - void write(const std::string& file, const char* encryption_key = nullptr) const; - - /// Write this database to a memory buffer. - /// - /// Ownership of the returned buffer is transferred to the - /// caller. The memory will have been allocated using - /// std::malloc(). - BinaryData write_to_mem() const; - - /// Commit changes to the attached file. This requires that the - /// attached file is opened in read/write mode. - /// - /// Calling this function on an unattached group, a free-standing - /// group, a group whose attached file is opened in read-only - /// mode, a group that is attached to a memory buffer, or a group - /// that is managed by a shared group, is an error and will result - /// in undefined behavior. - /// - /// Table accesors will remain valid across the commit. Note that - /// this is not the case when working with proper transactions. - void commit(); - - //@{ - /// Some operations on Tables in a Group can cause indirect changes to other - /// fields, including in other Tables in the same Group. Specifically, - /// removing a row will set any links to that row to null, and if it had the - /// last strong links to other rows, will remove those rows. When this - /// happens, The cascade notification handler will be called with a - /// CascadeNotification containing information about what indirect changes - /// will occur, before any changes are made. - /// - /// has_cascade_notification_handler() returns true if and only if there is - /// currently a non-null notification handler registered. - /// - /// set_cascade_notification_handler() replaces the current handler (if any) - /// with the passed in handler. Pass in nullptr to remove the current handler - /// without registering a new one. - /// - /// CascadeNotification contains a vector of rows which will be removed and - /// a vector of links which will be set to null (or removed, for entries in - /// LinkLists). - struct CascadeNotification { - struct row { - /// Non-zero iff the removal of this row is ordered - /// (Table::remove()), as opposed to ordered - /// (Table::move_last_over()). Implicit removals are always - /// unordered. - /// - /// This flag does not take part in comparisons (operator==() and - /// operator<()). - size_t is_ordered_removal : 1; - - /// Index within group of a group-level table. - size_t table_ndx : std::numeric_limits::digits - 1; - - /// Row index which will be removed. - size_t row_ndx; - - row() - : is_ordered_removal(0) - { - } - - bool operator==(const row&) const noexcept; - bool operator!=(const row&) const noexcept; - - /// Trivial lexicographic order - bool operator<(const row&) const noexcept; - }; - - struct link { - const Table* origin_table; ///< A group-level table. - size_t origin_col_ndx; ///< Link column being nullified. - size_t origin_row_ndx; ///< Row in column being nullified. - /// The target row index which is being removed. Mostly relevant for - /// LinkList (to know which entries are being removed), but also - /// valid for Link. - size_t old_target_row_ndx; - }; - - /// A sorted list of rows which will be removed by the current operation. - std::vector rows; - - /// An unordered list of links which will be nullified by the current - /// operation. - std::vector links; - }; - - bool has_cascade_notification_handler() const noexcept; - void set_cascade_notification_handler(std::function new_handler) noexcept; - - //@} - - //@{ - /// During sync operation, schema changes may happen at runtime as connected - /// clients update their schema as part of an app update. Since this is a - /// relatively rare event, no attempt is made at limiting the amount of work - /// the handler is required to do to update its information about table and - /// column indices (i.e., all table and column indices must be recalculated). - /// - /// At the time of writing, only additive schema changes may occur in that - /// scenario. - /// - /// has_schema_change_notification_handler() returns true iff there is currently - /// a non-null notification handler registered. - /// - /// set_schema_change_notification_handler() replaces the current handler (if any) - /// with the passed in handler. Pass in nullptr to remove the current handler - /// without registering a new one. - - bool has_schema_change_notification_handler() const noexcept; - void set_schema_change_notification_handler(std::function new_handler) noexcept; - - //@} - - // Conversion - template - void to_json(S& out, size_t link_depth = 0, std::map* renames = nullptr) const; - void to_string(std::ostream& out) const; - - /// Compare two groups for equality. Two groups are equal if, and - /// only if, they contain the same tables in the same order, that - /// is, for each table T at index I in one of the groups, there is - /// a table at index I in the other group that is equal to T. - /// Tables are equal if they have the same content and the same table name. - bool operator==(const Group&) const; - - /// Compare two groups for inequality. See operator==(). - bool operator!=(const Group& g) const - { - return !(*this == g); - } - - void verify() const; -#ifdef REALM_DEBUG - void print() const; - void print_free() const; - MemStats stats(); - void enable_mem_diagnostics(bool enable = true) - { - m_alloc.enable_debug(enable); - } - void to_dot(std::ostream&) const; - void to_dot() const; // To std::cerr (for GDB) - void to_dot(const char* file_path) const; -#endif - -private: - SlabAlloc m_alloc; - - /// `m_top` is the root node (or top array) of the Realm, and has the - /// following layout: - /// - ///

-    ///
-    ///   slot  value
-    ///   -----------------------
-    ///   1st   m_table_names
-    ///   2nd   m_tables
-    ///   3rd   Logical file size
-    ///   4th   GroupWriter::m_free_positions (optional)
-    ///   5th   GroupWriter::m_free_lengths   (optional)
-    ///   6th   GroupWriter::m_free_versions  (optional)
-    ///   7th   Transaction number / version  (optional)
-    ///   8th   In-Realm history type         (optional)
-    ///   9th   In-Realm history ref          (optional)
-    ///
-    /// 
- /// - /// The 'in-Realm history type' slot stores a value of - /// Replication::HistoryType, although never - /// Replication::hist_OutOfRealm. For more information about that, see - /// Replication::get_history_type(). - /// - /// The first three entries are mandatory. In files created by - /// Group::write(), none of the optional entries are present and the size of - /// `m_top` is 3. In files updated by Group::commit(), the 4th and 5th entry - /// is present, and the size of `m_top` is 5. In files updated by way of a - /// transaction (SharedGroup::commit()), the 4th, 5th, 6th, and 7th entry is - /// present, and the size of `m_top` is 7. In files that contain a changeset - /// history, the 8th and 9th entry is present. - /// - /// When a group accessor is attached to a newly created file or an empty - /// memory buffer where there is no top array yet, `m_top`, `m_tables`, and - /// `m_table_names` with be left in the detached state until the initiation - /// of the first write transaction. In particular, they will remain in the - /// detached state during read transactions that precede the first write - /// transaction. - Array m_top; - ArrayInteger m_tables; - ArrayString m_table_names; - - typedef std::vector table_accessors; - mutable table_accessors m_table_accessors; - - bool m_attached = false; - const bool m_is_shared; - - std::function m_notify_handler; - std::function m_schema_change_handler; - - struct shared_tag { - }; - Group(shared_tag) noexcept; - - void init_array_parents() noexcept; - - /// If `top_ref` is not zero, attach this group accessor to the specified - /// underlying node structure. If `top_ref` is zero and \a - /// create_group_when_missing is true, create a new node structure that - /// represents an empty group, and attach this group accessor to it. It is - /// an error to call this function on an already attached group accessor. - void attach(ref_type top_ref, bool create_group_when_missing); - - /// Detach this group accessor from the underlying node structure. If this - /// group accessors is already in the detached state, this function does - /// nothing (idempotency). - void detach() noexcept; - - /// \param writable Must be set to true when, and only when attaching for a - /// write transaction. - void attach_shared(ref_type new_top_ref, size_t new_file_size, bool writable); - - void create_empty_group(); - - void reset_free_space_tracking(); - - void remap(size_t new_file_size); - void remap_and_update_refs(ref_type new_top_ref, size_t new_file_size); - - /// Recursively update refs stored in all cached array - /// accessors. This includes cached array accessors in any - /// currently attached table accessors. This ensures that the - /// group instance itself, as well as any attached table accessor - /// that exists across Group::commit() will remain valid. This - /// function is not appropriate for use in conjunction with - /// commits via shared group. - void update_refs(ref_type top_ref, size_t old_baseline) noexcept; - - // Overriding method in ArrayParent - void update_child_ref(size_t, ref_type) override; - - // Overriding method in ArrayParent - ref_type get_child_ref(size_t) const noexcept override; - - // Overriding method in Table::Parent - StringData get_child_name(size_t) const noexcept override; - - // Overriding method in Table::Parent - void child_accessor_destroyed(Table*) noexcept override; - - // Overriding method in Table::Parent - Group* get_parent_group() noexcept override; - - class TableWriter; - class DefaultTableWriter; - - static void write(std::ostream&, const Allocator&, TableWriter&, bool no_top_array, bool pad_for_encryption, - uint_fast64_t version_number); - - typedef void (*DescSetter)(Table&); - typedef bool (*DescMatcher)(const Spec&); - - Table* do_get_table(size_t table_ndx, DescMatcher desc_matcher); - const Table* do_get_table(size_t table_ndx, DescMatcher desc_matcher) const; - Table* do_get_table(StringData name, DescMatcher desc_matcher); - const Table* do_get_table(StringData name, DescMatcher desc_matcher) const; - Table* do_insert_table(size_t, StringData name, DescSetter desc_setter, bool require_unique_name); - Table* do_insert_table(size_t, StringData name, DescSetter desc_setter); - Table* do_get_or_add_table(StringData name, DescMatcher desc_matcher, DescSetter setter, bool* was_added); - Table* do_get_or_insert_table(size_t, StringData name, DescMatcher desc_matcher, DescSetter desc_setter, - bool* was_added); - - void create_and_insert_table(size_t new_table_ndx, StringData name); - Table* create_table_accessor(size_t table_ndx); - - void detach_table_accessors() noexcept; // Idempotent - - void mark_all_table_accessors() noexcept; - - void write(const std::string& file, const char* encryption_key, uint_fast64_t version_number) const; - void write(util::File& file, const char* encryption_key, uint_fast64_t version_number) const; - void write(std::ostream&, bool pad, uint_fast64_t version_numer) const; - - Replication* get_replication() const noexcept; - void set_replication(Replication*) noexcept; - class TransactAdvancer; - void advance_transact(ref_type new_top_ref, size_t new_file_size, _impl::NoCopyInputStream&); - void refresh_dirty_accessors(); - template - void update_table_indices(F&& map_function); - - int get_file_format_version() const noexcept; - void set_file_format_version(int) noexcept; - int get_committed_file_format_version() const noexcept; - - /// The specified history type must be a value of Replication::HistoryType. - static int get_target_file_format_version_for_session(int current_file_format_version, int history_type) noexcept; - - /// Must be called from within a write transaction - void upgrade_file_format(int target_file_format_version); - - std::pair get_to_dot_parent(size_t ndx_in_parent) const override; - - void send_cascade_notification(const CascadeNotification& notification) const; - void send_schema_change_notification() const; - - static void get_version_and_history_type(const Array& top, _impl::History::version_type& version, - int& history_type) noexcept; - static ref_type get_history_ref(const Array& top) noexcept; - void set_history_parent(Array& history_root) noexcept; - void prepare_history_parent(Array& history_root, int history_type); - - friend class Table; - friend class GroupWriter; - friend class SharedGroup; - friend class _impl::GroupFriend; - friend class _impl::TransactLogConvenientEncoder; - friend class _impl::TransactLogParser; - friend class Replication; - friend class TrivialReplication; -}; - - -// Implementation - -inline Group::Group(const std::string& file, const char* key, OpenMode mode) - : m_alloc() // Throws - , m_top(m_alloc) - , m_tables(m_alloc) - , m_table_names(m_alloc) - , m_is_shared(false) -{ - init_array_parents(); - - open(file, key, mode); // Throws -} - -inline Group::Group(BinaryData buffer, bool take_ownership) - : m_alloc() // Throws - , m_top(m_alloc) - , m_tables(m_alloc) - , m_table_names(m_alloc) - , m_is_shared(false) -{ - init_array_parents(); - open(buffer, take_ownership); // Throws -} - -inline Group::Group(unattached_tag) noexcept - : m_alloc() - , // Throws - m_top(m_alloc) - , m_tables(m_alloc) - , m_table_names(m_alloc) - , m_is_shared(false) -{ - init_array_parents(); -} - -inline Group* Group::get_parent_group() noexcept -{ - return this; -} - -inline Group::Group(shared_tag) noexcept - : m_alloc() - , // Throws - m_top(m_alloc) - , m_tables(m_alloc) - , m_table_names(m_alloc) - , m_is_shared(true) -{ - init_array_parents(); -} - -inline bool Group::is_attached() const noexcept -{ - return m_attached; -} - -inline bool Group::is_empty() const noexcept -{ - if (!is_attached()) - return false; - if (m_table_names.is_attached()) - return m_table_names.is_empty(); - return true; -} - -inline size_t Group::size() const noexcept -{ - if (!is_attached()) - return 0; - if (m_table_names.is_attached()) - return m_table_names.size(); - return 0; -} - -inline StringData Group::get_table_name(size_t table_ndx) const -{ - if (table_ndx >= size()) - throw LogicError(LogicError::table_index_out_of_range); - return m_table_names.get(table_ndx); -} - -inline bool Group::has_table(StringData name) const noexcept -{ - size_t ndx = find_table(name); - return ndx != not_found; -} - -inline size_t Group::find_table(StringData name) const noexcept -{ - if (!is_attached()) - return 0; - if (m_table_names.is_attached()) - return m_table_names.find_first(name); - return not_found; -} - -inline TableRef Group::get_table(size_t table_ndx) -{ - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = nullptr; // Do not check descriptor - Table* table = do_get_table(table_ndx, desc_matcher); // Throws - return TableRef(table); -} - -inline ConstTableRef Group::get_table(size_t table_ndx) const -{ - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = nullptr; // Do not check descriptor - const Table* table = do_get_table(table_ndx, desc_matcher); // Throws - return ConstTableRef(table); -} - -inline TableRef Group::get_table(StringData name) -{ - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = nullptr; // Do not check descriptor - Table* table = do_get_table(name, desc_matcher); // Throws - return TableRef(table); -} - -inline ConstTableRef Group::get_table(StringData name) const -{ - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = nullptr; // Do not check descriptor - const Table* table = do_get_table(name, desc_matcher); // Throws - return ConstTableRef(table); -} - -inline TableRef Group::insert_table(size_t table_ndx, StringData name, bool require_unique_name) -{ - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescSetter desc_setter = nullptr; // Do not add any columns - Table* table = do_insert_table(table_ndx, name, desc_setter, require_unique_name); // Throws - return TableRef(table); -} - -inline TableRef Group::add_table(StringData name, bool require_unique_name) -{ - return insert_table(size(), name, require_unique_name); -} - -inline TableRef Group::get_or_insert_table(size_t table_ndx, StringData name, bool* was_added) -{ - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = nullptr; // Do not check descriptor - DescSetter desc_setter = nullptr; // Do not add any columns - Table* table = do_get_or_insert_table(table_ndx, name, desc_matcher, desc_setter, was_added); // Throws - return TableRef(table); -} - -inline TableRef Group::get_or_add_table(StringData name, bool* was_added) -{ - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = nullptr; // Do not check descriptor - DescSetter desc_setter = nullptr; // Do not add any columns - Table* table = do_get_or_add_table(name, desc_matcher, desc_setter, was_added); // Throws - return TableRef(table); -} - -template -inline BasicTableRef Group::get_table(size_t table_ndx) -{ - static_assert(IsBasicTable::value, "Invalid table type"); - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = &T::matches_dynamic_type; - Table* table = do_get_table(table_ndx, desc_matcher); // Throws - return BasicTableRef(static_cast(table)); -} - -template -inline BasicTableRef Group::get_table(size_t table_ndx) const -{ - static_assert(IsBasicTable::value, "Invalid table type"); - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = &T::matches_dynamic_type; - const Table* table = do_get_table(table_ndx, desc_matcher); // Throws - return BasicTableRef(static_cast(table)); -} - -template -inline BasicTableRef Group::get_table(StringData name) -{ - static_assert(IsBasicTable::value, "Invalid table type"); - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = &T::matches_dynamic_type; - Table* table = do_get_table(name, desc_matcher); // Throws - return BasicTableRef(static_cast(table)); -} - -template -inline BasicTableRef Group::get_table(StringData name) const -{ - static_assert(IsBasicTable::value, "Invalid table type"); - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = &T::matches_dynamic_type; - const Table* table = do_get_table(name, desc_matcher); // Throws - return BasicTableRef(static_cast(table)); -} - -template -inline BasicTableRef Group::insert_table(size_t table_ndx, StringData name, bool require_unique_name) -{ - static_assert(IsBasicTable::value, "Invalid table type"); - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescSetter desc_setter = &T::set_dynamic_type; - Table* table = do_insert_table(table_ndx, name, desc_setter, require_unique_name); // Throws - return BasicTableRef(static_cast(table)); -} - -template -inline BasicTableRef Group::add_table(StringData name, bool require_unique_name) -{ - return insert_table(size(), name, require_unique_name); -} - -template -BasicTableRef Group::get_or_insert_table(size_t table_ndx, StringData name, bool* was_added) -{ - static_assert(IsBasicTable::value, "Invalid table type"); - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = &T::matches_dynamic_type; - DescSetter desc_setter = &T::set_dynamic_type; - Table* table = do_get_or_insert_table(table_ndx, name, desc_matcher, desc_setter, was_added); // Throws - return BasicTableRef(static_cast(table)); -} - -template -BasicTableRef Group::get_or_add_table(StringData name, bool* was_added) -{ - static_assert(IsBasicTable::value, "Invalid table type"); - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - DescMatcher desc_matcher = &T::matches_dynamic_type; - DescSetter desc_setter = &T::set_dynamic_type; - Table* table = do_get_or_add_table(name, desc_matcher, desc_setter, was_added); // Throws - return BasicTableRef(static_cast(table)); -} - -template -void Group::to_json(S& out, size_t link_depth, std::map* renames) const -{ - if (!is_attached()) - throw LogicError(LogicError::detached_accessor); - - std::map renames2; - renames = renames ? renames : &renames2; - - out << "{"; - - for (size_t i = 0; i < m_tables.size(); ++i) { - StringData name = m_table_names.get(i); - std::map& m = *renames; - if (m[name] != "") - name = m[name]; - - ConstTableRef table = get_table(i); - - if (i) - out << ","; - out << "\"" << name << "\""; - out << ":"; - table->to_json(out, link_depth, renames); - } - - out << "}"; -} - -inline void Group::init_array_parents() noexcept -{ - m_table_names.set_parent(&m_top, 0); - m_tables.set_parent(&m_top, 1); -} - -inline void Group::update_child_ref(size_t child_ndx, ref_type new_ref) -{ - m_tables.set(child_ndx, new_ref); -} - -inline ref_type Group::get_child_ref(size_t child_ndx) const noexcept -{ - return m_tables.get_as_ref(child_ndx); -} - -inline StringData Group::get_child_name(size_t child_ndx) const noexcept -{ - return m_table_names.get(child_ndx); -} - -inline void Group::child_accessor_destroyed(Table*) noexcept -{ - // Ignore -} - -inline bool Group::has_cascade_notification_handler() const noexcept -{ - return !!m_notify_handler; -} - -inline void -Group::set_cascade_notification_handler(std::function new_handler) noexcept -{ - m_notify_handler = std::move(new_handler); -} - -inline void Group::send_cascade_notification(const CascadeNotification& notification) const -{ - if (m_notify_handler) - m_notify_handler(notification); -} - -inline bool Group::has_schema_change_notification_handler() const noexcept -{ - return !!m_schema_change_handler; -} - -inline void Group::set_schema_change_notification_handler(std::function new_handler) noexcept -{ - m_schema_change_handler = std::move(new_handler); -} - -inline void Group::send_schema_change_notification() const -{ - if (m_schema_change_handler) - m_schema_change_handler(); -} - -inline void Group::get_version_and_history_type(const Array& top, _impl::History::version_type& version, - int& history_type) noexcept -{ - _impl::History::version_type version_2 = 0; - int history_type_2 = 0; - if (top.is_attached()) { - if (top.size() >= 6) { - REALM_ASSERT(top.size() >= 7); - version_2 = _impl::History::version_type(top.get(6) / 2); - } - if (top.size() >= 8) { - REALM_ASSERT(top.size() >= 9); - history_type_2 = int(top.get(7) / 2); - } - } - // Version 0 is not a legal initial version, so it has to be set to 1 - // instead. - if (version_2 == 0) - version_2 = 1; - version = version_2; - history_type = history_type_2; -} - -inline ref_type Group::get_history_ref(const Array& top) noexcept -{ - if (top.is_attached()) { - if (top.size() >= 8) { - REALM_ASSERT(top.size() >= 9); - return top.get_as_ref(8); - } - } - return 0; -} - -inline void Group::set_history_parent(Array& history_root) noexcept -{ - history_root.set_parent(&m_top, 8); -} - -inline void Group::prepare_history_parent(Array& history_root, int history_type) -{ - REALM_ASSERT(m_alloc.get_file_format_version() >= 4); - // Ensure that there are slots for both the history type and the history - // ref. - while (m_top.size() < 9) - m_top.add(0); // Throws - m_top.set(7, RefOrTagged::make_tagged(history_type)); // Throws - set_history_parent(history_root); -} - -class Group::TableWriter { -public: - virtual ref_type write_names(_impl::OutputStream&) = 0; - virtual ref_type write_tables(_impl::OutputStream&) = 0; - virtual ~TableWriter() noexcept - { - } -}; - -inline const Table* Group::do_get_table(size_t table_ndx, DescMatcher desc_matcher) const -{ - return const_cast(this)->do_get_table(table_ndx, desc_matcher); // Throws -} - -inline const Table* Group::do_get_table(StringData name, DescMatcher desc_matcher) const -{ - return const_cast(this)->do_get_table(name, desc_matcher); // Throws -} - -inline void Group::reset_free_space_tracking() -{ - m_alloc.reset_free_space_tracking(); // Throws -} - -inline Replication* Group::get_replication() const noexcept -{ - return m_alloc.get_replication(); -} - -inline void Group::set_replication(Replication* repl) noexcept -{ - m_alloc.set_replication(repl); -} - -// The purpose of this class is to give internal access to some, but -// not all of the non-public parts of the Group class. -class _impl::GroupFriend { -public: - static Allocator& get_alloc(Group& group) noexcept - { - return group.m_alloc; - } - - static Table& get_table(Group& group, size_t ndx_in_group) - { - Group::DescMatcher desc_matcher = 0; // Do not check descriptor - Table* table = group.do_get_table(ndx_in_group, desc_matcher); // Throws - return *table; - } - - static const Table& get_table(const Group& group, size_t ndx_in_group) - { - Group::DescMatcher desc_matcher = 0; // Do not check descriptor - const Table* table = group.do_get_table(ndx_in_group, desc_matcher); // Throws - return *table; - } - - static Table* get_table(Group& group, StringData name) - { - Group::DescMatcher desc_matcher = 0; // Do not check descriptor - Table* table = group.do_get_table(name, desc_matcher); // Throws - return table; - } - - static const Table* get_table(const Group& group, StringData name) - { - Group::DescMatcher desc_matcher = 0; // Do not check descriptor - const Table* table = group.do_get_table(name, desc_matcher); // Throws - return table; - } - - static Table& insert_table(Group& group, size_t table_ndx, StringData name, bool require_unique_name) - { - Group::DescSetter desc_setter = nullptr; // Do not add any columns - return *group.do_insert_table(table_ndx, name, desc_setter, require_unique_name); - } - - static Table& add_table(Group& group, StringData name, bool require_unique_name) - { - return insert_table(group, group.size(), name, require_unique_name); - } - - static Table& get_or_insert_table(Group& group, size_t table_ndx, StringData name, bool* was_inserted) - { - Group::DescMatcher desc_matcher = nullptr; // Do not check descriptor - Group::DescSetter desc_setter = nullptr; // Do not add any columns - return *group.do_get_or_insert_table(table_ndx, name, desc_matcher, desc_setter, was_inserted); - } - - static Table& get_or_add_table(Group& group, StringData name, bool* was_inserted) - { - Group::DescMatcher desc_matcher = nullptr; // Do not check descriptor - Group::DescSetter desc_setter = nullptr; // Do not add any columns - return *group.do_get_or_add_table(name, desc_matcher, desc_setter, was_inserted); - } - - static void send_cascade_notification(const Group& group, const Group::CascadeNotification& notification) - { - group.send_cascade_notification(notification); - } - - static Replication* get_replication(const Group& group) noexcept - { - return group.get_replication(); - } - - static void set_replication(Group& group, Replication* repl) noexcept - { - group.set_replication(repl); - } - - static void detach(Group& group) noexcept - { - group.detach(); - } - - static void attach_shared(Group& group, ref_type new_top_ref, size_t new_file_size, bool writable) - { - group.attach_shared(new_top_ref, new_file_size, writable); // Throws - } - - static void reset_free_space_tracking(Group& group) - { - group.reset_free_space_tracking(); // Throws - } - - static void remap(Group& group, size_t new_file_size) - { - group.remap(new_file_size); // Throws - } - - static void remap_and_update_refs(Group& group, ref_type new_top_ref, size_t new_file_size) - { - group.remap_and_update_refs(new_top_ref, new_file_size); // Throws - } - - static void advance_transact(Group& group, ref_type new_top_ref, size_t new_file_size, - _impl::NoCopyInputStream& in) - { - group.advance_transact(new_top_ref, new_file_size, in); // Throws - } - - static void create_empty_group_when_missing(Group& group) - { - if (!group.m_top.is_attached()) - group.create_empty_group(); // Throws - } - - static void get_version_and_history_type(Allocator& alloc, ref_type top_ref, - _impl::History::version_type& version, int& history_type) noexcept - { - Array top(alloc); - if (top_ref != 0) - top.init_from_ref(top_ref); - Group::get_version_and_history_type(top, version, history_type); - } - - static ref_type get_history_ref(const Group& group) noexcept - { - return Group::get_history_ref(group.m_top); - } - - static ref_type get_history_ref(Allocator& alloc, ref_type top_ref) noexcept - { - Array top(alloc); - if (top_ref != 0) - top.init_from_ref(top_ref); - return Group::get_history_ref(top); - } - - static void set_history_parent(Group& group, Array& history_root) noexcept - { - group.set_history_parent(history_root); - } - - static void prepare_history_parent(Group& group, Array& history_root, int history_type) - { - group.prepare_history_parent(history_root, history_type); // Throws - } - - static int get_file_format_version(const Group& group) noexcept - { - return group.get_file_format_version(); - } - - static void set_file_format_version(Group& group, int file_format_version) noexcept - { - group.set_file_format_version(file_format_version); - } - - static int get_committed_file_format_version(const Group& group) noexcept - { - return group.get_committed_file_format_version(); - } - - static int get_target_file_format_version_for_session(int current_file_format_version, int history_type) noexcept - { - return Group::get_target_file_format_version_for_session(current_file_format_version, history_type); - } - - static void upgrade_file_format(Group& group, int target_file_format_version) - { - group.upgrade_file_format(target_file_format_version); // Throws - } -}; - - -struct CascadeState : Group::CascadeNotification { - /// If non-null, then no recursion will be performed for rows of that - /// table. The effect is then exactly as if all the rows of that table were - /// added to \a state.rows initially, and then removed again after the - /// explicit invocations of Table::cascade_break_backlinks_to() (one for - /// each initiating row). This is used by Table::clear() to avoid - /// reentrance. - /// - /// Must never be set concurrently with stop_on_link_list_column. - Table* stop_on_table = nullptr; - - /// If non-null, then Table::cascade_break_backlinks_to() will skip the - /// removal of reciprocal backlinks for the link list at - /// stop_on_link_list_row_ndx in this column, and no recursion will happen - /// on its behalf. This is used by LinkView::clear() to avoid reentrance. - /// - /// Must never be set concurrently with stop_on_table. - LinkListColumn* stop_on_link_list_column = nullptr; - - /// Is ignored if stop_on_link_list_column is null. - size_t stop_on_link_list_row_ndx = 0; - - /// If false, the links field is not needed, so any work done just for that - /// can be skipped. - bool track_link_nullifications = false; -}; - -inline bool Group::CascadeNotification::row::operator==(const row& r) const noexcept -{ - return table_ndx == r.table_ndx && row_ndx == r.row_ndx; -} - -inline bool Group::CascadeNotification::row::operator!=(const row& r) const noexcept -{ - return !(*this == r); -} - -inline bool Group::CascadeNotification::row::operator<(const row& r) const noexcept -{ - return table_ndx < r.table_ndx || (table_ndx == r.table_ndx && row_ndx < r.row_ndx); -} - -} // namespace realm - -#endif // REALM_GROUP_HPP diff --git a/Pods/Realm/include/core/realm/group_shared.hpp b/Pods/Realm/include/core/realm/group_shared.hpp deleted file mode 100644 index f595e6f4..00000000 --- a/Pods/Realm/include/core/realm/group_shared.hpp +++ /dev/null @@ -1,1183 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_GROUP_SHARED_HPP -#define REALM_GROUP_SHARED_HPP - -#ifdef REALM_DEBUG -#include // usleep() -#endif - -#include -#include -#include -#include -#ifndef _WIN32 -#include -#endif -#include -#include -#include -#include -#include -#include -#include - -namespace realm { - -namespace _impl { -class SharedGroupFriend; -class WriteLogCollector; -} - -/// Thrown by SharedGroup::open() if the lock file is already open in another -/// process which can't share mutexes with this process -struct IncompatibleLockFile : std::runtime_error { - IncompatibleLockFile(const std::string& msg) - : std::runtime_error("Incompatible lock file. " + msg) - { - } -}; - -/// Thrown by SharedGroup::open() if the realm database was generated with -/// a format for Realm Mobile Platform but is being opened as a Realm -/// Mobile Database or vice versa. -struct IncompatibleHistories : util::File::AccessError { - IncompatibleHistories(const std::string& msg, const std::string& path) - : util::File::AccessError("Incompatible histories. " + msg, path) - { - } -}; - -/// A SharedGroup facilitates transactions. -/// -/// When multiple threads or processes need to access a database -/// concurrently, they must do so using transactions. By design, -/// Realm does not allow for multiple threads (or processes) to -/// share a single instance of SharedGroup. Instead, each concurrently -/// executing thread or process must use a separate instance of -/// SharedGroup. -/// -/// Each instance of SharedGroup manages a single transaction at a -/// time. That transaction can be either a read transaction, or a -/// write transaction. -/// -/// Utility classes ReadTransaction and WriteTransaction are provided -/// to make it safe and easy to work with transactions in a scoped -/// manner (by means of the RAII idiom). However, transactions can -/// also be explicitly started (begin_read(), begin_write()) and -/// stopped (end_read(), commit(), rollback()). -/// -/// If a transaction is active when the SharedGroup is destroyed, that -/// transaction is implicitly terminated, either by a call to -/// end_read() or rollback(). -/// -/// Two processes that want to share a database file must reside on -/// the same host. -/// -/// -/// Desired exception behavior (not yet fully implemented) -/// ------------------------------------------------------ -/// -/// - If any data access API function throws an unexpected exception during a -/// read transaction, the shared group accessor is left in state "error -/// during read". -/// -/// - If any data access API function throws an unexpected exception during a -/// write transaction, the shared group accessor is left in state "error -/// during write". -/// -/// - If SharedGroup::begin_write() or SharedGroup::begin_read() throws an -/// unexpected exception, the shared group accessor is left in state "no -/// transaction in progress". -/// -/// - SharedGroup::end_read() and SharedGroup::rollback() do not throw. -/// -/// - If SharedGroup::commit() throws an unexpected exception, the shared group -/// accessor is left in state "error during write" and the transaction was -/// not committed. -/// -/// - If SharedGroup::advance_read() or SharedGroup::promote_to_write() throws -/// an unexpected exception, the shared group accessor is left in state -/// "error during read". -/// -/// - If SharedGroup::commit_and_continue_as_read() or -/// SharedGroup::rollback_and_continue_as_read() throws an unexpected -/// exception, the shared group accessor is left in state "error during -/// write". -/// -/// It has not yet been decided exactly what an "unexpected exception" is, but -/// `std::bad_alloc` is surely one example. On the other hand, an expected -/// exception is one that is mentioned in the function specific documentation, -/// and is used to abort an operation due to a special, but expected condition. -/// -/// States -/// ------ -/// -/// - A newly created shared group accessor is in state "no transaction in -/// progress". -/// -/// - In state "error during read", almost all Realm API functions are -/// illegal on the connected group of accessors. The only valid operations -/// are destruction of the shared group, and SharedGroup::end_read(). If -/// SharedGroup::end_read() is called, the new state becomes "no transaction -/// in progress". -/// -/// - In state "error during write", almost all Realm API functions are -/// illegal on the connected group of accessors. The only valid operations -/// are destruction of the shared group, and SharedGroup::rollback(). If -/// SharedGroup::end_write() is called, the new state becomes "no transaction -/// in progress" -class SharedGroup { -public: - /// \brief Same as calling the corresponding version of open() on a instance - /// constructed in the unattached state. Exception safety note: if the - /// `upgrade_callback` throws, then the file will be closed properly and the - /// upgrade will be aborted. - explicit SharedGroup(const std::string& file, bool no_create = false, - const SharedGroupOptions options = SharedGroupOptions()); - - /// \brief Same as calling the corresponding version of open() on a instance - /// constructed in the unattached state. Exception safety note: if the - /// `upgrade_callback` throws, then the file will be closed properly and - /// the upgrade will be aborted. - explicit SharedGroup(Replication& repl, const SharedGroupOptions options = SharedGroupOptions()); - - struct unattached_tag { - }; - - /// Create a SharedGroup instance in its unattached state. It may - /// then be attached to a database file later by calling - /// open(). You may test whether this instance is currently in its - /// attached state by calling is_attached(). Calling any other - /// function (except the destructor) while in the unattached state - /// has undefined behavior. - SharedGroup(unattached_tag) noexcept; - - ~SharedGroup() noexcept; - - /// Attach this SharedGroup instance to the specified database file. - /// - /// While at least one instance of SharedGroup exists for a specific - /// database file, a "lock" file will be present too. The lock file will be - /// placed in the same directory as the database file, and its name will be - /// derived by appending ".lock" to the name of the database file. - /// - /// When multiple SharedGroup instances refer to the same file, they must - /// specify the same durability level, otherwise an exception will be - /// thrown. - /// - /// \param file Filesystem path to a Realm database file. - /// - /// \param no_create If the database file does not already exist, it will be - /// created (unless this is set to true.) When multiple threads are involved, - /// it is safe to let the first thread, that gets to it, create the file. - /// - /// \param options See SharedGroupOptions for details of each option. - /// Sensible defaults are provided if this parameter is left out. - /// - /// Calling open() on a SharedGroup instance that is already in the attached - /// state has undefined behavior. - /// - /// \throw util::File::AccessError If the file could not be opened. If the - /// reason corresponds to one of the exception types that are derived from - /// util::File::AccessError, the derived exception type is thrown. Note that - /// InvalidDatabase is among these derived exception types. - /// - /// \throw FileFormatUpgradeRequired only if \a SharedGroupOptions::allow_upgrade - /// is `false` and an upgrade is required. - void open(const std::string& file, bool no_create = false, - const SharedGroupOptions options = SharedGroupOptions()); - - /// Open this group in replication mode. The specified Replication instance - /// must remain in existence for as long as the SharedGroup. - void open(Replication&, const SharedGroupOptions options = SharedGroupOptions()); - - /// Close any open database, returning to the unattached state. - void close() noexcept; - - /// A SharedGroup may be created in the unattached state, and then - /// later attached to a file with a call to open(). Calling any - /// function other than open(), is_attached(), and ~SharedGroup() - /// on an unattached instance results in undefined behavior. - bool is_attached() const noexcept; - - /// Reserve disk space now to avoid allocation errors at a later - /// point in time, and to minimize on-disk fragmentation. In some - /// cases, less fragmentation translates into improved - /// performance. - /// - /// When supported by the system, a call to this function will - /// make the database file at least as big as the specified size, - /// and cause space on the target device to be allocated (note - /// that on many systems on-disk allocation is done lazily by - /// default). If the file is already bigger than the specified - /// size, the size will be unchanged, and on-disk allocation will - /// occur only for the initial section that corresponds to the - /// specified size. On systems that do not support preallocation, - /// this function has no effect. To know whether preallocation is - /// supported by Realm on your platform, call - /// util::File::is_prealloc_supported(). - /// - /// It is an error to call this function on an unattached shared - /// group. Doing so will result in undefined behavior. - void reserve(size_t size_in_bytes); - - /// Querying for changes: - /// - /// NOTE: - /// "changed" means that one or more commits has been made to the database - /// since the SharedGroup (on which wait_for_change() is called) last - /// started, committed, promoted or advanced a transaction. If the - /// SharedGroup has not yet begun a transaction, "changed" is undefined. - /// - /// No distinction is made between changes done by another process - /// and changes done by another thread in the same process as the caller. - /// - /// Has db been changed ? - bool has_changed(); - - /// The calling thread goes to sleep until the database is changed, or - /// until wait_for_change_release() is called. After a call to - /// wait_for_change_release() further calls to wait_for_change() will return - /// immediately. To restore the ability to wait for a change, a call to - /// enable_wait_for_change() is required. Return true if the database has - /// changed, false if it might have. - bool wait_for_change(); - - /// release any thread waiting in wait_for_change() on *this* SharedGroup. - void wait_for_change_release(); - - /// re-enable waiting for change - void enable_wait_for_change(); - // Transactions: - - using version_type = _impl::History::version_type; - using VersionID = realm::VersionID; - - /// Thrown by begin_read() if the specified version does not correspond to a - /// bound (or tethered) snapshot. - struct BadVersion; - - /// \defgroup group_shared_transactions - //@{ - - /// begin_read() initiates a new read transaction. A read transaction is - /// bound to, and provides access to a particular snapshot of the underlying - /// Realm (in general the latest snapshot, but see \a version). It cannot be - /// used to modify the Realm, and in that sense, a read transaction is not a - /// real transaction. - /// - /// begin_write() initiates a new write transaction. A write transaction - /// allows the application to both read and modify the underlying Realm - /// file. At most one write transaction can be in progress at any given time - /// for a particular underlying Realm file. If another write transaction is - /// already in progress, begin_write() will block the caller until the other - /// write transaction terminates. No guarantees are made about the order in - /// which multiple concurrent requests will be served. - /// - /// It is an error to call begin_read() or begin_write() on a SharedGroup - /// object with an active read or write transaction. - /// - /// If begin_read() or begin_write() throws, no transaction is initiated, - /// and the application may try to initiate a new read or write transaction - /// later. - /// - /// end_read() terminates the active read transaction. If no read - /// transaction is active, end_read() does nothing. It is an error to call - /// this function on a SharedGroup object with an active write - /// transaction. end_read() does not throw. - /// - /// commit() commits all changes performed in the context of the active - /// write transaction, and thereby terminates that transaction. This - /// produces a new snapshot in the underlying Realm. commit() returns the - /// version associated with the new snapshot. It is an error to call - /// commit() when there is no active write transaction. If commit() throws, - /// no changes will have been committed, and the transaction will still be - /// active, but in a bad state. In that case, the application must either - /// call rollback() to terminate the bad transaction (in which case a new - /// transaction can be initiated), call close() which also terminates the - /// bad transaction, or destroy the SharedGroup object entirely. When the - /// transaction is in a bad state, the application is not allowed to call - /// any method on the Group accessor or on any of its subordinate accessors - /// (Table, Row, Descriptor). Note that the transaction is also left in a - /// bad state when a modifying operation on any subordinate accessor throws. - /// - /// rollback() terminates the active write transaction and discards any - /// changes performed in the context of it. If no write transaction is - /// active, rollback() does nothing. It is an error to call this function in - /// a SharedGroup object with an active read transaction. rollback() does - /// not throw. - /// - /// the Group accessor and all subordinate accessors (Table, Row, - /// Descriptor) that are obtained in the context of a particular read or - /// write transaction will become detached upon termination of that - /// transaction, which means that they can no longer be used to access the - /// underlying objects. - /// - /// Subordinate accessors that were detached at the end of the previous - /// read or write transaction will not be automatically reattached when a - /// new transaction is initiated. The application must reobtain new - /// accessors during a new transaction to regain access to the underlying - /// objects. - /// - /// \param version If specified, this must be the version associated with a - /// *bound* snapshot. A snapshot is said to be bound (or tethered) if there - /// is at least one active read or write transaction bound to it. A read - /// transaction is bound to the snapshot that it provides access to. A write - /// transaction is bound to the latest snapshot available at the time of - /// initiation of the write transaction. If the specified version is not - /// associated with a bound snapshot, this function throws BadVersion. - /// - /// \throw BadVersion Thrown by begin_read() if the specified version does - /// not correspond to a bound (or tethered) snapshot. - - const Group& begin_read(VersionID version = VersionID()); - void end_read() noexcept; - Group& begin_write(); - version_type commit(); - void rollback() noexcept; - // report statistics of last commit done on THIS shared group. - // The free space reported is what can be expected to be freed - // by compact(). This may not correspond to the space which is free - // at the point where get_stats() is called, since that will include - // memory required to hold older versions of data, which still - // needs to be available. - void get_stats(size_t& free_space, size_t& used_space); - //@} - - enum TransactStage { - transact_Ready, - transact_Reading, - transact_Writing, - }; - - /// Get the current transaction type - TransactStage get_transact_stage() const noexcept; - - /// Get a version id which may be used to request a different SharedGroup - /// to start transaction at a specific version. - VersionID get_version_of_current_transaction(); - - /// Report the number of distinct versions currently stored in the database. - /// Note: the database only cleans up versions as part of commit, so ending - /// a read transaction will not immediately release any versions. - uint_fast64_t get_number_of_versions(); - - /// Compact the database file. - /// - The method will throw if called inside a transaction. - /// - The method will throw if called in unattached state. - /// - The method will return false if other SharedGroups are accessing the - /// database in which case compaction is not done. This is not - /// necessarily an error. - /// It will return true following successful compaction. - /// While compaction is in progress, attempts by other - /// threads or processes to open the database will wait. - /// Be warned that resource requirements for compaction is proportional to - /// the amount of live data in the database. - /// Compaction works by writing the database contents to a temporary - /// database file and then replacing the database with the temporary one. - /// The name of the temporary file is formed by appending - /// ".tmp_compaction_space" to the name of the database - /// - /// FIXME: This function is not yet implemented in an exception-safe manner, - /// therefore, if it throws, the application should not attempt to - /// continue. If may not even be safe to destroy the SharedGroup object. - /// - /// WARNING / FIXME: compact() should NOT be exposed publicly on Windows - /// because it's not crash safe! It may corrupt your database if something fails - bool compact(); - -#ifdef REALM_DEBUG - void test_ringbuf(); -#endif - - /// To handover a table view, query, linkview or row accessor of type T, you - /// must wrap it into a Handover for the transfer. Wrapping and - /// unwrapping of a handover object is done by the methods - /// 'export_for_handover()' and 'import_from_handover()' declared below. - /// 'export_for_handover()' returns a Handover object, and - /// 'import_for_handover()' consumes that object, producing a new accessor - /// which is ready for use in the context of the importing SharedGroup. - /// - /// The Handover always creates a new accessor object at the importing side. - /// For TableViews, there are 3 forms of handover. - /// - /// - with payload move: the payload is handed over and ends up as a payload - /// held by the accessor at the importing side. The accessor on the - /// exporting side will rerun its query and generate a new payload, if - /// TableView::sync_if_needed() is called. If the original payload was in - /// sync at the exporting side, it will also be in sync at the importing - /// side. This is indicated to handover_export() by the argument - /// MutableSourcePayload::Move - /// - /// - with payload copy: a copy of the payload is handed over, so both the - /// accessors on the exporting side *and* the accessors created at the - /// importing side has their own payload. This is indicated to - /// handover_export() by the argument ConstSourcePayload::Copy - /// - /// - without payload: the payload stays with the accessor on the exporting - /// side. On the importing side, the new accessor is created without - /// payload. A call to TableView::sync_if_needed() will trigger generation - /// of a new payload. This form of handover is indicated to - /// handover_export() by the argument ConstSourcePayload::Stay. - /// - /// For all other (non-TableView) accessors, handover is done with payload - /// copy, since the payload is trivial. - /// - /// Handover *without* payload is useful when you want to ship a tableview - /// with its query for execution in a background thread. Handover with - /// *payload move* is useful when you want to transfer the result back. - /// - /// Handover *without* payload or with payload copy is guaranteed *not* to - /// change the accessors on the exporting side. - /// - /// Handover is *not* thread safe and should be carried out - /// by the thread that "owns" the involved accessors. - /// - /// Handover is transitive: - /// If the object being handed over depends on other views - /// (table- or link- ), those objects will be handed over as well. The mode - /// of handover (payload copy, payload move, without payload) is applied - /// recursively. Note: If you are handing over a tableview dependent upon - /// another tableview and using MutableSourcePayload::Move, - /// you are on thin ice! - /// - /// On the importing side, the top-level accessor being created during - /// import takes ownership of all other accessors (if any) being created as - /// part of the import. - - /// Type used to support handover of accessors between shared groups. - template - struct Handover; - - /// thread-safe/const export (mode is Stay or Copy) - /// during export, the following operations on the shared group is locked: - /// - advance_read(), promote_to_write(), commit_and_continue_as_read(), - /// rollback_and_continue_as_read(), close() - template - std::unique_ptr> export_for_handover(const T& accessor, ConstSourcePayload mode); - - // specialization for handover of Rows - template - std::unique_ptr>> export_for_handover(const BasicRow& accessor); - - // destructive export (mode is Move) - template - std::unique_ptr> export_for_handover(T& accessor, MutableSourcePayload mode); - - /// Import an accessor wrapped in a handover object. The import will fail - /// if the importing SharedGroup is viewing a version of the database that - /// is different from the exporting SharedGroup. The call to - /// import_from_handover is not thread-safe. - template - std::unique_ptr import_from_handover(std::unique_ptr> handover); - - // We need two cases for handling of LinkViews, because they are ref counted. - std::unique_ptr> export_linkview_for_handover(const LinkViewRef& accessor); - LinkViewRef import_linkview_from_handover(std::unique_ptr> handover); - - // likewise for Tables. - std::unique_ptr> export_table_for_handover(const TableRef& accessor); - TableRef import_table_from_handover(std::unique_ptr> handover); - - /// When doing handover to background tasks that may be run later, we - /// may want to momentarily pin the current version until the other thread - /// has retrieved it. - /// - /// Pinning can be done in both read- and write-transactions, but with different - /// semantics. When pinning during a read-transaction, the version pinned is the - /// one accessible during the read-transaction. When pinning during a write-transaction, - /// the version pinned will be the last version that was succesfully committed to the - /// realm file at the point in time, when the write-transaction was started. - /// - /// The release is not thread-safe, so it has to be done on the SharedGroup - /// associated with the thread calling unpin_version(), and the SharedGroup - /// must be attached to the realm file at the point of unpinning. - - // Pin version for handover (not thread safe) - VersionID pin_version(); - - // Release pinned version (not thread safe) - void unpin_version(VersionID version); - -private: - struct SharedInfo; - struct ReadCount; - struct ReadLockInfo { - uint_fast64_t m_version = std::numeric_limits::max(); - uint_fast32_t m_reader_idx = 0; - ref_type m_top_ref = 0; - size_t m_file_size = 0; - }; - class ReadLockUnlockGuard; - - // Member variables - size_t m_free_space = 0; - size_t m_used_space = 0; - Group m_group; - ReadLockInfo m_read_lock; - uint_fast32_t m_local_max_entry; - util::File m_file; - util::File::Map m_file_map; // Never remapped - util::File::Map m_reader_map; - bool m_wait_for_change_enabled; - std::string m_lockfile_path; - std::string m_lockfile_prefix; - std::string m_db_path; - std::string m_coordination_dir; - const char* m_key; - TransactStage m_transact_stage; - util::InterprocessMutex m_writemutex; -#ifdef REALM_ASYNC_DAEMON - util::InterprocessMutex m_balancemutex; -#endif - util::InterprocessMutex m_controlmutex; -#ifndef _WIN32 -#ifdef REALM_ASYNC_DAEMON - util::InterprocessCondVar m_room_to_write; - util::InterprocessCondVar m_work_to_do; - util::InterprocessCondVar m_daemon_becomes_ready; -#endif - util::InterprocessCondVar m_new_commit_available; -#endif - std::function m_upgrade_callback; - - void do_open(const std::string& file, bool no_create, bool is_backend, const SharedGroupOptions options); - - // Ring buffer management - bool ringbuf_is_empty() const noexcept; - size_t ringbuf_size() const noexcept; - size_t ringbuf_capacity() const noexcept; - bool ringbuf_is_first(size_t ndx) const noexcept; - void ringbuf_remove_first() noexcept; - size_t ringbuf_find(uint64_t version) const noexcept; - ReadCount& ringbuf_get(size_t ndx) noexcept; - ReadCount& ringbuf_get_first() noexcept; - ReadCount& ringbuf_get_last() noexcept; - void ringbuf_put(const ReadCount& v); - void ringbuf_expand(); - - /// Grab a read lock on the snapshot associated with the specified - /// version. If `version_id == VersionID()`, a read lock will be grabbed on - /// the latest available snapshot. Fails if the snapshot is no longer - /// available. - /// - /// As a side effect update memory mapping to ensure that the ringbuffer - /// entries referenced in the readlock info is accessible. - /// - /// FIXME: It needs to be made more clear exactly under which conditions - /// this function fails. Also, why is it useful to promise anything about - /// detection of bad versions? Can we really promise enough to make such a - /// promise useful to the caller? - void grab_read_lock(ReadLockInfo&, VersionID); - - // Release a specific read lock. The read lock MUST have been obtained by a - // call to grab_read_lock(). - void release_read_lock(ReadLockInfo&) noexcept; - - void do_begin_read(VersionID, bool writable); - void do_end_read() noexcept; - void do_begin_write(); - version_type do_commit(); - void do_end_write() noexcept; - - /// Returns the version of the latest snapshot. - version_type get_version_of_latest_snapshot(); - - /// Returns the version of the snapshot bound in the current read or write - /// transaction. It is an error to call this function when no transaction is - /// in progress. - version_type get_version_of_bound_snapshot() const noexcept; - - // make sure the given index is within the currently mapped area. - // if not, expand the mapped area. Returns true if the area is expanded. - bool grow_reader_mapping(uint_fast32_t index); - - // Must be called only by someone that has a lock on the write - // mutex. - void low_level_commit(uint_fast64_t new_version); - - void do_async_commits(); - - void upgrade_file_format(bool allow_file_format_upgrade, int target_file_format_version); - - //@{ - /// See LangBindHelper. - template - void advance_read(O* observer, VersionID); - template - void promote_to_write(O* observer); - version_type commit_and_continue_as_read(); - template - void rollback_and_continue_as_read(O* observer); - //@} - - /// Returns true if, and only if _impl::History::update_early_from_top_ref() - /// was called during the execution of this function. - template - bool do_advance_read(O* observer, VersionID, _impl::History&); - - /// If there is an associated \ref Replication object, then this function - /// returns `repl->get_history()` where `repl` is that Replication object, - /// otherwise this function returns null. - _impl::History* get_history(); - - int get_file_format_version() const noexcept; - - friend class _impl::SharedGroupFriend; -}; - - -inline void SharedGroup::get_stats(size_t& free_space, size_t& used_space) { - free_space = m_free_space; - used_space = m_used_space; -} - - -class ReadTransaction { -public: - ReadTransaction(SharedGroup& sg) - : m_shared_group(sg) - { - m_shared_group.begin_read(); // Throws - } - - ~ReadTransaction() noexcept - { - m_shared_group.end_read(); - } - - bool has_table(StringData name) const noexcept - { - return get_group().has_table(name); - } - - ConstTableRef get_table(size_t table_ndx) const - { - return get_group().get_table(table_ndx); // Throws - } - - ConstTableRef get_table(StringData name) const - { - return get_group().get_table(name); // Throws - } - - template - BasicTableRef get_table(StringData name) const - { - return get_group().get_table(name); // Throws - } - - const Group& get_group() const noexcept; - - /// Get the version of the snapshot to which this read transaction is bound. - SharedGroup::version_type get_version() const noexcept; - -private: - SharedGroup& m_shared_group; -}; - - -class WriteTransaction { -public: - WriteTransaction(SharedGroup& sg) - : m_shared_group(&sg) - { - m_shared_group->begin_write(); // Throws - } - - ~WriteTransaction() noexcept - { - if (m_shared_group) - m_shared_group->rollback(); - } - - bool has_table(StringData name) const noexcept - { - return get_group().has_table(name); - } - - TableRef get_table(size_t table_ndx) const - { - return get_group().get_table(table_ndx); // Throws - } - - TableRef get_table(StringData name) const - { - return get_group().get_table(name); // Throws - } - - TableRef add_table(StringData name, bool require_unique_name = true) const - { - return get_group().add_table(name, require_unique_name); // Throws - } - - TableRef get_or_add_table(StringData name, bool* was_added = nullptr) const - { - return get_group().get_or_add_table(name, was_added); // Throws - } - - template - BasicTableRef get_table(StringData name) const - { - return get_group().get_table(name); // Throws - } - - template - BasicTableRef add_table(StringData name, bool require_unique_name = true) const - { - return get_group().add_table(name, require_unique_name); // Throws - } - - template - BasicTableRef get_or_add_table(StringData name, bool* was_added = nullptr) const - { - return get_group().get_or_add_table(name, was_added); // Throws - } - - Group& get_group() const noexcept; - - /// Get the version of the snapshot on which this write transaction is - /// based. - SharedGroup::version_type get_version() const noexcept; - - SharedGroup::version_type commit() - { - REALM_ASSERT(m_shared_group); - SharedGroup::version_type new_version = m_shared_group->commit(); - m_shared_group = nullptr; - return new_version; - } - - void rollback() noexcept - { - REALM_ASSERT(m_shared_group); - m_shared_group->rollback(); - m_shared_group = nullptr; - } - -private: - SharedGroup* m_shared_group; -}; - - -// Implementation: - -struct SharedGroup::BadVersion : std::exception { -}; - -inline SharedGroup::SharedGroup(const std::string& file, bool no_create, const SharedGroupOptions options) - : m_group(Group::shared_tag()) - , m_upgrade_callback(std::move(options.upgrade_callback)) -{ - open(file, no_create, options); // Throws -} - -inline SharedGroup::SharedGroup(unattached_tag) noexcept - : m_group(Group::shared_tag()) -{ -} - -inline SharedGroup::SharedGroup(Replication& repl, const SharedGroupOptions options) - : m_group(Group::shared_tag()) - , m_upgrade_callback(std::move(options.upgrade_callback)) -{ - open(repl, options); // Throws -} - -inline void SharedGroup::open(const std::string& path, bool no_create_file, const SharedGroupOptions options) -{ - // Exception safety: Since open() is called from constructors, if it throws, - // it must leave the file closed. - - bool is_backend = false; - do_open(path, no_create_file, is_backend, options); // Throws -} - -inline void SharedGroup::open(Replication& repl, const SharedGroupOptions options) -{ - // Exception safety: Since open() is called from constructors, if it throws, - // it must leave the file closed. - - REALM_ASSERT(!is_attached()); - - repl.initialize(*this); // Throws - - typedef _impl::GroupFriend gf; - gf::set_replication(m_group, &repl); - - std::string file = repl.get_database_path(); - bool no_create = false; - bool is_backend = false; - do_open(file, no_create, is_backend, options); // Throws -} - -inline bool SharedGroup::is_attached() const noexcept -{ - return m_file_map.is_attached(); -} - -inline SharedGroup::TransactStage SharedGroup::get_transact_stage() const noexcept -{ - return m_transact_stage; -} - -inline SharedGroup::version_type SharedGroup::get_version_of_bound_snapshot() const noexcept -{ - return m_read_lock.m_version; -} - -class SharedGroup::ReadLockUnlockGuard { -public: - ReadLockUnlockGuard(SharedGroup& shared_group, ReadLockInfo& read_lock) noexcept - : m_shared_group(shared_group) - , m_read_lock(&read_lock) - { - } - ~ReadLockUnlockGuard() noexcept - { - if (m_read_lock) - m_shared_group.release_read_lock(*m_read_lock); - } - void release() noexcept - { - m_read_lock = 0; - } - -private: - SharedGroup& m_shared_group; - ReadLockInfo* m_read_lock; -}; - - -template -struct SharedGroup::Handover { - std::unique_ptr patch; - std::unique_ptr clone; - VersionID version; -}; - -template -std::unique_ptr> SharedGroup::export_for_handover(const T& accessor, ConstSourcePayload mode) -{ - if (m_transact_stage != transact_Reading) - throw LogicError(LogicError::wrong_transact_state); - std::unique_ptr> result(new Handover()); - // Implementation note: - // often, the return value from clone will be T*, BUT it may be ptr to some - // base of T instead, so we must cast it to T*. This is always safe, because - // no matter the type, clone() will clone the actual accessor instance, and - // hence return an instance of the same type. - result->clone.reset(dynamic_cast(accessor.clone_for_handover(result->patch, mode).release())); - result->version = get_version_of_current_transaction(); - return move(result); -} - - -template -std::unique_ptr>> SharedGroup::export_for_handover(const BasicRow& accessor) -{ - if (m_transact_stage != transact_Reading) - throw LogicError(LogicError::wrong_transact_state); - std::unique_ptr>> result(new Handover>()); - // See implementation note above. - result->clone.reset(dynamic_cast*>(accessor.clone_for_handover(result->patch).release())); - result->version = get_version_of_current_transaction(); - return move(result); -} - - -template -std::unique_ptr> SharedGroup::export_for_handover(T& accessor, MutableSourcePayload mode) -{ - if (m_transact_stage != transact_Reading) - throw LogicError(LogicError::wrong_transact_state); - std::unique_ptr> result(new Handover()); - // see implementation note above. - result->clone.reset(dynamic_cast(accessor.clone_for_handover(result->patch, mode).release())); - result->version = get_version_of_current_transaction(); - return move(result); -} - - -template -std::unique_ptr SharedGroup::import_from_handover(std::unique_ptr> handover) -{ - if (handover->version != get_version_of_current_transaction()) { - throw BadVersion(); - } - std::unique_ptr result = move(handover->clone); - result->apply_and_consume_patch(handover->patch, m_group); - return result; -} - -template -inline void SharedGroup::advance_read(O* observer, VersionID version_id) -{ - if (m_transact_stage != transact_Reading) - throw LogicError(LogicError::wrong_transact_state); - - // It is an error if the new version precedes the currently bound one. - if (version_id.version < m_read_lock.m_version) - throw LogicError(LogicError::bad_version); - - _impl::History* hist = get_history(); // Throws - if (!hist) - throw LogicError(LogicError::no_history); - - do_advance_read(observer, version_id, *hist); // Throws -} - -template -inline void SharedGroup::promote_to_write(O* observer) -{ - if (m_transact_stage != transact_Reading) - throw LogicError(LogicError::wrong_transact_state); - - _impl::History* hist = get_history(); // Throws - if (!hist) - throw LogicError(LogicError::no_history); - - do_begin_write(); // Throws - try { - VersionID version = VersionID(); // Latest - bool history_updated = do_advance_read(observer, version, *hist); // Throws - - Replication* repl = m_group.get_replication(); - REALM_ASSERT(repl); // Presence of `repl` follows from the presence of `hist` - version_type current_version = m_read_lock.m_version; - repl->initiate_transact(current_version, history_updated); // Throws - - // If the group has no top array (top_ref == 0), create a new node - // structure for an empty group now, to be ready for modifications. See - // also Group::attach_shared(). - using gf = _impl::GroupFriend; - gf::create_empty_group_when_missing(m_group); // Throws - } - catch (...) { - do_end_write(); - throw; - } - - m_transact_stage = transact_Writing; -} - -template -inline void SharedGroup::rollback_and_continue_as_read(O* observer) -{ - if (m_transact_stage != transact_Writing) - throw LogicError(LogicError::wrong_transact_state); - - _impl::History* hist = get_history(); // Throws - if (!hist) - throw LogicError(LogicError::no_history); - - // Mark all managed space (beyond the attached file) as free. - using gf = _impl::GroupFriend; - gf::reset_free_space_tracking(m_group); // Throws - - BinaryData uncommitted_changes = hist->get_uncommitted_changes(); - - // FIXME: We are currently creating two transaction log parsers, one here, - // and one in advance_transact(). That is wasteful as the parser creation is - // expensive. - _impl::SimpleInputStream in(uncommitted_changes.data(), uncommitted_changes.size()); - _impl::TransactLogParser parser; // Throws - _impl::TransactReverser reverser; - parser.parse(in, reverser); // Throws - - if (observer && uncommitted_changes.size()) { - _impl::ReversedNoCopyInputStream reversed_in(reverser); - parser.parse(reversed_in, *observer); // Throws - observer->parse_complete(); // Throws - } - - ref_type top_ref = m_read_lock.m_top_ref; - size_t file_size = m_read_lock.m_file_size; - _impl::ReversedNoCopyInputStream reversed_in(reverser); - gf::advance_transact(m_group, top_ref, file_size, reversed_in); // Throws - - do_end_write(); - - Replication* repl = gf::get_replication(m_group); - REALM_ASSERT(repl); // Presence of `repl` follows from the presence of `hist` - repl->abort_transact(); - - m_transact_stage = transact_Reading; -} - -template -inline bool SharedGroup::do_advance_read(O* observer, VersionID version_id, _impl::History& hist) -{ - ReadLockInfo new_read_lock; - grab_read_lock(new_read_lock, version_id); // Throws - REALM_ASSERT(new_read_lock.m_version >= m_read_lock.m_version); - if (new_read_lock.m_version == m_read_lock.m_version) { - release_read_lock(new_read_lock); - // _impl::History::update_early_from_top_ref() was not called - return false; - } - - ReadLockUnlockGuard g(*this, new_read_lock); - { - version_type new_version = new_read_lock.m_version; - size_t new_file_size = new_read_lock.m_file_size; - ref_type new_top_ref = new_read_lock.m_top_ref; - hist.update_early_from_top_ref(new_version, new_file_size, new_top_ref); // Throws - } - - if (observer) { - // This has to happen in the context of the originally bound snapshot - // and while the read transaction is still in a fully functional state. - _impl::TransactLogParser parser; - version_type old_version = m_read_lock.m_version; - version_type new_version = new_read_lock.m_version; - _impl::ChangesetInputStream in(hist, old_version, new_version); - parser.parse(in, *observer); // Throws - observer->parse_complete(); // Throws - } - - // The old read lock must be retained for as long as the change history is - // accessed (until Group::advance_transact() returns). This ensures that the - // oldest needed changeset remains in the history, even when the history is - // implemented as a separate unversioned entity outside the Realm (i.e., the - // old implementation and ShortCircuitHistory in - // test_lang_Bind_helper.cpp). On the other hand, if it had been the case, - // that the history was always implemented as a versioned entity, that was - // part of the Realm state, then it would not have been necessary to retain - // the old read lock beyond this point. - - { - version_type old_version = m_read_lock.m_version; - version_type new_version = new_read_lock.m_version; - ref_type new_top_ref = new_read_lock.m_top_ref; - size_t new_file_size = new_read_lock.m_file_size; - _impl::ChangesetInputStream in(hist, old_version, new_version); - m_group.advance_transact(new_top_ref, new_file_size, in); // Throws - } - - g.release(); - release_read_lock(m_read_lock); - m_read_lock = new_read_lock; - - return true; // _impl::History::update_early_from_top_ref() was called -} - -inline _impl::History* SharedGroup::get_history() -{ - using gf = _impl::GroupFriend; - if (Replication* repl = gf::get_replication(m_group)) - return repl->get_history(); - return 0; -} - -inline int SharedGroup::get_file_format_version() const noexcept -{ - using gf = _impl::GroupFriend; - return gf::get_file_format_version(m_group); -} - - -// The purpose of this class is to give internal access to some, but -// not all of the non-public parts of the SharedGroup class. -class _impl::SharedGroupFriend { -public: - static Group& get_group(SharedGroup& sg) noexcept - { - return sg.m_group; - } - - template - static void advance_read(SharedGroup& sg, O* obs, SharedGroup::VersionID ver) - { - sg.advance_read(obs, ver); // Throws - } - - template - static void promote_to_write(SharedGroup& sg, O* obs) - { - sg.promote_to_write(obs); // Throws - } - - static SharedGroup::version_type commit_and_continue_as_read(SharedGroup& sg) - { - return sg.commit_and_continue_as_read(); // Throws - } - - template - static void rollback_and_continue_as_read(SharedGroup& sg, O* obs) - { - sg.rollback_and_continue_as_read(obs); // Throws - } - - static void async_daemon_open(SharedGroup& sg, const std::string& file) - { - bool no_create = true; - bool is_backend = true; - SharedGroupOptions options; - options.durability = SharedGroupOptions::Durability::Async; - options.encryption_key = nullptr; - options.allow_file_format_upgrade = false; - sg.do_open(file, no_create, is_backend, options); // Throws - } - - static int get_file_format_version(const SharedGroup& sg) noexcept - { - return sg.get_file_format_version(); - } - - static SharedGroup::version_type get_version_of_latest_snapshot(SharedGroup& sg) - { - return sg.get_version_of_latest_snapshot(); - } - - static SharedGroup::version_type get_version_of_bound_snapshot(const SharedGroup& sg) noexcept - { - return sg.get_version_of_bound_snapshot(); - } -}; - -inline const Group& ReadTransaction::get_group() const noexcept -{ - using sgf = _impl::SharedGroupFriend; - return sgf::get_group(m_shared_group); -} - -inline SharedGroup::version_type ReadTransaction::get_version() const noexcept -{ - using sgf = _impl::SharedGroupFriend; - return sgf::get_version_of_bound_snapshot(m_shared_group); -} - -inline Group& WriteTransaction::get_group() const noexcept -{ - REALM_ASSERT(m_shared_group); - using sgf = _impl::SharedGroupFriend; - return sgf::get_group(*m_shared_group); -} - -inline SharedGroup::version_type WriteTransaction::get_version() const noexcept -{ - using sgf = _impl::SharedGroupFriend; - return sgf::get_version_of_bound_snapshot(*m_shared_group); -} - -} // namespace realm - -#endif // REALM_GROUP_SHARED_HPP diff --git a/Pods/Realm/include/core/realm/group_shared_options.hpp b/Pods/Realm/include/core/realm/group_shared_options.hpp deleted file mode 100644 index 8430c445..00000000 --- a/Pods/Realm/include/core/realm/group_shared_options.hpp +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_GROUP_SHARED_OPTIONS_HPP -#define REALM_GROUP_SHARED_OPTIONS_HPP - -#include -#include - -namespace realm { - -struct SharedGroupOptions { - - /// The persistence level of the SharedGroup. - /// uint16_t is the type of SharedGroup::SharedInfo::durability - enum class Durability : uint16_t { - Full, - MemOnly, - Async ///< Not yet supported on windows. - }; - - explicit SharedGroupOptions(Durability level = Durability::Full, const char* key = nullptr, - bool allow_upgrade = true, - std::function file_upgrade_callback = std::function(), - std::string temp_directory = sys_tmp_dir) - : durability(level) - , encryption_key(key) - , allow_file_format_upgrade(allow_upgrade) - , upgrade_callback(file_upgrade_callback) - , temp_dir(temp_directory) - { - } - - explicit SharedGroupOptions(const char* key) - : durability(Durability::Full) - , encryption_key(key) - , allow_file_format_upgrade(true) - , upgrade_callback(std::function()) - , temp_dir(sys_tmp_dir) - { - } - - /// The persistence level of the Realm file. See Durability. - Durability durability; - - /// The key to encrypt and decrypt the Realm file with, or nullptr to - /// indicate that encryption should not be used. - const char* encryption_key; - - /// If \a allow_file_format_upgrade is set to `true`, this function will - /// automatically upgrade the file format used in the specified Realm file - /// if necessary (and if it is possible). In order to prevent this, set \a - /// allow_upgrade to `false`. - /// - /// If \a allow_upgrade is set to `false`, only two outcomes are possible: - /// - /// - the specified Realm file is already using the latest file format, and - /// can be used, or - /// - /// - the specified Realm file uses a deprecated file format, resulting a - /// the throwing of FileFormatUpgradeRequired. - bool allow_file_format_upgrade; - - /// Optionally allows a custom function to be called immediately after the - /// Realm file is upgraded. The two parameters in the function are the - /// previous version and the version just upgraded to, respectively. - /// If the callback function throws, the Realm file will safely abort the - /// upgrade (rollback the transaction) but the SharedGroup will not be opened. - std::function upgrade_callback; - - /// A path to a directory where Realm can write temporary files or pipes to. - /// This string should include a trailing slash '/'. - std::string temp_dir; - -private: - const static std::string sys_tmp_dir; -}; - -} // end namespace realm - -#endif // REALM_GROUP_SHARED_OPTIONS_HPP diff --git a/Pods/Realm/include/core/realm/group_writer.hpp b/Pods/Realm/include/core/realm/group_writer.hpp deleted file mode 100644 index d2fbcbf0..00000000 --- a/Pods/Realm/include/core/realm/group_writer.hpp +++ /dev/null @@ -1,165 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_GROUP_WRITER_HPP -#define REALM_GROUP_WRITER_HPP - -#include // unint8_t etc -#include - -#include -#include -#include -#include - - -namespace realm { - -// Pre-declarations -class Group; -class SlabAlloc; - - -/// This class is not supposed to be reused for multiple write sessions. In -/// particular, do not reuse it in case any of the functions throw. -/// -/// FIXME: Move this class to namespace realm::_impl and to subdir src/realm/impl. -class GroupWriter : public _impl::ArrayWriterBase { -public: - // For groups in transactional mode (Group::m_is_shared), this constructor - // must be called while a write transaction is in progress. - // - // The constructor adds free-space tracking information to the specified - // group, if it is not already present (4th and 5th entry in - // Group::m_top). If the specified group is in transactional mode - // (Group::m_is_shared), the constructor also adds version tracking - // information to the group, if it is not already present (6th and 7th entry - // in Group::m_top). - GroupWriter(Group&); - ~GroupWriter(); - - void set_versions(uint64_t current, uint64_t read_lock) noexcept; - - /// Write all changed array nodes into free space. - /// - /// Returns the new top ref. When in full durability mode, call - /// commit() with the returned top ref. - ref_type write_group(); - - /// Flush changes to physical medium, then write the new top ref - /// to the file header, then flush again. Pass the top ref - /// returned by write_group(). - void commit(ref_type new_top_ref); - - size_t get_file_size() const noexcept; - - /// Write the specified chunk into free space. - void write(const char* data, size_t size); - - ref_type write_array(const char*, size_t, uint32_t) override; - -#ifdef REALM_DEBUG - void dump(); -#endif - - size_t get_free_space(); -private: - class MapWindow; - Group& m_group; - SlabAlloc& m_alloc; - ArrayInteger m_free_positions; // 4th slot in Group::m_top - ArrayInteger m_free_lengths; // 5th slot in Group::m_top - ArrayInteger m_free_versions; // 6th slot in Group::m_top - uint64_t m_current_version; - uint64_t m_readlock_version; - - // Currently cached memory mappings. We keep as many as 16 1MB windows - // open for writing. The allocator will favor sequential allocation - // from a modest number of windows, depending upon fragmentation, so - // 16 windows should be more than enough. If more than 16 windows are - // needed, the least recently used is sync'ed and closed to make room - // for a new one. The windows are kept in MRU (most recently used) order. - const static int num_map_windows = 16; - std::vector m_map_windows; - - // Get a suitable memory mapping for later access: - // potentially adding it to the cache, potentially closing - // the least recently used and sync'ing it to disk - MapWindow* get_window(ref_type start_ref, size_t size); - - // Sync all cached memory mappings - void sync_all_mappings(); - - // Merge adjacent chunks - void merge_free_space(); - - /// Allocate a chunk of free space of the specified size. The - /// specified size must be 8-byte aligned. Extend the file if - /// required. The returned chunk is removed from the amount of - /// remaing free space. The returned chunk is guaranteed to be - /// within a single contiguous memory mapping. - /// - /// \return The position within the database file of the allocated - /// chunk. - size_t get_free_space(size_t size); - - /// Find a block of free space that is at least as big as the - /// specified size and which will allow an allocation that is mapped - /// inside a contiguous address range. The specified size does not - /// need to be 8-byte aligned. Extend the file if required. - /// The returned chunk is not removed from the amount of remaing - /// free space. - /// - /// \return A pair (`chunk_ndx`, `chunk_size`) where `chunk_ndx` - /// is the index of a chunk whose size is at least the requestd - /// size, and `chunk_size` is the size of that chunk. - std::pair reserve_free_space(size_t size); - - /// Search only a range of the free list for a block as big as the - /// specified size. Return a pair with index and size of the found chunk. - /// \param found indicates whether a suitable block was found. - std::pair search_free_space_in_part_of_freelist(size_t size, size_t begin, size_t end, - bool& found); - - /// Extend the file to ensure that a chunk of free space of the - /// specified size is available. The specified size does not need - /// to be 8-byte aligned. This function guarantees that it will - /// add at most one entry to the free-lists. - /// - /// \return A pair (`chunk_ndx`, `chunk_size`) where `chunk_ndx` - /// is the index of a chunk whose size is at least the requestd - /// size, and `chunk_size` is the size of that chunk. - std::pair extend_free_space(size_t requested_size); - - void write_array_at(MapWindow* window, ref_type, const char* data, size_t size); - size_t split_freelist_chunk(size_t index, size_t start_pos, size_t alloc_pos, size_t chunk_size, bool is_shared); -}; - - -// Implementation: - -inline void GroupWriter::set_versions(uint64_t current, uint64_t read_lock) noexcept -{ - REALM_ASSERT(read_lock <= current); - m_current_version = current; - m_readlock_version = read_lock; -} - -} // namespace realm - -#endif // REALM_GROUP_WRITER_HPP diff --git a/Pods/Realm/include/core/realm/handover_defs.hpp b/Pods/Realm/include/core/realm/handover_defs.hpp deleted file mode 100644 index 6950bd55..00000000 --- a/Pods/Realm/include/core/realm/handover_defs.hpp +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_HANDOVER_DEFS -#define REALM_HANDOVER_DEFS - -#include -#include - -namespace realm { - -enum class ConstSourcePayload { Copy, Stay }; -enum class MutableSourcePayload { Move }; - -struct RowBaseHandoverPatch; -struct TableViewHandoverPatch; - -struct TableHandoverPatch { - size_t m_table_num; -}; - -struct LinkViewHandoverPatch { - std::unique_ptr m_table; - size_t m_col_num; - size_t m_row_ndx; -}; - -// Base class for handover patches for query nodes. Subclasses are declared in query_engine.hpp. -struct QueryNodeHandoverPatch { - virtual ~QueryNodeHandoverPatch() = default; -}; - -using QueryNodeHandoverPatches = std::vector>; - -struct QueryHandoverPatch { - std::unique_ptr m_table; - std::unique_ptr table_view_data; - std::unique_ptr link_view_data; - QueryNodeHandoverPatches m_node_data; -}; - -struct SortDescriptorHandoverPatch { - std::vector> columns; - std::vector ascending; -}; - -struct TableViewHandoverPatch { - std::unique_ptr m_table; - std::unique_ptr linked_row; - size_t linked_col; - bool was_in_sync; - QueryHandoverPatch query_patch; - std::unique_ptr linkview_patch; - std::unique_ptr sort_patch; - std::unique_ptr distinct_patch; -}; - - -struct RowBaseHandoverPatch { - std::unique_ptr m_table; - size_t row_ndx; -}; - - -} // end namespace Realm - -#endif diff --git a/Pods/Realm/include/core/realm/history.hpp b/Pods/Realm/include/core/realm/history.hpp deleted file mode 100644 index 9710d0b8..00000000 --- a/Pods/Realm/include/core/realm/history.hpp +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_HISTORY_HPP -#define REALM_HISTORY_HPP - -#include -#include - -#include - - -namespace realm { - -std::unique_ptr make_in_realm_history(const std::string& realm_path); - -} // namespace realm - - -#endif // REALM_HISTORY_HPP diff --git a/Pods/Realm/include/core/realm/impl/array_writer.hpp b/Pods/Realm/include/core/realm/impl/array_writer.hpp deleted file mode 100644 index f039ad50..00000000 --- a/Pods/Realm/include/core/realm/impl/array_writer.hpp +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ARRAY_WRITER_HPP -#define REALM_ARRAY_WRITER_HPP - -#include - -namespace realm { -namespace _impl { - -class ArrayWriterBase { -public: - virtual ~ArrayWriterBase() - { - } - - /// Write the specified array data and its checksum into free - /// space. - /// - /// Returns the ref (position in the target stream) of the written copy of - /// the specified array data. - virtual ref_type write_array(const char* data, size_t size, uint32_t checksum) = 0; -}; - -} // namespace impl_ -} // namespace realm - -#endif // REALM_ARRAY_WRITER_HPP diff --git a/Pods/Realm/include/core/realm/impl/continuous_transactions_history.hpp b/Pods/Realm/include/core/realm/impl/continuous_transactions_history.hpp deleted file mode 100644 index c9e43bb2..00000000 --- a/Pods/Realm/include/core/realm/impl/continuous_transactions_history.hpp +++ /dev/null @@ -1,210 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_IMPL_CONTINUOUS_TRANSACTIONS_HISTORY_HPP -#define REALM_IMPL_CONTINUOUS_TRANSACTIONS_HISTORY_HPP - -#include -#include - -#include -#include - -namespace realm { - -class Group; - -namespace _impl { - -/// Read-only access to history of changesets as needed to enable continuous -/// transactions. -class History { -public: - using version_type = VersionID::version_type; - - /// May be called during a read transaction to gain early access to the - /// history as it appears in a new snapshot that succeeds the one bound in - /// the current read transaction. - /// - /// May also be called at other times as long as the caller owns a read lock - /// (SharedGroup::grab_read_lock()) on the Realm for the specified file size - /// and top ref, and the allocator is in a 'free space clean' state - /// (SlabAlloc::is_free_space_clean()). - /// - /// This function may cause a remapping of the Realm file - /// (SlabAlloc::remap()) if it needs to make the new snapshot fully visible - /// in memory. - /// - /// Note that this method of gaining early access to the history in a new - /// snaphot only gives read access. It does not allow for modifications of - /// the history or any other part of the new snapshot. For modifications to - /// be allowed, `Group::m_top` (the parent of the history) would first have - /// to be updated to reflect the new snapshot, but at that time we are no - /// longer in an 'early access' situation. - /// - /// This is not a problem from the point of view of this history interface, - /// as it only contains methods for reading from the history, but some - /// implementations will want to also provide for ways to modify the - /// history, but in those cases, modifications must occur only after the - /// Group accessor has been fully updated to reflect the new snapshot. - virtual void update_early_from_top_ref(version_type new_version, size_t new_file_size, ref_type new_top_ref) = 0; - - virtual void update_from_parent(version_type current_version) = 0; - - /// Get all changesets between the specified versions. References to those - /// changesets will be made availble in successive entries of `buffer`. The - /// number of retreived changesets is exactly `end_version - - /// begin_version`. If this number is greater than zero, the changeset made - /// avaialable in `buffer[0]` is the one that brought the database from - /// `begin_version` to `begin_version + 1`. - /// - /// It is an error to specify a version (for \a begin_version or \a - /// end_version) that is outside the range [V,W] where V is the version that - /// immediately precedes the first changeset available in the history as the - /// history appears in the **latest** available snapshot, and W is the - /// versionm that immediately succeeds the last changeset available in the - /// history as the history appears in the snapshot bound to the **current** - /// transaction. This restriction is necessary to allow for different kinds - /// of implementations of the history (separate standalone history or - /// history as part of versioned Realm state). - /// - /// The calee retains ownership of the memory referenced by those entries, - /// i.e., the memory referenced by `buffer[i].changeset` is **not** handed - /// over to the caller. - /// - /// This function may be called only during a transaction (prior to - /// initiation of commit operation), and only after a successfull invocation - /// of update_early_from_top_ref(). In that case, the caller may assume that - /// the memory references stay valid for the remainder of the transaction - /// (up until initiation of the commit operation). - virtual void get_changesets(version_type begin_version, version_type end_version, BinaryIterator* buffer) const - noexcept = 0; - - /// \brief Specify the version of the oldest bound snapshot. - /// - /// This function must be called by the associated SharedGroup object during - /// each successfully committed write transaction. It must be called before - /// the transaction is finalized (Replication::finalize_commit()) or aborted - /// (Replication::abort_transact()), but after the initiation of the commit - /// operation (Replication::prepare_commit()). This allows history - /// implementations to add new history entries before triming off old ones, - /// and this, in turn, guarantees that the history never becomes empty, - /// except in the initial empty Realm state. - /// - /// The caller must pass the version (\a version) of the oldest snapshot - /// that is currently (or was recently) bound via a transaction of the - /// current session. This gives the history implementation an opportunity to - /// trim off leading (early) history entries. - /// - /// Since this function must be called during a write transaction, there - /// will always be at least one snapshot that is currently bound via a - /// transaction. - /// - /// The caller must guarantee that the passed version (\a version) is less - /// than or equal to `begin_version` in all future invocations of - /// get_changesets(). - /// - /// The caller is allowed to pass a version that is less than the version - /// passed in a preceeding invocation. - /// - /// This function should be called as late as possible, to maximize the - /// trimming opportunity, but at a time where the write transaction is still - /// open for additional modifications. This is necessary because some types - /// of histories are stored inside the Realm file. - virtual void set_oldest_bound_version(version_type version) = 0; - - /// Get the list of uncommited changes accumulated so far in the current - /// write transaction. - /// - /// The callee retains ownership of the referenced memory. The ownership is - /// not handed over the the caller. - /// - /// This function may be called only during a write transaction (prior to - /// initiation of commit operation). In that case, the caller may assume that the - /// returned memory reference stays valid for the remainder of the transaction (up - /// until initiation of the commit operation). - virtual BinaryData get_uncommitted_changes() noexcept = 0; - - virtual void verify() const = 0; - - virtual ~History() noexcept - { - } -}; - - -/// This class is intended to eventually become a basis for implementing the -/// Replication API for the purpose of supporting continuous transactions. That -/// is, its purpose is to replace the current implementation in commit_log.cpp, -/// which places the history in separate files. -/// -/// By ensuring that the root node of the history is correctly configured with -/// Group::m_top as its parent, this class allows for modifications of the -/// history as long as those modifications happen after the remainder of the -/// Group accessor is updated to reflect the new snapshot (see -/// History::update_early_from_top_ref()). -class InRealmHistory : public History { -public: - void initialize(Group&); - - /// Must never be called more than once per transaction. Returns the version - /// produced by the added changeset. - version_type add_changeset(BinaryData); - - void update_early_from_top_ref(version_type, size_t, ref_type) override; - void update_from_parent(version_type) override; - void get_changesets(version_type, version_type, BinaryIterator*) const noexcept override; - void set_oldest_bound_version(version_type) override; - - void verify() const override; - -private: - Group* m_group = nullptr; - - /// Version on which the first changeset in the history is based, or if the - /// history is empty, the version associatede with currently bound - /// snapshot. In general, the version associatede with currently bound - /// snapshot is equal to `m_base_version + m_size`, but after - /// add_changeset() is called, it is equal to one minus that. - version_type m_base_version; - - /// Current number of entries in the history. A cache of - /// `m_changesets->size()`. - size_t m_size; - - /// A list of changesets, one for each entry in the history. If null, the - /// history is empty. - /// - /// FIXME: Ideally, the B+tree accessor below should have been just - /// Bptree, but Bptree seems to not allow that yet. - /// - /// FIXME: The memory-wise indirection is an unfortunate consequence of the - /// fact that it is impossible to construct a BinaryColumn without already - /// having a ref to a valid underlying node structure. This, in turn, is an - /// unfortunate consequence of the fact that a column accessor contains a - /// dynamically allocated root node accessor, and the type of the required - /// root node accessor depends on the size of the B+-tree. - std::unique_ptr m_changesets; - - void update_from_ref(ref_type, version_type); -}; - -} // namespace _impl -} // namespace realm - -#endif // REALM_IMPL_CONTINUOUS_TRANSACTIONS_HISTORY_HPP diff --git a/Pods/Realm/include/core/realm/impl/destroy_guard.hpp b/Pods/Realm/include/core/realm/impl/destroy_guard.hpp deleted file mode 100644 index e744141b..00000000 --- a/Pods/Realm/include/core/realm/impl/destroy_guard.hpp +++ /dev/null @@ -1,225 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_IMPL_DESTROY_GUARD_HPP -#define REALM_IMPL_DESTROY_GUARD_HPP - -#include -#include - -namespace realm { -namespace _impl { - - -/// Calls `ptr->destroy()` if the guarded pointer (`ptr`) is not null -/// when the guard is destroyed. For arrays (`T` = `Array`) this means -/// that the array is destroyed in a shallow fashion. See -/// `DeepArrayDestroyGuard` for an alternative. -template -class DestroyGuard { -public: - DestroyGuard() noexcept; - - DestroyGuard(T*) noexcept; - - ~DestroyGuard() noexcept; - - void reset(T*) noexcept; - - T* get() const noexcept; - - T* release() noexcept; - -private: - T* m_ptr; -}; - -using ShallowArrayDestroyGuard = DestroyGuard; - - -/// Calls `ptr->destroy_deep()` if the guarded Array pointer (`ptr`) -/// is not null when the guard is destroyed. -class DeepArrayDestroyGuard { -public: - DeepArrayDestroyGuard() noexcept; - - DeepArrayDestroyGuard(Array*) noexcept; - - ~DeepArrayDestroyGuard() noexcept; - - void reset(Array*) noexcept; - - Array* get() const noexcept; - - Array* release() noexcept; - -private: - Array* m_ptr; -}; - - -/// Calls `Array::destroy_deep(ref, alloc)` if the guarded 'ref' -/// (`ref`) is not zero when the guard is destroyed. -class DeepArrayRefDestroyGuard { -public: - DeepArrayRefDestroyGuard(Allocator&) noexcept; - - DeepArrayRefDestroyGuard(ref_type, Allocator&) noexcept; - - ~DeepArrayRefDestroyGuard() noexcept; - - void reset(ref_type) noexcept; - - ref_type get() const noexcept; - - ref_type release() noexcept; - -private: - ref_type m_ref; - Allocator& m_alloc; -}; - - -// Implementation: - -// DestroyGuard - -template -inline DestroyGuard::DestroyGuard() noexcept - : m_ptr(nullptr) -{ -} - -template -inline DestroyGuard::DestroyGuard(T* ptr) noexcept - : m_ptr(ptr) -{ -} - -template -inline DestroyGuard::~DestroyGuard() noexcept -{ - if (m_ptr) - m_ptr->destroy(); -} - -template -inline void DestroyGuard::reset(T* ptr) noexcept -{ - if (m_ptr) - m_ptr->destroy(); - m_ptr = ptr; -} - -template -inline T* DestroyGuard::get() const noexcept -{ - return m_ptr; -} - -template -inline T* DestroyGuard::release() noexcept -{ - T* ptr = m_ptr; - m_ptr = nullptr; - return ptr; -} - - -// DeepArrayDestroyGuard - -inline DeepArrayDestroyGuard::DeepArrayDestroyGuard() noexcept - : m_ptr(nullptr) -{ -} - -inline DeepArrayDestroyGuard::DeepArrayDestroyGuard(Array* ptr) noexcept - : m_ptr(ptr) -{ -} - -inline DeepArrayDestroyGuard::~DeepArrayDestroyGuard() noexcept -{ - if (m_ptr) - m_ptr->destroy_deep(); -} - -inline void DeepArrayDestroyGuard::reset(Array* ptr) noexcept -{ - if (m_ptr) - m_ptr->destroy_deep(); - m_ptr = ptr; -} - -inline Array* DeepArrayDestroyGuard::get() const noexcept -{ - return m_ptr; -} - -inline Array* DeepArrayDestroyGuard::release() noexcept -{ - Array* ptr = m_ptr; - m_ptr = nullptr; - return ptr; -} - - -// DeepArrayRefDestroyGuard - -inline DeepArrayRefDestroyGuard::DeepArrayRefDestroyGuard(Allocator& alloc) noexcept - : m_ref(0) - , m_alloc(alloc) -{ -} - -inline DeepArrayRefDestroyGuard::DeepArrayRefDestroyGuard(ref_type ref, Allocator& alloc) noexcept - : m_ref(ref) - , m_alloc(alloc) -{ -} - -inline DeepArrayRefDestroyGuard::~DeepArrayRefDestroyGuard() noexcept -{ - if (m_ref) - Array::destroy_deep(m_ref, m_alloc); -} - -inline void DeepArrayRefDestroyGuard::reset(ref_type ref) noexcept -{ - if (m_ref) - Array::destroy_deep(m_ref, m_alloc); - m_ref = ref; -} - -inline ref_type DeepArrayRefDestroyGuard::get() const noexcept -{ - return m_ref; -} - -inline ref_type DeepArrayRefDestroyGuard::release() noexcept -{ - ref_type ref = m_ref; - m_ref = 0; - return ref; -} - - -} // namespace _impl -} // namespace realm - -#endif // REALM_IMPL_DESTROY_GUARD_HPP diff --git a/Pods/Realm/include/core/realm/impl/input_stream.hpp b/Pods/Realm/include/core/realm/impl/input_stream.hpp deleted file mode 100644 index b3249298..00000000 --- a/Pods/Realm/include/core/realm/impl/input_stream.hpp +++ /dev/null @@ -1,255 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_IMPL_INPUT_STREAM_HPP -#define REALM_IMPL_INPUT_STREAM_HPP - -#include - -#include -#include -#include - - -namespace realm { -namespace _impl { - - -class InputStream { -public: - /// Read bytes from this input stream and place them in the specified - /// buffer. The returned value is the actual number of bytes that were read, - /// and this is some number `n` such that `n <= min(size, m)` where `m` is - /// the number of bytes that could have been read from this stream before - /// reaching its end. Also, `n` cannot be zero unless `m` or `size` is - /// zero. The intention is that `size` should be non-zero, a the return - /// value used as the end-of-input indicator. - /// - /// Implementations are only allowed to block (put the calling thread to - /// sleep) up until the point in time where the first byte can be made - /// availble. - virtual size_t read(char* buffer, size_t size) = 0; - - virtual ~InputStream() noexcept - { - } -}; - - -class SimpleInputStream : public InputStream { -public: - SimpleInputStream(const char* data, size_t size) noexcept - : m_ptr(data) - , m_end(data + size) - { - } - size_t read(char* buffer, size_t size) override - { - size_t n = std::min(size, size_t(m_end - m_ptr)); - const char* begin = m_ptr; - m_ptr += n; - std::copy_n(begin, n, buffer); - return n; - } - -private: - const char* m_ptr; - const char* const m_end; -}; - - -class NoCopyInputStream { -public: - /// \return if any bytes was read. - /// A value of false indicates end-of-input. - /// If return value is true, \a begin and \a end are - /// updated to reflect the start and limit of a - /// contiguous memory chunk. - virtual bool next_block(const char*& begin, const char*& end) = 0; - - virtual ~NoCopyInputStream() noexcept - { - } -}; - - -class NoCopyInputStreamAdaptor : public NoCopyInputStream { -public: - NoCopyInputStreamAdaptor(InputStream& in, char* buffer, size_t buffer_size) noexcept - : m_in(in) - , m_buffer(buffer) - , m_buffer_size(buffer_size) - { - } - bool next_block(const char*& begin, const char*& end) override - { - size_t n = m_in.read(m_buffer, m_buffer_size); - begin = m_buffer; - end = m_buffer + n; - return n; - } - -private: - InputStream& m_in; - char* m_buffer; - size_t m_buffer_size; -}; - - -class SimpleNoCopyInputStream : public NoCopyInputStream { -public: - SimpleNoCopyInputStream(const char* data, size_t size) - : m_data(data) - , m_size(size) - { - } - - bool next_block(const char*& begin, const char*& end) override - { - if (m_size == 0) - return 0; - size_t size = m_size; - begin = m_data; - end = m_data + size; - m_size = 0; - return size; - } - -private: - const char* m_data; - size_t m_size; -}; - -class MultiLogNoCopyInputStream : public NoCopyInputStream { -public: - MultiLogNoCopyInputStream(const BinaryData* logs_begin, const BinaryData* logs_end) - : m_logs_begin(logs_begin) - , m_logs_end(logs_end) - { - if (m_logs_begin != m_logs_end) - m_curr_buf_remaining_size = m_logs_begin->size(); - } - - size_t read(char* buffer, size_t size) - { - if (m_logs_begin == m_logs_end) - return 0; - for (;;) { - if (m_curr_buf_remaining_size > 0) { - size_t offset = m_logs_begin->size() - m_curr_buf_remaining_size; - const char* data = m_logs_begin->data() + offset; - size_t size_2 = std::min(m_curr_buf_remaining_size, size); - m_curr_buf_remaining_size -= size_2; - // FIXME: Eliminate the need for copying by changing the API of - // Replication::InputStream such that blocks can be handed over - // without copying. This is a straight forward change, but the - // result is going to be more complicated and less conventional. - std::copy_n(data, size_2, buffer); - return size_2; - } - - ++m_logs_begin; - if (m_logs_begin == m_logs_end) - return 0; - m_curr_buf_remaining_size = m_logs_begin->size(); - } - } - - bool next_block(const char*& begin, const char*& end) override - { - while (m_logs_begin < m_logs_end) { - size_t result = m_logs_begin->size(); - const char* data = m_logs_begin->data(); - m_logs_begin++; - if (result == 0) - continue; // skip empty blocks - begin = data; - end = data + result; - return result; - } - return 0; - } - -private: - const BinaryData* m_logs_begin; - const BinaryData* m_logs_end; - size_t m_curr_buf_remaining_size; -}; - - -class ChangesetInputStream : public NoCopyInputStream { -public: - using version_type = History::version_type; - static constexpr unsigned NB_BUFFERS = 8; - - ChangesetInputStream(History& hist, version_type begin_version, version_type end_version) - : m_history(hist) - , m_begin_version(begin_version) - , m_end_version(end_version) - { - get_changeset(); - } - - bool next_block(const char*& begin, const char*& end) override - { - while (m_valid) { - BinaryData actual = m_changesets_begin->get_next(); - - if (actual.size() > 0) { - begin = actual.data(); - end = actual.data() + actual.size(); - return true; - } - - m_changesets_begin++; - - if (REALM_UNLIKELY(m_changesets_begin == m_changesets_end)) { - get_changeset(); - } - } - return false; // End of input - } - -private: - History& m_history; - version_type m_begin_version, m_end_version; - BinaryIterator m_changesets[NB_BUFFERS]; // Buffer - BinaryIterator* m_changesets_begin = nullptr; - BinaryIterator* m_changesets_end = nullptr; - bool m_valid; - - void get_changeset() - { - auto versions_to_get = m_end_version - m_begin_version; - m_valid = versions_to_get > 0; - if (m_valid) { - if (versions_to_get > NB_BUFFERS) - versions_to_get = NB_BUFFERS; - version_type end_version = m_begin_version + versions_to_get; - m_history.get_changesets(m_begin_version, end_version, m_changesets); - m_begin_version = end_version; - m_changesets_begin = m_changesets; - m_changesets_end = m_changesets_begin + versions_to_get; - } - } -}; - -} // namespace _impl -} // namespace realm - -#endif // REALM_IMPL_INPUT_STREAM_HPP diff --git a/Pods/Realm/include/core/realm/impl/instructions.hpp b/Pods/Realm/include/core/realm/impl/instructions.hpp deleted file mode 100644 index 9f54d817..00000000 --- a/Pods/Realm/include/core/realm/impl/instructions.hpp +++ /dev/null @@ -1,380 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2015] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ - -#ifndef REALM_IMPL_INSTRUCTIONS_HPP -#define REALM_IMPL_INSTRUCTIONS_HPP - -#include // size_t -#include - -#include -#include -#include -#include -#include - -namespace realm { -namespace _impl { - -class TransactLogParser; -class TransactLogEncoder; -class InputStream; - -#define REALM_FOR_EACH_INSTRUCTION_TYPE(X) \ - X(SelectTable) \ - X(SelectDescriptor) \ - X(SelectLinkList) \ - X(InsertGroupLevelTable) \ - X(EraseGroupLevelTable) \ - X(RenameGroupLevelTable) \ - X(MoveGroupLevelTable) \ - X(InsertEmptyRows) \ - X(Remove) \ - X(MoveLastOver) \ - X(Swap) \ - X(MergeRows) \ - X(Set) \ - X(SetDefault) \ - X(SetUnique) \ - X(AddInteger) \ - X(InsertSubstring) \ - X(EraseSubstring) \ - X(ClearTable) \ - X(OptimizeTable) \ - X(InsertColumn) \ - X(EraseColumn) \ - X(RenameColumn) \ - X(MoveColumn) \ - X(AddSearchIndex) \ - X(RemoveSearchIndex) \ - X(SetLinkType) \ - X(LinkListSet) \ - X(LinkListInsert) \ - X(LinkListMove) \ - X(LinkListSwap) \ - X(LinkListErase) \ - X(LinkListClear) \ - - -enum class InstrType { -#define REALM_DEFINE_INSTRUCTION_TYPE(X) X, -REALM_FOR_EACH_INSTRUCTION_TYPE(REALM_DEFINE_INSTRUCTION_TYPE) -#undef REALM_DEFINE_INSTRUCTION_TYPE -}; - -struct StringBufferRange { - size_t offset, size; -}; - - -// Note: All specializations must be "POD", so that they can be -// part of a union. -template struct Instr; - -template <> struct Instr { - size_t group_level_ndx; - size_t num_pairs; - size_t pairs[2]; // FIXME: max 1 level of subtables -}; - -template <> struct Instr { - size_t num_pairs; - size_t pairs[2]; // FIXME: max 1 level of subtables -}; - -template <> struct Instr { - size_t col_ndx; - size_t row_ndx; - size_t link_target_group_level_ndx; -}; - -template <> struct Instr { - Instr() {} - size_t table_ndx; - size_t num_tables; - StringBufferRange name; -}; - -template <> struct Instr { - size_t table_ndx; - size_t num_tables; -}; - -template <> struct Instr { - size_t table_ndx; - StringBufferRange new_name; -}; - -template <> struct Instr { - size_t table_ndx_1; - size_t table_ndx_2; -}; - -template <> struct Instr { - size_t row_ndx; - size_t num_rows_to_insert; - size_t prior_num_rows; -}; - -template <> struct Instr { - size_t row_ndx; - size_t num_rows_to_erase; - size_t prior_num_rows; -}; - -template <> struct Instr { - size_t row_ndx; - size_t num_rows_to_erase; - size_t prior_num_rows; -}; - -template <> struct Instr { - size_t row_ndx_1; - size_t row_ndx_2; -}; - -template <> struct Instr { - size_t row_ndx; - size_t new_row_ndx; -}; - -template <> struct Instr { - size_t col_ndx; - size_t row_ndx; - - struct Payload { - DataType type; - - struct LinkPayload { - size_t target_row; // npos means null - size_t target_group_level_ndx; - bool implicit_nullify; - }; - - union PayloadData { - bool boolean; - int64_t integer; - float fnum; - double dnum; - StringBufferRange str; - Timestamp timestamp; - LinkPayload link; - - PayloadData() {} - PayloadData(const PayloadData&) = default; - PayloadData& operator=(const PayloadData&) = default; - }; - PayloadData data; - - bool is_null() const; - }; - - Payload payload; -}; - -template <> struct Instr { - size_t col_ndx; - size_t row_ndx; - int64_t value; -}; - -template <> struct Instr : Instr { -}; - -template <> struct Instr : Instr { - size_t prior_num_rows; -}; - -template<> struct Instr { - Instr() {} - size_t col_ndx; - size_t row_ndx; - size_t pos; - StringBufferRange value; -}; - -template<> struct Instr { - Instr() {} - size_t col_ndx; - size_t row_ndx; - size_t pos; - size_t size; -}; - -template <> struct Instr { -}; - -template <> struct Instr { -}; - -template <> struct Instr { - size_t link_ndx; - size_t value; - size_t prior_size; -}; - -template <> struct Instr { - size_t link_ndx; - size_t value; - size_t prior_size; -}; - -template <> struct Instr { - size_t link_ndx_1; - size_t link_ndx_2; -}; - -template <> struct Instr { - size_t link_ndx; - bool implicit_nullify; - size_t prior_size; -}; - -template <> struct Instr { - size_t link_ndx_1; - size_t link_ndx_2; -}; - -template <> struct Instr { - size_t num_links; -}; - -template <> struct Instr { - size_t col_ndx; - DataType type; - StringBufferRange name; - size_t link_target_table_ndx; - size_t backlink_col_ndx; - bool nullable; -}; - -template <> struct Instr { - size_t col_ndx; - size_t link_target_table_ndx; - size_t backlink_col_ndx; -}; - -template <> struct Instr { - size_t col_ndx; - StringBufferRange new_name; -}; - -template <> struct Instr { - size_t col_ndx_1; - size_t col_ndx_2; -}; - -template <> struct Instr { - size_t col_ndx; -}; - -template <> struct Instr { - size_t col_ndx; -}; - -template <> struct Instr { - size_t col_ndx; - LinkType type; -}; - -struct AnyInstruction { - using Type = InstrType; - - AnyInstruction() {} - template - AnyInstruction(Instr instr): type(t) - { - get_as() = std::move(instr); - } - - InstrType type; - union InstrUnion { -#define REALM_DEFINE_INSTRUCTION_MEMBER(X) Instr m_ ## X; - REALM_FOR_EACH_INSTRUCTION_TYPE(REALM_DEFINE_INSTRUCTION_MEMBER) -#undef REALM_DEFINE_INSTRUCTION_MEMBER - - InstrUnion() { -#if defined(REALM_DEBUG) - char* mem = reinterpret_cast(this); - std::fill(mem, mem + sizeof(*this), 0xef); -#endif // REALM_DEBUG - } - - InstrUnion(const InstrUnion&) = default; - InstrUnion& operator=(const InstrUnion&) = default; - }; - InstrUnion instr; - - template - void visit(F lambda); - template - void visit(F lambda) const; - - template Instr& get_as(); - - template - const Instr& get_as() const - { - return const_cast(this)->template get_as(); - } -}; - -#define REALM_DEFINE_GETTER(X) \ - template<> inline Instr& AnyInstruction::get_as() \ - { \ - return instr.m_ ## X; \ - } - REALM_FOR_EACH_INSTRUCTION_TYPE(REALM_DEFINE_GETTER) -#undef REALM_DEFINE_GETTER - -using InstructionList = std::vector; // FIXME: Consider using std::deque - -InstructionList parse_changeset_as_instructions(_impl::TransactLogParser&, _impl::InputStream&, - util::StringBuffer&); -void encode_instructions_as_changeset(const InstructionList&, const util::StringBuffer&, - _impl::TransactLogEncoder&); - - - - -/// Implementation: - -template -void AnyInstruction::visit(F lambda) -{ - switch (type) { -#define REALM_VISIT_INSTRUCTION(X) \ - case InstrType::X: return lambda(get_as()); - REALM_FOR_EACH_INSTRUCTION_TYPE(REALM_VISIT_INSTRUCTION) -#undef REALM_VISIT_INSTRUCTION - } - REALM_UNREACHABLE(); -} - -template -void AnyInstruction::visit(F lambda) const -{ - const_cast(this)->visit(lambda); -} - -} // namespace _impl -} // namespace realm - -#endif // REALM_IMPL_INSTRUCTIONS_HPP diff --git a/Pods/Realm/include/core/realm/impl/output_stream.hpp b/Pods/Realm/include/core/realm/impl/output_stream.hpp deleted file mode 100644 index 1d022cd5..00000000 --- a/Pods/Realm/include/core/realm/impl/output_stream.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_IMPL_OUTPUT_STREAM_HPP -#define REALM_IMPL_OUTPUT_STREAM_HPP - -#include -#include - -#include - -#include - -#include - -namespace realm { -namespace _impl { - - -class OutputStream : public ArrayWriterBase { -public: - OutputStream(std::ostream&); - ~OutputStream() noexcept; - - ref_type get_ref_of_next_array() const noexcept; - - void write(const char* data, size_t size); - - ref_type write_array(const char* data, size_t size, uint32_t checksum) override; - -private: - ref_type m_next_ref; - std::ostream& m_out; - - void do_write(const char* data, size_t size); -}; - - -// Implementation: - -inline OutputStream::OutputStream(std::ostream& out) - : m_next_ref(0) - , m_out(out) -{ -} - -inline OutputStream::~OutputStream() noexcept -{ -} - -inline size_t OutputStream::get_ref_of_next_array() const noexcept -{ - return m_next_ref; -} - - -} // namespace _impl -} // namespace realm - -#endif // REALM_IMPL_OUTPUT_STREAM_HPP diff --git a/Pods/Realm/include/core/realm/impl/sequential_getter.hpp b/Pods/Realm/include/core/realm/impl/sequential_getter.hpp deleted file mode 100644 index 0cb445f4..00000000 --- a/Pods/Realm/include/core/realm/impl/sequential_getter.hpp +++ /dev/null @@ -1,130 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_IMPL_SEQUENTIAL_GETTER_HPP -#define REALM_IMPL_SEQUENTIAL_GETTER_HPP - -namespace realm { - -class SequentialGetterBase { -public: - virtual ~SequentialGetterBase() noexcept - { - } -}; - -template -class SequentialGetter : public SequentialGetterBase { -public: - using T = typename ColType::value_type; - using ArrayType = typename ColType::LeafType; - - SequentialGetter() - { - } - - SequentialGetter(const Table& table, size_t column_ndx) - { - if (column_ndx != not_found) - m_column = static_cast(&table.get_column_base(column_ndx)); - init(m_column); - } - - SequentialGetter(const ColType* column) - { - init(column); - } - - ~SequentialGetter() noexcept override - { - } - - void init(const ColType* column) - { - m_array_ptr.reset(); // Explicitly destroy the old one first, because we're reusing the memory. - m_array_ptr.reset(new (&m_leaf_accessor_storage) ArrayType(column->get_alloc())); - m_column = column; - m_leaf_end = 0; - } - - REALM_FORCEINLINE bool cache_next(size_t index) - { - // Set m_leaf_ptr to point at the leaf that contains the value at column row `index`. Return whether or not - // the leaf has changed (could be useful to know for caller). - - // FIXME: Below line has been commented away because array leafs might relocate during the lifetime of the - // object that owns this SequentialGetter. Enable again when we have proper support for that. - // if (index >= m_leaf_end || index < m_leaf_start) - { - typename ColType::LeafInfo leaf{&m_leaf_ptr, m_array_ptr.get()}; - size_t ndx_in_leaf; - m_column->get_leaf(index, ndx_in_leaf, leaf); - m_leaf_start = index - ndx_in_leaf; - const size_t leaf_size = m_leaf_ptr->size(); - m_leaf_end = m_leaf_start + leaf_size; - return true; - } - return false; - } - - - REALM_FORCEINLINE T get_next(size_t index) - { -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4800) // Disable the Microsoft warning about bool performance issue. -#endif - return m_column->get(index); - - // FIXME: Below optimization is skipped because array leafs might relocate during the lifetime of the - // object that owns this SequentialGetter. Enable again when we have proper support for that. - cache_next(index); - T av = m_leaf_ptr->get(index - m_leaf_start); - return av; - -#ifdef _MSC_VER -#pragma warning(pop) -#endif - } - - size_t local_end(size_t global_end) - { - if (global_end > m_leaf_end) - return m_leaf_end - m_leaf_start; - else - return global_end - m_leaf_start; - } - - size_t m_leaf_start; - size_t m_leaf_end; - const ColType* m_column = nullptr; - - const ArrayType* m_leaf_ptr = nullptr; - -private: - // Leaf cache for when the root of the column is not a leaf. - // This dog and pony show is because Array has a reference to Allocator internally, - // but we need to be able to transfer queries between contexts, so init() reinitializes - // the leaf cache in the context of the current column. - typename std::aligned_storage::type m_leaf_accessor_storage; - std::unique_ptr m_array_ptr; -}; - -} // namespace realm - -#endif // REALM_IMPL_SEQUENTIAL_GETTER_HPP diff --git a/Pods/Realm/include/core/realm/impl/simulated_failure.hpp b/Pods/Realm/include/core/realm/impl/simulated_failure.hpp deleted file mode 100644 index 4958151f..00000000 --- a/Pods/Realm/include/core/realm/impl/simulated_failure.hpp +++ /dev/null @@ -1,228 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_IMPL_SIMULATED_FAILURE_HPP -#define REALM_IMPL_SIMULATED_FAILURE_HPP - -#include -#include - -#include - -#ifdef REALM_DEBUG -#define REALM_ENABLE_SIMULATED_FAILURE -#endif - -namespace realm { -namespace _impl { - -class SimulatedFailure : public std::system_error { -public: - enum FailureType { - generic, - slab_alloc__reset_free_space_tracking, - slab_alloc__remap, - shared_group__grow_reader_mapping, - sync_client__read_head, - sync_server__read_head, - _num_failure_types - }; - - class OneShotPrimeGuard; - class RandomPrimeGuard; - - /// Prime the specified failure type on the calling thread for triggering - /// once. - static void prime_one_shot(FailureType); - - /// Prime the specified failure type on the calling thread for triggering - /// randomly \a n out of \a m times. - static void prime_random(FailureType, int n, int m, uint_fast64_t seed = 0); - - /// Unprime the specified failure type on the calling thread. - static void unprime(FailureType) noexcept; - - /// Returns true according to the mode of priming of the specified failure - /// type on the calling thread, but only if REALM_ENABLE_SIMULATED_FAILURE - /// was defined during compilation. If REALM_ENABLE_SIMULATED_FAILURE was - /// not defined, this function always return false. - static bool check_trigger(FailureType) noexcept; - - /// The specified error code is set to `make_error_code(failure_type)` if - /// check_trigger() returns true. Otherwise it is set to - /// `std::error_code()`. Returns a copy of the updated error code. - static std::error_code trigger(FailureType failure_type, std::error_code&) noexcept; - - /// Throws SimulatedFailure if check_trigger() returns true. The exception - /// will be constructed with an error code equal to - /// `make_error_code(failure_type)`. - static void trigger(FailureType failure_type); - - /// Returns true when, and only when REALM_ENABLE_SIMULATED_FAILURE was - /// defined during compilation. - static constexpr bool is_enabled(); - - SimulatedFailure(std::error_code); - -private: -#ifdef REALM_ENABLE_SIMULATED_FAILURE - static void do_prime_one_shot(FailureType); - static void do_prime_random(FailureType, int n, int m, uint_fast64_t seed); - static void do_unprime(FailureType) noexcept; - static bool do_check_trigger(FailureType) noexcept; -#endif -}; - -std::error_code make_error_code(SimulatedFailure::FailureType) noexcept; - -class SimulatedFailure::OneShotPrimeGuard { -public: - OneShotPrimeGuard(FailureType); - ~OneShotPrimeGuard() noexcept; - -private: - const FailureType m_type; -}; - - -class SimulatedFailure::RandomPrimeGuard { -public: - RandomPrimeGuard(FailureType, int n, int m, uint_fast64_t seed = 0); - ~RandomPrimeGuard() noexcept; - -private: - const FailureType m_type; -}; - -std::error_code make_error_code(SimulatedFailure::FailureType) noexcept; - -} // namespace _impl -} // namespace realm - -namespace std { - -template<> struct is_error_code_enum { - static const bool value = true; -}; - -} // namespace std - -namespace realm { -namespace _impl { - - -// Implementation - -inline void SimulatedFailure::prime_one_shot(FailureType failure_type) -{ -#ifdef REALM_ENABLE_SIMULATED_FAILURE - do_prime_one_shot(failure_type); -#else - static_cast(failure_type); -#endif -} - -inline void SimulatedFailure::prime_random(FailureType failure_type, int n, int m, uint_fast64_t seed) -{ -#ifdef REALM_ENABLE_SIMULATED_FAILURE - do_prime_random(failure_type, n, m, seed); -#else - static_cast(failure_type); - static_cast(n); - static_cast(m); - static_cast(seed); -#endif -} - -inline void SimulatedFailure::unprime(FailureType failure_type) noexcept -{ -#ifdef REALM_ENABLE_SIMULATED_FAILURE - do_unprime(failure_type); -#else - static_cast(failure_type); -#endif -} - -inline bool SimulatedFailure::check_trigger(FailureType failure_type) noexcept -{ -#ifdef REALM_ENABLE_SIMULATED_FAILURE - return do_check_trigger(failure_type); -#else - static_cast(failure_type); - return false; -#endif -} - -inline std::error_code SimulatedFailure::trigger(FailureType failure_type, std::error_code& ec) noexcept -{ - if (check_trigger(failure_type)) { - ec = make_error_code(failure_type); - } - else { - ec = std::error_code(); - } - return ec; -} - -inline void SimulatedFailure::trigger(FailureType failure_type) -{ - if (check_trigger(failure_type)) - throw SimulatedFailure(make_error_code(failure_type)); -} - -inline constexpr bool SimulatedFailure::is_enabled() -{ -#ifdef REALM_ENABLE_SIMULATED_FAILURE - return true; -#else - return false; -#endif -} - -inline SimulatedFailure::SimulatedFailure(std::error_code ec) - : std::system_error(ec) -{ -} - -inline SimulatedFailure::OneShotPrimeGuard::OneShotPrimeGuard(FailureType failure_type) - : m_type(failure_type) -{ - prime_one_shot(m_type); -} - -inline SimulatedFailure::OneShotPrimeGuard::~OneShotPrimeGuard() noexcept -{ - unprime(m_type); -} - -inline SimulatedFailure::RandomPrimeGuard::RandomPrimeGuard(FailureType failure_type, int n, int m, - uint_fast64_t seed) - : m_type(failure_type) -{ - prime_random(m_type, n, m, seed); -} - -inline SimulatedFailure::RandomPrimeGuard::~RandomPrimeGuard() noexcept -{ - unprime(m_type); -} - -} // namespace _impl -} // namespace realm - -#endif // REALM_IMPL_SIMULATED_FAILURE_HPP diff --git a/Pods/Realm/include/core/realm/impl/table_path.hpp b/Pods/Realm/include/core/realm/impl/table_path.hpp deleted file mode 100644 index c03b6cb2..00000000 --- a/Pods/Realm/include/core/realm/impl/table_path.hpp +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2012] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ - -#ifndef REALM_IMPL_TABLE_PATH_HPP -#define REALM_IMPL_TABLE_PATH_HPP - -#include -#include -#include - -namespace realm { -namespace _impl { - -class TablePath { -public: - TablePath() - { - } - - TablePath(const size_t* begin, size_t len) : m_coords(begin, begin + len) - { - } - - TablePath(size_t group_level_ndx, size_t num_pairs, const size_t* pairs) - { - m_coords.reserve(num_pairs * 2 + 1); - m_coords.push_back(group_level_ndx); - std::copy(pairs, pairs + num_pairs * 2, std::back_inserter(m_coords)); - } - - bool operator==(const TablePath& other) const - { - if (m_coords.size() != other.m_coords.size()) { - return false; - } - for (size_t i = 0; i < m_coords.size(); ++i) { - if (m_coords[i] != other.m_coords[i]) { - return false; - } - } - return true; - } - - bool operator!=(const TablePath& other) const - { - return !((*this) == other); - } - - void push(size_t coord) - { - m_coords.push_back(coord); - } - - size_t size() const - { - return m_coords.size(); - } - - void clear() - { - m_coords.clear(); - } - - // FIXME: Should be private, but is accessed directly from sync.cpp. - std::vector m_coords; -}; - -} // namespace _impl -} // namespace realm - -#endif // REALM_IMPL_TABLE_PATH_HPP diff --git a/Pods/Realm/include/core/realm/impl/transact_log.hpp b/Pods/Realm/include/core/realm/impl/transact_log.hpp deleted file mode 100644 index 8941c386..00000000 --- a/Pods/Realm/include/core/realm/impl/transact_log.hpp +++ /dev/null @@ -1,2771 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_IMPL_TRANSACT_LOG_HPP -#define REALM_IMPL_TRANSACT_LOG_HPP - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace realm { -namespace _impl { - -/// Transaction log instruction encoding -/// NOTE: Any change to this enum is a file-format breaking change. -enum Instruction { - instr_InsertGroupLevelTable = 1, - instr_EraseGroupLevelTable = 2, // Remove columnless table from group - instr_RenameGroupLevelTable = 3, - instr_MoveGroupLevelTable = 4, - instr_SelectTable = 5, - instr_Set = 6, - instr_SetUnique = 7, - instr_SetDefault = 8, - instr_AddInteger = 9, // Add value to integer field - instr_NullifyLink = 10, // Set link to null due to target being erased - instr_InsertSubstring = 11, - instr_EraseFromString = 12, - instr_InsertEmptyRows = 13, - instr_EraseRows = 14, // Remove (multiple) rows - instr_SwapRows = 15, - instr_MergeRows = 16, // Replace links pointing to row A with links to row B - instr_ClearTable = 17, // Remove all rows in selected table - instr_OptimizeTable = 18, - instr_SelectDescriptor = 19, // Select descriptor from currently selected root table - instr_InsertColumn = - 20, // Insert new non-nullable column into to selected descriptor (nullable is instr_InsertNullableColumn) - instr_InsertLinkColumn = 21, // do, but for a link-type column - instr_InsertNullableColumn = 22, // Insert nullable column - instr_EraseColumn = 23, // Remove column from selected descriptor - instr_EraseLinkColumn = 24, // Remove link-type column from selected descriptor - instr_RenameColumn = 25, // Rename column in selected descriptor - instr_MoveColumn = 26, // Move column in selected descriptor - instr_AddSearchIndex = 27, // Add a search index to a column - instr_RemoveSearchIndex = 28, // Remove a search index from a column - instr_SetLinkType = 29, // Strong/weak - instr_SelectLinkList = 30, - instr_LinkListSet = 31, // Assign to link list entry - instr_LinkListInsert = 32, // Insert entry into link list - instr_LinkListMove = 33, // Move an entry within a link list - instr_LinkListSwap = 34, // Swap two entries within a link list - instr_LinkListErase = 35, // Remove an entry from a link list - instr_LinkListNullify = 36, // Remove an entry from a link list due to linked row being erased - instr_LinkListClear = 37, // Ramove all entries from a link list - instr_LinkListSetAll = 38, // Assign to link list entry -}; - - -class TransactLogStream { -public: - /// Ensure contiguous free space in the transaction log - /// buffer. This method must update `out_free_begin` - /// and `out_free_end` such that they refer to a chunk - /// of free space whose size is at least \a n. - /// - /// \param n The required amount of contiguous free space. Must be - /// small (probably not greater than 1024) - /// \param n Must be small (probably not greater than 1024) - virtual void transact_log_reserve(size_t size, char** out_free_begin, char** out_free_end) = 0; - - /// Copy the specified data into the transaction log buffer. This - /// function should be called only when the specified data does - /// not fit inside the chunk of free space currently referred to - /// by `out_free_begin` and `out_free_end`. - /// - /// This method must update `out_begin` and - /// `out_end` such that, upon return, they still - /// refer to a (possibly empty) chunk of free space. - virtual void transact_log_append(const char* data, size_t size, char** out_free_begin, char** out_free_end) = 0; -}; - -class TransactLogBufferStream : public TransactLogStream { -public: - void transact_log_reserve(size_t size, char** out_free_begin, char** out_free_end) override; - void transact_log_append(const char* data, size_t size, char** out_free_begin, char** out_free_end) override; - - const char* transact_log_data() const; - - util::Buffer m_buffer; -}; - - -// LCOV_EXCL_START (because the NullInstructionObserver is trivial) -class NullInstructionObserver { -public: - /// The following methods are also those that TransactLogParser expects - /// to find on the `InstructionHandler`. - - // No selection needed: - bool select_table(size_t, size_t, const size_t*) - { - return true; - } - bool select_descriptor(size_t, const size_t*) - { - return true; - } - bool select_link_list(size_t, size_t, size_t) - { - return true; - } - bool insert_group_level_table(size_t, size_t, StringData) - { - return true; - } - bool erase_group_level_table(size_t, size_t) - { - return true; - } - bool rename_group_level_table(size_t, StringData) - { - return true; - } - bool move_group_level_table(size_t, size_t) - { - return true; - } - - // Must have table selected: - bool insert_empty_rows(size_t, size_t, size_t, bool) - { - return true; - } - bool erase_rows(size_t, size_t, size_t, bool) - { - return true; - } - bool swap_rows(size_t, size_t) - { - return true; - } - bool merge_rows(size_t, size_t) - { - return true; - } - bool clear_table() - { - return true; - } - bool set_int(size_t, size_t, int_fast64_t, Instruction, size_t) - { - return true; - } - bool add_int(size_t, size_t, int_fast64_t) - { - return true; - } - bool set_bool(size_t, size_t, bool, Instruction) - { - return true; - } - bool set_float(size_t, size_t, float, Instruction) - { - return true; - } - bool set_double(size_t, size_t, double, Instruction) - { - return true; - } - bool set_string(size_t, size_t, StringData, Instruction, size_t) - { - return true; - } - bool set_binary(size_t, size_t, BinaryData, Instruction) - { - return true; - } - bool set_olddatetime(size_t, size_t, OldDateTime, Instruction) - { - return true; - } - bool set_timestamp(size_t, size_t, Timestamp, Instruction) - { - return true; - } - bool set_table(size_t, size_t, Instruction) - { - return true; - } - bool set_mixed(size_t, size_t, const Mixed&, Instruction) - { - return true; - } - bool set_link(size_t, size_t, size_t, size_t, Instruction) - { - return true; - } - bool set_null(size_t, size_t, Instruction, size_t) - { - return true; - } - bool nullify_link(size_t, size_t, size_t) - { - return true; - } - bool insert_substring(size_t, size_t, size_t, StringData) - { - return true; - } - bool erase_substring(size_t, size_t, size_t, size_t) - { - return true; - } - bool optimize_table() - { - return true; - } - - // Must have descriptor selected: - bool insert_link_column(size_t, DataType, StringData, size_t, size_t) - { - return true; - } - bool insert_column(size_t, DataType, StringData, bool) - { - return true; - } - bool erase_link_column(size_t, size_t, size_t) - { - return true; - } - bool erase_column(size_t) - { - return true; - } - bool rename_column(size_t, StringData) - { - return true; - } - bool move_column(size_t, size_t) - { - return true; - } - bool add_search_index(size_t) - { - return true; - } - bool remove_search_index(size_t) - { - return true; - } - bool set_link_type(size_t, LinkType) - { - return true; - } - - // Must have linklist selected: - bool link_list_set(size_t, size_t, size_t) - { - return true; - } - bool link_list_insert(size_t, size_t, size_t) - { - return true; - } - bool link_list_move(size_t, size_t) - { - return true; - } - bool link_list_swap(size_t, size_t) - { - return true; - } - bool link_list_erase(size_t, size_t) - { - return true; - } - bool link_list_nullify(size_t, size_t) - { - return true; - } - bool link_list_clear(size_t) - { - return true; - } - - void parse_complete() - { - } -}; -// LCOV_EXCL_STOP (NullInstructionObserver) - - -/// See TransactLogConvenientEncoder for information about the meaning of the -/// arguments of each of the functions in this class. -class TransactLogEncoder { -public: - /// The following methods are also those that TransactLogParser expects - /// to find on the `InstructionHandler`. - - // No selection needed: - bool select_table(size_t group_level_ndx, size_t levels, const size_t* path); - bool select_descriptor(size_t levels, const size_t* path); - bool select_link_list(size_t col_ndx, size_t row_ndx, size_t link_target_group_level_ndx); - bool insert_group_level_table(size_t table_ndx, size_t num_tables, StringData name); - bool erase_group_level_table(size_t table_ndx, size_t num_tables); - bool rename_group_level_table(size_t table_ndx, StringData new_name); - bool move_group_level_table(size_t from_table_ndx, size_t to_table_ndx); - - /// Must have table selected. - bool insert_empty_rows(size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows, bool unordered); - bool erase_rows(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, bool unordered); - bool swap_rows(size_t row_ndx_1, size_t row_ndx_2); - bool merge_rows(size_t row_ndx, size_t new_row_ndx); - bool clear_table(); - - bool set_int(size_t col_ndx, size_t row_ndx, int_fast64_t, Instruction = instr_Set, size_t = 0); - bool add_int(size_t col_ndx, size_t row_ndx, int_fast64_t); - bool set_bool(size_t col_ndx, size_t row_ndx, bool, Instruction = instr_Set); - bool set_float(size_t col_ndx, size_t row_ndx, float, Instruction = instr_Set); - bool set_double(size_t col_ndx, size_t row_ndx, double, Instruction = instr_Set); - bool set_string(size_t col_ndx, size_t row_ndx, StringData, Instruction = instr_Set, size_t = 0); - bool set_binary(size_t col_ndx, size_t row_ndx, BinaryData, Instruction = instr_Set); - bool set_olddatetime(size_t col_ndx, size_t row_ndx, OldDateTime, Instruction = instr_Set); - bool set_timestamp(size_t col_ndx, size_t row_ndx, Timestamp, Instruction = instr_Set); - bool set_table(size_t col_ndx, size_t row_ndx, Instruction = instr_Set); - bool set_mixed(size_t col_ndx, size_t row_ndx, const Mixed&, Instruction = instr_Set); - bool set_link(size_t col_ndx, size_t row_ndx, size_t, size_t target_group_level_ndx, Instruction = instr_Set); - bool set_null(size_t col_ndx, size_t row_ndx, Instruction = instr_Set, size_t = 0); - bool nullify_link(size_t col_ndx, size_t row_ndx, size_t target_group_level_ndx); - bool insert_substring(size_t col_ndx, size_t row_ndx, size_t pos, StringData); - bool erase_substring(size_t col_ndx, size_t row_ndx, size_t pos, size_t size); - bool optimize_table(); - - // Must have descriptor selected: - bool insert_link_column(size_t col_ndx, DataType, StringData name, size_t link_target_table_ndx, - size_t backlink_col_ndx); - bool insert_column(size_t col_ndx, DataType, StringData name, bool nullable = false); - bool erase_link_column(size_t col_ndx, size_t link_target_table_ndx, size_t backlink_col_ndx); - bool erase_column(size_t col_ndx); - bool rename_column(size_t col_ndx, StringData new_name); - bool move_column(size_t col_ndx_1, size_t col_ndx_2); - bool add_search_index(size_t col_ndx); - bool remove_search_index(size_t col_ndx); - bool set_link_type(size_t col_ndx, LinkType); - - // Must have linklist selected: - bool link_list_set(size_t link_ndx, size_t value, size_t prior_size); - bool link_list_set_all(const IntegerColumn& values); - bool link_list_insert(size_t link_ndx, size_t value, size_t prior_size); - bool link_list_move(size_t from_link_ndx, size_t to_link_ndx); - bool link_list_swap(size_t link1_ndx, size_t link2_ndx); - bool link_list_erase(size_t link_ndx, size_t prior_size); - bool link_list_nullify(size_t link_ndx, size_t prior_size); - bool link_list_clear(size_t old_list_size); - - /// End of methods expected by parser. - - - TransactLogEncoder(TransactLogStream& out_stream); - void set_buffer(char* new_free_begin, char* new_free_end); - char* write_position() const - { - return m_transact_log_free_begin; - } - -private: - // Make sure this is in agreement with the actual integer encoding - // scheme (see encode_int()). - static const int max_enc_bytes_per_int = 10; - static const int max_enc_bytes_per_double = sizeof(double); - static const int max_enc_bytes_per_num = - max_enc_bytes_per_int < max_enc_bytes_per_double ? max_enc_bytes_per_double : max_enc_bytes_per_int; - - // This value is used in Set* instructions in place of the 'type' field in - // the stream to indicate that the value of the Set* instruction is NULL, - // which doesn't have a type. - static constexpr int set_null_sentinel() - { - return -1; - } - - TransactLogStream& m_stream; - - // These two delimit a contiguous region of free space in a - // transaction log buffer following the last written data. It may - // be empty. - char* m_transact_log_free_begin = nullptr; - char* m_transact_log_free_end = nullptr; - - char* reserve(size_t size); - /// \param ptr Must be in the range [m_transact_log_free_begin, m_transact_log_free_end] - void advance(char* ptr) noexcept; - - template - void append_simple_instr(Instruction, const util::Tuple& numbers); - - template - void append_string_instr(Instruction, const util::Tuple& numbers, StringData); - - template - void append_mixed_instr(Instruction, const util::Tuple& numbers, const Mixed&); - - template - bool append_variable_size_instr(Instruction instr, const util::Tuple& numbers, I var_begin, I var_end); - - template - static char* encode_int(char*, T value); - static char* encode_bool(char*, bool value); - static char* encode_float(char*, float value); - static char* encode_double(char*, double value); - template - struct EncodeNumber; - friend class TransactLogParser; -}; - -class TransactLogConvenientEncoder { -public: - void insert_group_level_table(size_t table_ndx, size_t num_tables, StringData name); - void erase_group_level_table(size_t table_ndx, size_t num_tables); - void rename_group_level_table(size_t table_ndx, StringData new_name); - void move_group_level_table(size_t from_table_ndx, size_t to_table_ndx); - void insert_column(const Descriptor&, size_t col_ndx, DataType type, StringData name, LinkTargetInfo& link, - bool nullable = false); - void erase_column(const Descriptor&, size_t col_ndx); - void rename_column(const Descriptor&, size_t col_ndx, StringData name); - void move_column(const Descriptor&, size_t from, size_t to); - - void set_int(const Table*, size_t col_ndx, size_t ndx, int_fast64_t value, Instruction variant = instr_Set); - void add_int(const Table*, size_t col_ndx, size_t ndx, int_fast64_t value); - void set_bool(const Table*, size_t col_ndx, size_t ndx, bool value, Instruction variant = instr_Set); - void set_float(const Table*, size_t col_ndx, size_t ndx, float value, Instruction variant = instr_Set); - void set_double(const Table*, size_t col_ndx, size_t ndx, double value, Instruction variant = instr_Set); - void set_string(const Table*, size_t col_ndx, size_t ndx, StringData value, Instruction variant = instr_Set); - void set_binary(const Table*, size_t col_ndx, size_t ndx, BinaryData value, Instruction variant = instr_Set); - void set_olddatetime(const Table*, size_t col_ndx, size_t ndx, OldDateTime value, - Instruction variant = instr_Set); - void set_timestamp(const Table*, size_t col_ndx, size_t ndx, Timestamp value, Instruction variant = instr_Set); - void set_table(const Table*, size_t col_ndx, size_t ndx, Instruction variant = instr_Set); - void set_mixed(const Table*, size_t col_ndx, size_t ndx, const Mixed& value, Instruction variant = instr_Set); - void set_link(const Table*, size_t col_ndx, size_t ndx, size_t value, Instruction variant = instr_Set); - void set_null(const Table*, size_t col_ndx, size_t ndx, Instruction variant = instr_Set); - void set_link_list(const LinkView&, const IntegerColumn& values); - void insert_substring(const Table*, size_t col_ndx, size_t row_ndx, size_t pos, StringData); - void erase_substring(const Table*, size_t col_ndx, size_t row_ndx, size_t pos, size_t size); - - /// \param prior_num_rows The number of rows in the table prior to the - /// modification. - void insert_empty_rows(const Table*, size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows); - - /// \param prior_num_rows The number of rows in the table prior to the - /// modification. - void erase_rows(const Table*, size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, - bool is_move_last_over); - - void swap_rows(const Table*, size_t row_ndx_1, size_t row_ndx_2); - void merge_rows(const Table*, size_t row_ndx, size_t new_row_ndx); - void add_search_index(const Table*, size_t col_ndx); - void remove_search_index(const Table*, size_t col_ndx); - void set_link_type(const Table*, size_t col_ndx, LinkType); - void clear_table(const Table*); - void optimize_table(const Table*); - - void link_list_set(const LinkView&, size_t link_ndx, size_t value); - void link_list_insert(const LinkView&, size_t link_ndx, size_t value); - void link_list_move(const LinkView&, size_t from_link_ndx, size_t to_link_ndx); - void link_list_swap(const LinkView&, size_t link_ndx_1, size_t link_ndx_2); - void link_list_erase(const LinkView&, size_t link_ndx); - void link_list_clear(const LinkView&); - - //@{ - - /// Implicit nullifications due to removal of target row. This is redundant - /// information from the point of view of replication, as the removal of the - /// target row will reproduce the implicit nullifications in the target - /// Realm anyway. The purpose of this instruction is to allow observers - /// (reactor pattern) to be explicitly notified about the implicit - /// nullifications. - - void nullify_link(const Table*, size_t col_ndx, size_t ndx); - void link_list_nullify(const LinkView&, size_t link_ndx); - - //@} - - void on_table_destroyed(const Table*) noexcept; - void on_spec_destroyed(const Spec*) noexcept; - void on_link_list_destroyed(const LinkView&) noexcept; - -protected: - TransactLogConvenientEncoder(TransactLogStream& encoder); - - void reset_selection_caches() noexcept; - void set_buffer(char* new_free_begin, char* new_free_end) - { - m_encoder.set_buffer(new_free_begin, new_free_end); - } - char* write_position() const - { - return m_encoder.write_position(); - } - -private: - TransactLogEncoder m_encoder; - // These are mutable because they are caches. - mutable util::Buffer m_subtab_path_buf; - mutable const Table* m_selected_table; - mutable const Spec* m_selected_spec; - // Has to be atomic to support concurrent reset when a linklist - // is unselected. This can happen on a different thread. In case - // of races, setting of a new value must win. - mutable std::atomic m_selected_link_list; - - void unselect_all() noexcept; - void select_table(const Table*); // unselects descriptor and link list - void select_desc(const Descriptor&); // unselects link list - void select_link_list(const LinkView&); // unselects descriptor - - void record_subtable_path(const Table&, size_t*& out_begin, size_t*& out_end); - void do_select_table(const Table*); - void do_select_desc(const Descriptor&); - void do_select_link_list(const LinkView&); - - friend class TransactReverser; -}; - - -class TransactLogParser { -public: - class BadTransactLog; // Exception - - TransactLogParser(); - ~TransactLogParser() noexcept; - - /// See `TransactLogEncoder` for a list of methods that the `InstructionHandler` must define. - /// parse() promises that the path passed by reference to - /// InstructionHandler::select_descriptor() will remain valid - /// during subsequent calls to all descriptor modifying functions. - template - void parse(InputStream&, InstructionHandler&); - - template - void parse(NoCopyInputStream&, InstructionHandler&); - -private: - util::Buffer m_input_buffer; - - // The input stream is assumed to consist of chunks of memory organised such that - // every instruction resides in a single chunk only. - NoCopyInputStream* m_input; - // pointer into transaction log, each instruction is parsed from m_input_begin and onwards. - // Each instruction are assumed to be contiguous in memory. - const char* m_input_begin; - // pointer to one past current instruction log chunk. If m_input_begin reaches m_input_end, - // a call to next_input_buffer will move m_input_begin and m_input_end to a new chunk of - // memory. Setting m_input_end to 0 disables this check, and is used if it is already known - // that all of the instructions are in memory. - const char* m_input_end; - util::StringBuffer m_string_buffer; - static const int m_max_levels = 1024; - util::Buffer m_path; - - REALM_NORETURN void parser_error() const; - - template - void parse_one(InstructionHandler&); - bool has_next() noexcept; - - template - T read_int(); - - void read_bytes(char* data, size_t size); - BinaryData read_buffer(util::StringBuffer&, size_t size); - - bool read_bool(); - float read_float(); - double read_double(); - - StringData read_string(util::StringBuffer&); - BinaryData read_binary(util::StringBuffer&); - Timestamp read_timestamp(); - void read_mixed(Mixed*); - - // Advance m_input_begin and m_input_end to reflect the next block of instructions - // Returns false if no more input was available - bool next_input_buffer(); - - // return true if input was available - bool read_char(char&); // throws - - bool is_valid_data_type(int type); - bool is_valid_link_type(int type); -}; - - -class TransactLogParser::BadTransactLog : public std::exception { -public: - const char* what() const noexcept override - { - return "Bad transaction log"; - } -}; - - -/// Implementation: - -inline void TransactLogBufferStream::transact_log_reserve(size_t n, char** inout_new_begin, char** out_new_end) -{ - char* data = m_buffer.data(); - REALM_ASSERT(*inout_new_begin >= data); - REALM_ASSERT(*inout_new_begin <= (data + m_buffer.size())); - size_t size = *inout_new_begin - data; - m_buffer.reserve_extra(size, n); - data = m_buffer.data(); // May have changed - *inout_new_begin = data + size; - *out_new_end = data + m_buffer.size(); -} - -inline void TransactLogBufferStream::transact_log_append(const char* data, size_t size, char** out_new_begin, - char** out_new_end) -{ - transact_log_reserve(size, out_new_begin, out_new_end); - *out_new_begin = std::copy_n(data, size, *out_new_begin); -} - -inline const char* TransactLogBufferStream::transact_log_data() const -{ - return m_buffer.data(); -} - -inline TransactLogEncoder::TransactLogEncoder(TransactLogStream& stream) - : m_stream(stream) -{ -} - -inline void TransactLogEncoder::set_buffer(char* free_begin, char* free_end) -{ - REALM_ASSERT(free_begin <= free_end); - m_transact_log_free_begin = free_begin; - m_transact_log_free_end = free_end; -} - -inline void TransactLogConvenientEncoder::reset_selection_caches() noexcept -{ - unselect_all(); -} - -inline char* TransactLogEncoder::reserve(size_t n) -{ - if (size_t(m_transact_log_free_end - m_transact_log_free_begin) < n) { - m_stream.transact_log_reserve(n, &m_transact_log_free_begin, &m_transact_log_free_end); - } - return m_transact_log_free_begin; -} - -inline void TransactLogEncoder::advance(char* ptr) noexcept -{ - REALM_ASSERT_DEBUG(m_transact_log_free_begin <= ptr); - REALM_ASSERT_DEBUG(ptr <= m_transact_log_free_end); - m_transact_log_free_begin = ptr; -} - - -// The integer encoding is platform independent. Also, it does not -// depend on the type of the specified integer. Integers of any type -// can be encoded as long as the specified buffer is large enough (see -// below). The decoding does not have to use the same type. Decoding -// will fail if, and only if the encoded value falls outside the range -// of the requested destination type. -// -// The encoding uses one or more bytes. It never uses more than 8 bits -// per byte. The last byte in the sequence is the first one that has -// its 8th bit set to zero. -// -// Consider a particular non-negative value V. Let W be the number of -// bits needed to encode V using the trivial binary encoding of -// integers. The total number of bytes produced is then -// ceil((W+1)/7). The first byte holds the 7 least significant bits of -// V. The last byte holds at most 6 bits of V including the most -// significant one. The value of the first bit of the last byte is -// always 2**((N-1)*7) where N is the total number of bytes. -// -// A negative value W is encoded by setting the sign bit to one and -// then encoding the positive result of -(W+1) as described above. The -// advantage of this representation is that it converts small negative -// values to small positive values which require a small number of -// bytes. This would not have been true for 2's complements -// representation, for example. The sign bit is always stored as the -// 7th bit of the last byte. -// -// value bits value + sign max bytes -// -------------------------------------------------- -// int8_t 7 8 2 -// uint8_t 8 9 2 -// int16_t 15 16 3 -// uint16_t 16 17 3 -// int32_t 31 32 5 -// uint32_t 32 33 5 -// int64_t 63 64 10 -// uint64_t 64 65 10 -// -template -char* TransactLogEncoder::encode_int(char* ptr, T value) -{ - static_assert(std::numeric_limits::is_integer, "Integer required"); - bool negative = util::is_negative(value); - if (negative) { - // The following conversion is guaranteed by C++11 to never - // overflow (contrast this with "-value" which indeed could - // overflow). See C99+TC3 section 6.2.6.2 paragraph 2. - REALM_DIAG_PUSH(); - REALM_DIAG_IGNORE_UNSIGNED_MINUS(); - value = -(value + 1); - REALM_DIAG_POP(); - } - // At this point 'value' is always a positive number. Also, small - // negative numbers have been converted to small positive numbers. - REALM_ASSERT(!util::is_negative(value)); - // One sign bit plus number of value bits - const int num_bits = 1 + std::numeric_limits::digits; - // Only the first 7 bits are available per byte. Had it not been - // for the fact that maximum guaranteed bit width of a char is 8, - // this value could have been increased to 15 (one less than the - // number of value bits in 'unsigned'). - const int bits_per_byte = 7; - const int max_bytes = (num_bits + (bits_per_byte - 1)) / bits_per_byte; - static_assert(max_bytes <= max_enc_bytes_per_int, "Bad max_enc_bytes_per_int"); - // An explicit constant maximum number of iterations is specified - // in the hope that it will help the optimizer (to do loop - // unrolling, for example). - typedef unsigned char uchar; - for (int i = 0; i < max_bytes; ++i) { - if (value >> (bits_per_byte - 1) == 0) - break; - *reinterpret_cast(ptr) = uchar((1U << bits_per_byte) | unsigned(value & ((1U << bits_per_byte) - 1))); - ++ptr; - value >>= bits_per_byte; - } - *reinterpret_cast(ptr) = uchar(negative ? (1U << (bits_per_byte - 1)) | unsigned(value) : value); - return ++ptr; -} - -inline char* TransactLogEncoder::encode_bool(char* ptr, bool value) -{ - // A `char` is the smallest element that the encoder/decoder can process. So we encode the bool - // in a char. If we called encode_int it would end up as a char too, but we would get - // Various warnings about arithmetic on non-arithmetic type. - return encode_int(ptr, value); -} - -inline char* TransactLogEncoder::encode_float(char* ptr, float value) -{ - static_assert(std::numeric_limits::is_iec559 && - sizeof(float) * std::numeric_limits::digits == 32, - "Unsupported 'float' representation"); - const char* val_ptr = reinterpret_cast(&value); - return std::copy_n(val_ptr, sizeof value, ptr); -} - -inline char* TransactLogEncoder::encode_double(char* ptr, double value) -{ - static_assert(std::numeric_limits::is_iec559 && - sizeof(double) * std::numeric_limits::digits == 64, - "Unsupported 'double' representation"); - const char* val_ptr = reinterpret_cast(&value); - return std::copy_n(val_ptr, sizeof value, ptr); -} - -template -struct TransactLogEncoder::EncodeNumber { - void operator()(T value, char** ptr) - { - auto value_2 = value + 0; // Perform integral promotion - *ptr = encode_int(*ptr, value_2); - } -}; -template <> -struct TransactLogEncoder::EncodeNumber { - void operator()(char value, char** ptr) - { - // Write the char as-is without encoding. - **ptr = value; - ++(*ptr); - } -}; -template <> -struct TransactLogEncoder::EncodeNumber { - void operator()(bool value, char** ptr) - { - *ptr = encode_bool(*ptr, value); - } -}; -template <> -struct TransactLogEncoder::EncodeNumber { - void operator()(float value, char** ptr) - { - *ptr = encode_float(*ptr, value); - } -}; -template <> -struct TransactLogEncoder::EncodeNumber { - void operator()(double value, char** ptr) - { - *ptr = encode_double(*ptr, value); - } -}; -template <> -struct TransactLogEncoder::EncodeNumber { - void operator()(DataType type, char** ptr) - { - auto value_2 = type + 0; // Perform integral promotion - *ptr = encode_int(*ptr, value_2); - } -}; - -template -void TransactLogEncoder::append_simple_instr(Instruction instr, const util::Tuple& numbers) -{ - size_t num_numbers = util::TypeCount::value; - size_t max_required_bytes = 1 + max_enc_bytes_per_num * num_numbers; - char* ptr = reserve(max_required_bytes); // Throws - *ptr++ = char(instr); - util::for_each(numbers, &ptr); - advance(ptr); -} - -template -void TransactLogEncoder::append_string_instr(Instruction instr, const util::Tuple& numbers, StringData string) -{ - size_t num_numbers = util::TypeCount::value + 1; - size_t max_required_bytes = 1 + max_enc_bytes_per_num * num_numbers + string.size(); - char* ptr = reserve(max_required_bytes); // Throws - *ptr++ = char(instr); - util::for_each(append(numbers, string.size()), &ptr); - ptr = std::copy_n(string.data(), string.size(), ptr); - advance(ptr); -} - -template -void TransactLogEncoder::append_mixed_instr(Instruction instr, const util::Tuple& numbers, const Mixed& value) -{ - DataType type = value.get_type(); - auto numbers_2 = append(numbers, type); - switch (type) { - case type_Int: - append_simple_instr(instr, append(numbers_2, value.get_int())); // Throws - return; - case type_Bool: - append_simple_instr(instr, append(numbers_2, value.get_bool())); // Throws - return; - case type_Float: - append_simple_instr(instr, append(numbers_2, value.get_float())); // Throws - return; - case type_Double: - append_simple_instr(instr, append(numbers_2, value.get_double())); // Throws - return; - case type_OldDateTime: { - auto value_2 = value.get_olddatetime().get_olddatetime(); - append_simple_instr(instr, append(numbers_2, value_2)); // Throws - return; - } - case type_String: { - append_string_instr(instr, numbers_2, value.get_string()); // Throws - return; - } - case type_Binary: { - BinaryData value_2 = value.get_binary(); - StringData value_3(value_2.data(), value_2.size()); - append_string_instr(instr, numbers_2, value_3); // Throws - return; - } - case type_Timestamp: { - Timestamp ts = value.get_timestamp(); - int64_t seconds = ts.get_seconds(); - int32_t nano_seconds = ts.get_nanoseconds(); - auto numbers_3 = append(numbers_2, seconds); - append_simple_instr(instr, append(numbers_3, nano_seconds)); // Throws - return; - } - case type_Table: - append_simple_instr(instr, numbers_2); // Throws - return; - case type_Mixed: - // Mixed in mixed is not possible - REALM_ASSERT_RELEASE(false); - case type_Link: - case type_LinkList: - // FIXME: Need to handle new link types here. - REALM_ASSERT_RELEASE(false); - } - REALM_ASSERT_RELEASE(false); -} - -template -bool TransactLogEncoder::append_variable_size_instr(Instruction instr, const util::Tuple& numbers, I var_begin, - I var_end) -{ -// Space is reserved in chunks to avoid excessive over allocation. -#ifdef REALM_DEBUG - const int max_numbers_per_chunk = 2; // Increase the chance of chunking in debug mode -#else - const int max_numbers_per_chunk = 8; -#endif - size_t num_numbers = util::TypeCount::value + max_numbers_per_chunk; - size_t max_required_bytes = 1 + max_enc_bytes_per_num * num_numbers; - char* ptr = reserve(max_required_bytes); // Throws - *ptr++ = char(instr); - util::for_each(numbers, &ptr); - I i = var_begin; - while (var_end - i > max_numbers_per_chunk) { - for (int j = 0; j < max_numbers_per_chunk; ++j) - ptr = encode_int(ptr, *i++); - advance(ptr); - size_t max_required_bytes_2 = max_enc_bytes_per_num * max_numbers_per_chunk; - ptr = reserve(max_required_bytes_2); // Throws - } - while (i != var_end) - ptr = encode_int(ptr, *i++); - advance(ptr); - return true; -} - -inline void TransactLogConvenientEncoder::unselect_all() noexcept -{ - m_selected_table = nullptr; - m_selected_spec = nullptr; - // no race with on_link_list_destroyed since both are setting to nullptr - m_selected_link_list = nullptr; -} - -inline void TransactLogConvenientEncoder::select_table(const Table* table) -{ - if (table != m_selected_table) - do_select_table(table); // Throws - m_selected_spec = nullptr; - // no race with on_link_list_destroyed since both are setting to nullptr - m_selected_link_list = nullptr; -} - -inline void TransactLogConvenientEncoder::select_desc(const Descriptor& desc) -{ - typedef _impl::DescriptorFriend df; - if (&df::get_spec(desc) != m_selected_spec) - do_select_desc(desc); // Throws - // no race with on_link_list_destroyed since both are setting to nullptr - m_selected_link_list = nullptr; -} - -inline void TransactLogConvenientEncoder::select_link_list(const LinkView& list) -{ - // A race between this and a call to on_link_list_destroyed() must - // end up with m_selected_link_list pointing to the list argument given - // here. We assume that the list given to on_link_list_destroyed() can - // *never* be the same as the list argument given here. We resolve the - // race by a) always updating m_selected_link_list in do_select_link_list() - // and b) only atomically and conditionally updating it in - // on_link_list_destroyed(). - if (&list != m_selected_link_list) { - do_select_link_list(list); // Throws - } - m_selected_spec = nullptr; -} - - -inline bool TransactLogEncoder::insert_group_level_table(size_t table_ndx, size_t prior_num_tables, StringData name) -{ - append_string_instr(instr_InsertGroupLevelTable, util::tuple(table_ndx, prior_num_tables), name); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::insert_group_level_table(size_t table_ndx, size_t prior_num_tables, - StringData name) -{ - unselect_all(); - m_encoder.insert_group_level_table(table_ndx, prior_num_tables, name); // Throws -} - -inline bool TransactLogEncoder::erase_group_level_table(size_t table_ndx, size_t prior_num_tables) -{ - append_simple_instr(instr_EraseGroupLevelTable, util::tuple(table_ndx, prior_num_tables)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::erase_group_level_table(size_t table_ndx, size_t prior_num_tables) -{ - unselect_all(); - m_encoder.erase_group_level_table(table_ndx, prior_num_tables); // Throws -} - -inline bool TransactLogEncoder::rename_group_level_table(size_t table_ndx, StringData new_name) -{ - append_string_instr(instr_RenameGroupLevelTable, util::tuple(table_ndx), new_name); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::rename_group_level_table(size_t table_ndx, StringData new_name) -{ - unselect_all(); - m_encoder.rename_group_level_table(table_ndx, new_name); // Throws -} - -inline bool TransactLogEncoder::move_group_level_table(size_t from_table_ndx, size_t to_table_ndx) -{ - REALM_ASSERT(from_table_ndx != to_table_ndx); - append_simple_instr(instr_MoveGroupLevelTable, util::tuple(from_table_ndx, to_table_ndx)); - return true; -} - -inline void TransactLogConvenientEncoder::move_group_level_table(size_t from_table_ndx, size_t to_table_ndx) -{ - unselect_all(); - m_encoder.move_group_level_table(from_table_ndx, to_table_ndx); -} - -inline bool TransactLogEncoder::insert_column(size_t col_ndx, DataType type, StringData name, bool nullable) -{ - Instruction instr = (nullable ? instr_InsertNullableColumn : instr_InsertColumn); - append_string_instr(instr, util::tuple(col_ndx, type), name); // Throws - return true; -} - -inline bool TransactLogEncoder::insert_link_column(size_t col_ndx, DataType type, StringData name, - size_t link_target_table_ndx, size_t backlink_col_ndx) -{ - REALM_ASSERT(_impl::TableFriend::is_link_type(ColumnType(type))); - append_string_instr(instr_InsertLinkColumn, util::tuple(col_ndx, type, link_target_table_ndx, backlink_col_ndx), - name); // Throws - return true; -} - - -inline void TransactLogConvenientEncoder::insert_column(const Descriptor& desc, size_t col_ndx, DataType type, - StringData name, LinkTargetInfo& link, bool nullable) -{ - select_desc(desc); // Throws - if (link.is_valid()) { - typedef _impl::TableFriend tf; - typedef _impl::DescriptorFriend df; - size_t target_table_ndx = link.m_target_table->get_index_in_group(); - const Table& origin_table = df::get_root_table(desc); - REALM_ASSERT(origin_table.is_group_level()); - const Spec& target_spec = tf::get_spec(*(link.m_target_table)); - size_t origin_table_ndx = origin_table.get_index_in_group(); - size_t backlink_col_ndx = target_spec.find_backlink_column(origin_table_ndx, col_ndx); - REALM_ASSERT_3(backlink_col_ndx, ==, link.m_backlink_col_ndx); - m_encoder.insert_link_column(col_ndx, type, name, target_table_ndx, backlink_col_ndx); // Throws - } - else { - m_encoder.insert_column(col_ndx, type, name, nullable); // Throws - } -} - -inline bool TransactLogEncoder::erase_column(size_t col_ndx) -{ - append_simple_instr(instr_EraseColumn, util::tuple(col_ndx)); // Throws - return true; -} - -inline bool TransactLogEncoder::erase_link_column(size_t col_ndx, size_t link_target_table_ndx, - size_t backlink_col_ndx) -{ - append_simple_instr(instr_EraseLinkColumn, util::tuple(col_ndx, link_target_table_ndx, - backlink_col_ndx)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::erase_column(const Descriptor& desc, size_t col_ndx) -{ - select_desc(desc); // Throws - - DataType type = desc.get_column_type(col_ndx); - typedef _impl::TableFriend tf; - if (!tf::is_link_type(ColumnType(type))) { - m_encoder.erase_column(col_ndx); // Throws - } - else { // it's a link column: - REALM_ASSERT(desc.is_root()); - typedef _impl::DescriptorFriend df; - const Table& origin_table = df::get_root_table(desc); - REALM_ASSERT(origin_table.is_group_level()); - const Table& target_table = *tf::get_link_target_table_accessor(origin_table, col_ndx); - size_t target_table_ndx = target_table.get_index_in_group(); - const Spec& target_spec = tf::get_spec(target_table); - size_t origin_table_ndx = origin_table.get_index_in_group(); - size_t backlink_col_ndx = target_spec.find_backlink_column(origin_table_ndx, col_ndx); - m_encoder.erase_link_column(col_ndx, target_table_ndx, backlink_col_ndx); // Throws - } -} - -inline bool TransactLogEncoder::rename_column(size_t col_ndx, StringData new_name) -{ - append_string_instr(instr_RenameColumn, util::tuple(col_ndx), new_name); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::rename_column(const Descriptor& desc, size_t col_ndx, StringData name) -{ - select_desc(desc); // Throws - m_encoder.rename_column(col_ndx, name); // Throws -} - - -inline bool TransactLogEncoder::move_column(size_t from, size_t to) -{ - append_simple_instr(instr_MoveColumn, util::tuple(from, to)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::move_column(const Descriptor& desc, size_t from, size_t to) -{ - select_desc(desc); // Throws - m_encoder.move_column(from, to); -} - - -inline bool TransactLogEncoder::set_int(size_t col_ndx, size_t ndx, int_fast64_t value, Instruction variant, - size_t prior_num_rows) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault || variant == instr_SetUnique, variant); - if (REALM_UNLIKELY(variant == instr_SetUnique)) - append_simple_instr(variant, util::tuple(type_Int, col_ndx, ndx, prior_num_rows, value)); // Throws - else - append_simple_instr(variant, util::tuple(type_Int, col_ndx, ndx, value)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::set_int(const Table* t, size_t col_ndx, size_t ndx, int_fast64_t value, - Instruction variant) -{ - select_table(t); // Throws - size_t prior_num_rows = (variant == instr_SetUnique ? t->size() : 0); - m_encoder.set_int(col_ndx, ndx, value, variant, prior_num_rows); // Throws -} - - -inline bool TransactLogEncoder::add_int(size_t col_ndx, size_t ndx, int_fast64_t value) -{ - append_simple_instr(instr_AddInteger, util::tuple(col_ndx, ndx, value)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::add_int(const Table* t, size_t col_ndx, size_t ndx, int_fast64_t value) -{ - select_table(t); // Throws - m_encoder.add_int(col_ndx, ndx, value); -} - -inline bool TransactLogEncoder::set_bool(size_t col_ndx, size_t ndx, bool value, Instruction variant) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault, variant); - append_simple_instr(variant, util::tuple(type_Bool, col_ndx, ndx, value)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::set_bool(const Table* t, size_t col_ndx, size_t ndx, bool value, - Instruction variant) -{ - select_table(t); // Throws - m_encoder.set_bool(col_ndx, ndx, value, variant); // Throws -} - -inline bool TransactLogEncoder::set_float(size_t col_ndx, size_t ndx, float value, Instruction variant) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault, variant); - append_simple_instr(variant, util::tuple(type_Float, col_ndx, ndx, value)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::set_float(const Table* t, size_t col_ndx, size_t ndx, float value, - Instruction variant) -{ - select_table(t); // Throws - m_encoder.set_float(col_ndx, ndx, value, variant); // Throws -} - -inline bool TransactLogEncoder::set_double(size_t col_ndx, size_t ndx, double value, Instruction variant) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault, variant); - append_simple_instr(instr_Set, util::tuple(type_Double, col_ndx, ndx, value)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::set_double(const Table* t, size_t col_ndx, size_t ndx, double value, - Instruction variant) -{ - select_table(t); // Throws - m_encoder.set_double(col_ndx, ndx, value, variant); // Throws -} - -inline bool TransactLogEncoder::set_string(size_t col_ndx, size_t ndx, StringData value, Instruction variant, - size_t prior_num_rows) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault || variant == instr_SetUnique, variant); - if (value.is_null()) { - set_null(col_ndx, ndx, variant, prior_num_rows); // Throws - } - else { - if (REALM_UNLIKELY(variant == instr_SetUnique)) - append_string_instr(variant, util::tuple(type_String, col_ndx, ndx, prior_num_rows), value); // Throws - else - append_string_instr(variant, util::tuple(type_String, col_ndx, ndx), value); // Throws - } - return true; -} - -inline void TransactLogConvenientEncoder::set_string(const Table* t, size_t col_ndx, size_t ndx, StringData value, - Instruction variant) -{ - select_table(t); // Throws - size_t prior_num_rows = (variant == instr_SetUnique ? t->size() : 0); - m_encoder.set_string(col_ndx, ndx, value, variant, prior_num_rows); // Throws -} - -inline bool TransactLogEncoder::set_binary(size_t col_ndx, size_t row_ndx, BinaryData value, Instruction variant) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault, variant); - if (value.is_null()) { - set_null(col_ndx, row_ndx, variant); // Throws - } - else { - StringData value_2(value.data(), value.size()); - append_string_instr(variant, util::tuple(type_Binary, col_ndx, row_ndx), value_2); // Throws - } - return true; -} - -inline void TransactLogConvenientEncoder::set_binary(const Table* t, size_t col_ndx, size_t ndx, BinaryData value, - Instruction variant) -{ - select_table(t); // Throws - m_encoder.set_binary(col_ndx, ndx, value, variant); // Throws -} - -inline bool TransactLogEncoder::set_olddatetime(size_t col_ndx, size_t ndx, OldDateTime value, Instruction variant) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault, variant); - append_simple_instr(variant, util::tuple(type_OldDateTime, col_ndx, ndx, value.get_olddatetime())); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::set_olddatetime(const Table* t, size_t col_ndx, size_t ndx, - OldDateTime value, Instruction variant) -{ - select_table(t); // Throws - m_encoder.set_olddatetime(col_ndx, ndx, value, variant); // Throws -} - -inline bool TransactLogEncoder::set_timestamp(size_t col_ndx, size_t ndx, Timestamp value, Instruction variant) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault, variant); - append_simple_instr( - variant, util::tuple(type_Timestamp, col_ndx, ndx, value.get_seconds(), value.get_nanoseconds())); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::set_timestamp(const Table* t, size_t col_ndx, size_t ndx, Timestamp value, - Instruction variant) -{ - select_table(t); // Throws - m_encoder.set_timestamp(col_ndx, ndx, value, variant); // Throws -} - -inline bool TransactLogEncoder::set_table(size_t col_ndx, size_t ndx, Instruction variant) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault, variant); - append_simple_instr(variant, util::tuple(type_Table, col_ndx, ndx)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::set_table(const Table* t, size_t col_ndx, size_t ndx, Instruction variant) -{ - select_table(t); // Throws - m_encoder.set_table(col_ndx, ndx, variant); // Throws -} - -inline bool TransactLogEncoder::set_mixed(size_t col_ndx, size_t ndx, const Mixed& value, Instruction variant) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault, variant); - append_mixed_instr(variant, util::tuple(type_Mixed, col_ndx, ndx), value); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::set_mixed(const Table* t, size_t col_ndx, size_t ndx, const Mixed& value, - Instruction variant) -{ - select_table(t); // Throws - m_encoder.set_mixed(col_ndx, ndx, value, variant); // Throws -} - -inline bool TransactLogEncoder::set_link(size_t col_ndx, size_t ndx, size_t value, size_t target_group_level_ndx, - Instruction variant) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault, variant); - // Map `realm::npos` to zero, and `n` to `n+1`, where `n` is a target row - // index. - size_t value_2 = size_t(1) + value; - append_simple_instr(variant, util::tuple(type_Link, col_ndx, ndx, value_2, target_group_level_ndx)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::set_link(const Table* t, size_t col_ndx, size_t ndx, size_t value, - Instruction variant) -{ - select_table(t); // Throws - size_t target_group_level_ndx = t->get_descriptor()->get_column_link_target(col_ndx); - m_encoder.set_link(col_ndx, ndx, value, target_group_level_ndx, variant); // Throws -} - -inline bool TransactLogEncoder::set_null(size_t col_ndx, size_t ndx, Instruction variant, size_t prior_num_rows) -{ - REALM_ASSERT_EX(variant == instr_Set || variant == instr_SetDefault || variant == instr_SetUnique, variant); - if (REALM_UNLIKELY(variant == instr_SetUnique)) { - append_simple_instr(variant, util::tuple(set_null_sentinel(), col_ndx, ndx, prior_num_rows)); // Throws - } - else { - append_simple_instr(variant, util::tuple(set_null_sentinel(), col_ndx, ndx)); // Throws - } - return true; -} - -inline void TransactLogConvenientEncoder::set_null(const Table* t, size_t col_ndx, size_t row_ndx, - Instruction variant) -{ - select_table(t); // Throws - size_t prior_num_rows = (variant == instr_SetUnique ? t->size() : 0); - m_encoder.set_null(col_ndx, row_ndx, variant, prior_num_rows); // Throws -} - -inline bool TransactLogEncoder::nullify_link(size_t col_ndx, size_t ndx, size_t target_group_level_ndx) -{ - append_simple_instr(instr_NullifyLink, util::tuple(col_ndx, ndx, target_group_level_ndx)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::nullify_link(const Table* t, size_t col_ndx, size_t ndx) -{ - select_table(t); // Throws - size_t target_group_level_ndx = t->get_descriptor()->get_column_link_target(col_ndx); - m_encoder.nullify_link(col_ndx, ndx, target_group_level_ndx); // Throws -} - -inline bool TransactLogEncoder::insert_substring(size_t col_ndx, size_t row_ndx, size_t pos, StringData value) -{ - append_string_instr(instr_InsertSubstring, util::tuple(col_ndx, row_ndx, pos), value); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::insert_substring(const Table* t, size_t col_ndx, size_t row_ndx, size_t pos, - StringData value) -{ - if (value.size() > 0) { - select_table(t); // Throws - m_encoder.insert_substring(col_ndx, row_ndx, pos, value); // Throws - } -} - -inline bool TransactLogEncoder::erase_substring(size_t col_ndx, size_t row_ndx, size_t pos, size_t size) -{ - append_simple_instr(instr_EraseFromString, util::tuple(col_ndx, row_ndx, pos, size)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::erase_substring(const Table* t, size_t col_ndx, size_t row_ndx, size_t pos, - size_t size) -{ - if (size > 0) { - select_table(t); // Throws - m_encoder.erase_substring(col_ndx, row_ndx, pos, size); // Throws - } -} - -inline bool TransactLogEncoder::insert_empty_rows(size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows, - bool unordered) -{ - append_simple_instr(instr_InsertEmptyRows, - util::tuple(row_ndx, num_rows_to_insert, prior_num_rows, unordered)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::insert_empty_rows(const Table* t, size_t row_ndx, size_t num_rows_to_insert, - size_t prior_num_rows) -{ - select_table(t); // Throws - bool unordered = false; - m_encoder.insert_empty_rows(row_ndx, num_rows_to_insert, prior_num_rows, unordered); // Throws -} - -inline bool TransactLogEncoder::erase_rows(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, - bool unordered) -{ - append_simple_instr(instr_EraseRows, util::tuple(row_ndx, num_rows_to_erase, prior_num_rows, - unordered)); // Throws - return true; -} - - -inline void TransactLogConvenientEncoder::erase_rows(const Table* t, size_t row_ndx, size_t num_rows_to_erase, - size_t prior_num_rows, bool is_move_last_over) -{ - select_table(t); // Throws - bool unordered = is_move_last_over; - m_encoder.erase_rows(row_ndx, num_rows_to_erase, prior_num_rows, unordered); // Throws -} - -inline bool TransactLogEncoder::swap_rows(size_t row_ndx_1, size_t row_ndx_2) -{ - append_simple_instr(instr_SwapRows, util::tuple(row_ndx_1, row_ndx_2)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::swap_rows(const Table* t, size_t row_ndx_1, size_t row_ndx_2) -{ - REALM_ASSERT(row_ndx_1 < row_ndx_2); - select_table(t); // Throws - m_encoder.swap_rows(row_ndx_1, row_ndx_2); -} - -inline bool TransactLogEncoder::merge_rows(size_t row_ndx, size_t new_row_ndx) -{ - append_simple_instr(instr_MergeRows, util::tuple(row_ndx, new_row_ndx)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::merge_rows(const Table* t, size_t row_ndx, size_t new_row_ndx) -{ - select_table(t); // Throws - m_encoder.merge_rows(row_ndx, new_row_ndx); -} - -inline bool TransactLogEncoder::add_search_index(size_t col_ndx) -{ - append_simple_instr(instr_AddSearchIndex, util::tuple(col_ndx)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::add_search_index(const Table* t, size_t col_ndx) -{ - select_table(t); // Throws - m_encoder.add_search_index(col_ndx); // Throws -} - - -inline bool TransactLogEncoder::remove_search_index(size_t col_ndx) -{ - append_simple_instr(instr_RemoveSearchIndex, util::tuple(col_ndx)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::remove_search_index(const Table* t, size_t col_ndx) -{ - select_table(t); // Throws - m_encoder.remove_search_index(col_ndx); // Throws -} - -inline bool TransactLogEncoder::set_link_type(size_t col_ndx, LinkType link_type) -{ - append_simple_instr(instr_SetLinkType, util::tuple(col_ndx, int(link_type))); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::set_link_type(const Table* t, size_t col_ndx, LinkType link_type) -{ - select_table(t); // Throws - m_encoder.set_link_type(col_ndx, link_type); // Throws -} - - -inline bool TransactLogEncoder::clear_table() -{ - append_simple_instr(instr_ClearTable, util::tuple()); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::clear_table(const Table* t) -{ - select_table(t); // Throws - m_encoder.clear_table(); // Throws -} - -inline bool TransactLogEncoder::optimize_table() -{ - append_simple_instr(instr_OptimizeTable, util::tuple()); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::optimize_table(const Table* t) -{ - select_table(t); // Throws - m_encoder.optimize_table(); // Throws -} - -inline bool TransactLogEncoder::link_list_set(size_t link_ndx, size_t value, size_t prior_size) -{ - append_simple_instr(instr_LinkListSet, util::tuple(link_ndx, value, prior_size)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::link_list_set(const LinkView& list, size_t link_ndx, size_t value) -{ - select_link_list(list); // Throws - m_encoder.link_list_set(link_ndx, value, list.size()); // Throws -} - -inline bool TransactLogEncoder::link_list_nullify(size_t link_ndx, size_t prior_size) -{ - append_simple_instr(instr_LinkListNullify, util::tuple(link_ndx, prior_size)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::link_list_nullify(const LinkView& list, size_t link_ndx) -{ - select_link_list(list); // Throws - size_t prior_size = list.size(); // Instruction is emitted before the fact. - m_encoder.link_list_nullify(link_ndx, prior_size); // Throws -} - -inline bool TransactLogEncoder::link_list_set_all(const IntegerColumn& values) -{ - struct iter { - iter(const IntegerColumn& iter_values, size_t ndx) - : m_values(&iter_values) - , m_ndx(ndx) - { - } - const IntegerColumn* m_values; - size_t m_ndx; - bool operator==(const iter& i) const - { - return m_ndx == i.m_ndx; - } - bool operator!=(const iter& i) const - { - return m_ndx != i.m_ndx; - } - size_t operator-(const iter& i) const - { - return m_ndx - i.m_ndx; - } - int_fast64_t operator*() const - { - return m_values->get(m_ndx); - } - iter& operator++() - { - ++m_ndx; - return *this; - } - iter operator++(int) - { - iter i = *this; - ++m_ndx; - return i; - } - }; - size_t num_values = values.size(); - append_variable_size_instr(instr_LinkListSetAll, util::tuple(num_values), iter(values, 0), - iter(values, num_values)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::set_link_list(const LinkView& list, const IntegerColumn& values) -{ - select_link_list(list); // Throws - m_encoder.link_list_set_all(values); // Throws -} - -inline bool TransactLogEncoder::link_list_insert(size_t link_ndx, size_t value, size_t prior_size) -{ - append_simple_instr(instr_LinkListInsert, util::tuple(link_ndx, value, prior_size)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::link_list_insert(const LinkView& list, size_t link_ndx, size_t value) -{ - select_link_list(list); // Throws - size_t prior_size = list.size() - 1; // The instruction is emitted after the fact. - m_encoder.link_list_insert(link_ndx, value, prior_size); // Throws -} - -inline bool TransactLogEncoder::link_list_move(size_t from_link_ndx, size_t to_link_ndx) -{ - REALM_ASSERT(from_link_ndx != to_link_ndx); - append_simple_instr(instr_LinkListMove, util::tuple(from_link_ndx, to_link_ndx)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::link_list_move(const LinkView& list, size_t from_link_ndx, - size_t to_link_ndx) -{ - select_link_list(list); // Throws - m_encoder.link_list_move(from_link_ndx, to_link_ndx); // Throws -} - -inline bool TransactLogEncoder::link_list_swap(size_t link1_ndx, size_t link2_ndx) -{ - append_simple_instr(instr_LinkListSwap, util::tuple(link1_ndx, link2_ndx)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::link_list_swap(const LinkView& list, size_t link1_ndx, size_t link2_ndx) -{ - select_link_list(list); // Throws - m_encoder.link_list_swap(link1_ndx, link2_ndx); // Throws -} - -inline bool TransactLogEncoder::link_list_erase(size_t link_ndx, size_t prior_size) -{ - append_simple_instr(instr_LinkListErase, util::tuple(link_ndx, prior_size)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::link_list_erase(const LinkView& list, size_t link_ndx) -{ - select_link_list(list); // Throws - size_t prior_size = list.size(); // The instruction is emitted before the fact. - m_encoder.link_list_erase(link_ndx, prior_size); // Throws -} - -inline bool TransactLogEncoder::link_list_clear(size_t old_list_size) -{ - append_simple_instr(instr_LinkListClear, util::tuple(old_list_size)); // Throws - return true; -} - -inline void TransactLogConvenientEncoder::on_table_destroyed(const Table* t) noexcept -{ - if (m_selected_table == t) - m_selected_table = nullptr; -} - -inline void TransactLogConvenientEncoder::on_spec_destroyed(const Spec* s) noexcept -{ - if (m_selected_spec == s) - m_selected_spec = nullptr; -} - - -inline void TransactLogConvenientEncoder::on_link_list_destroyed(const LinkView& list) noexcept -{ - const LinkView* lw_ptr = &list; - // atomically clear m_selected_link_list iff it already points to 'list': - // (lw_ptr will be modified if the swap fails, but we ignore that) - m_selected_link_list.compare_exchange_strong(lw_ptr, nullptr, std::memory_order_relaxed, - std::memory_order_relaxed); -} - - -inline TransactLogParser::TransactLogParser() - : m_input_buffer(1024) // Throws -{ -} - - -inline TransactLogParser::~TransactLogParser() noexcept -{ -} - - -template -void TransactLogParser::parse(NoCopyInputStream& in, InstructionHandler& handler) -{ - m_input = ∈ - m_input_begin = m_input_end = nullptr; - - while (has_next()) - parse_one(handler); // Throws -} - -template -void TransactLogParser::parse(InputStream& in, InstructionHandler& handler) -{ - NoCopyInputStreamAdaptor in_2(in, m_input_buffer.data(), m_input_buffer.size()); - parse(in_2, handler); // Throws -} - -inline bool TransactLogParser::has_next() noexcept -{ - return m_input_begin != m_input_end || next_input_buffer(); -} - -template -void TransactLogParser::parse_one(InstructionHandler& handler) -{ - char instr_ch; - if (!read_char(instr_ch)) - parser_error(); // Throws - // std::cerr << "parsing " << util::promote(instr) << " @ " << std::hex << long(m_input_begin) << std::dec << - // "\n"; - Instruction instr = Instruction(instr_ch); - switch (instr) { - case instr_SetDefault: - case instr_SetUnique: - case instr_Set: { - int type = read_int(); // Throws - size_t col_ndx = read_int(); // Throws - size_t row_ndx = read_int(); // Throws - size_t prior_num_rows = 0; - if (REALM_UNLIKELY(instr == instr_SetUnique)) - prior_num_rows = read_int(); // Throws - - if (type == TransactLogEncoder::set_null_sentinel()) { - // Special case for set_null - if (!handler.set_null(col_ndx, row_ndx, instr, prior_num_rows)) // Throws - parser_error(); - return; - } - - switch (DataType(type)) { - case type_Int: { - int_fast64_t value = read_int(); // Throws - if (!handler.set_int(col_ndx, row_ndx, value, instr, prior_num_rows)) // Throws - parser_error(); - return; - } - case type_Bool: { - bool value = read_bool(); // Throws - if (!handler.set_bool(col_ndx, row_ndx, value, instr)) // Throws - parser_error(); - return; - } - case type_Float: { - float value = read_float(); // Throws - if (!handler.set_float(col_ndx, row_ndx, value, instr)) // Throws - parser_error(); - return; - } - case type_Double: { - double value = read_double(); // Throws - if (!handler.set_double(col_ndx, row_ndx, value, instr)) // Throws - parser_error(); - return; - } - case type_String: { - StringData value = read_string(m_string_buffer); // Throws - if (!handler.set_string(col_ndx, row_ndx, value, instr, prior_num_rows)) // Throws - parser_error(); - return; - } - case type_Binary: { - BinaryData value = read_binary(m_string_buffer); // Throws - if (!handler.set_binary(col_ndx, row_ndx, value, instr)) // Throws - parser_error(); - return; - } - case type_OldDateTime: { - int_fast64_t value = read_int(); // Throws - if (!handler.set_olddatetime(col_ndx, row_ndx, value, instr)) // Throws - parser_error(); - return; - } - case type_Timestamp: { - int64_t seconds = read_int(); // Throws - int32_t nanoseconds = read_int(); // Throws - Timestamp value = Timestamp(seconds, nanoseconds); - if (!handler.set_timestamp(col_ndx, row_ndx, value, instr)) // Throws - parser_error(); - return; - } - case type_Table: { - if (!handler.set_table(col_ndx, row_ndx, instr)) // Throws - parser_error(); - return; - } - case type_Mixed: { - Mixed value; - read_mixed(&value); // Throws - if (!handler.set_mixed(col_ndx, row_ndx, value, instr)) // Throws - parser_error(); - return; - } - case type_Link: { - size_t value = read_int(); // Throws - // Map zero to realm::npos, and `n+1` to `n`, where `n` is a target row index. - size_t target_row_ndx = size_t(value - 1); - size_t target_group_level_ndx = read_int(); // Throws - if (!handler.set_link(col_ndx, row_ndx, target_row_ndx, target_group_level_ndx, instr)) // Throws - parser_error(); - return; - } - case type_LinkList: { - // Unsupported column type for Set. - parser_error(); - return; - } - } - parser_error(); - return; - } - case instr_AddInteger: { - size_t col_ndx = read_int(); // Throws - size_t row_ndx = read_int(); // Throws - int_fast64_t value = read_int(); // Throws - if (!handler.add_int(col_ndx, row_ndx, value)) // Throws - parser_error(); - return; - } - case instr_NullifyLink: { - size_t col_ndx = read_int(); // Throws - size_t row_ndx = read_int(); // Throws - size_t target_group_level_ndx = read_int(); // Throws - if (!handler.nullify_link(col_ndx, row_ndx, target_group_level_ndx)) // Throws - parser_error(); - return; - } - case instr_InsertSubstring: { - size_t col_ndx = read_int(); // Throws - size_t row_ndx = read_int(); // Throws - size_t pos = read_int(); // Throws - StringData value = read_string(m_string_buffer); // Throws - if (!handler.insert_substring(col_ndx, row_ndx, pos, value)) // Throws - parser_error(); - return; - } - case instr_EraseFromString: { - size_t col_ndx = read_int(); // Throws - size_t row_ndx = read_int(); // Throws - size_t pos = read_int(); // Throws - size_t size = read_int(); // Throws - if (!handler.erase_substring(col_ndx, row_ndx, pos, size)) // Throws - parser_error(); - return; - } - case instr_InsertEmptyRows: { - size_t row_ndx = read_int(); // Throws - size_t num_rows_to_insert = read_int(); // Throws - size_t prior_num_rows = read_int(); // Throws - bool unordered = read_bool(); // Throws - if (!handler.insert_empty_rows(row_ndx, num_rows_to_insert, prior_num_rows, unordered)) // Throws - parser_error(); - return; - } - case instr_EraseRows: { - size_t row_ndx = read_int(); // Throws - size_t num_rows_to_erase = read_int(); // Throws - size_t prior_num_rows = read_int(); // Throws - bool unordered = read_bool(); // Throws - if (!handler.erase_rows(row_ndx, num_rows_to_erase, prior_num_rows, unordered)) // Throws - parser_error(); - return; - } - case instr_SwapRows: { - size_t row_ndx_1 = read_int(); // Throws - size_t row_ndx_2 = read_int(); // Throws - if (!handler.swap_rows(row_ndx_1, row_ndx_2)) // Throws - parser_error(); - return; - } - case instr_MergeRows: { - size_t row_ndx = read_int(); // Throws - size_t new_row_ndx = read_int(); // Throws - if (!handler.merge_rows(row_ndx, new_row_ndx)) // Throws - parser_error(); - return; - } - case instr_SelectTable: { - int levels = read_int(); // Throws - if (levels < 0 || levels > m_max_levels) - parser_error(); - m_path.reserve(0, 2 * levels); // Throws - size_t* path = m_path.data(); - size_t group_level_ndx = read_int(); // Throws - for (int i = 0; i != levels; ++i) { - size_t col_ndx = read_int(); // Throws - size_t row_ndx = read_int(); // Throws - path[2 * i + 0] = col_ndx; - path[2 * i + 1] = row_ndx; - } - if (!handler.select_table(group_level_ndx, levels, path)) // Throws - parser_error(); - return; - } - case instr_ClearTable: { - if (!handler.clear_table()) // Throws - parser_error(); - return; - } - case instr_LinkListSet: { - size_t link_ndx = read_int(); // Throws - size_t value = read_int(); // Throws - size_t prior_size = read_int(); // Throws - if (!handler.link_list_set(link_ndx, value, prior_size)) // Throws - parser_error(); - return; - } - case instr_LinkListSetAll: { - // todo, log that it's a SetAll we're doing - size_t size = read_int(); // Throws - for (size_t i = 0; i < size; i++) { - size_t link = read_int(); // Throws - if (!handler.link_list_set(i, link, size)) // Throws - parser_error(); - } - return; - } - case instr_LinkListInsert: { - size_t link_ndx = read_int(); // Throws - size_t value = read_int(); // Throws - size_t prior_size = read_int(); // Throws - if (!handler.link_list_insert(link_ndx, value, prior_size)) // Throws - parser_error(); - return; - } - case instr_LinkListMove: { - size_t from_link_ndx = read_int(); // Throws - size_t to_link_ndx = read_int(); // Throws - if (!handler.link_list_move(from_link_ndx, to_link_ndx)) // Throws - parser_error(); - return; - } - case instr_LinkListSwap: { - size_t link1_ndx = read_int(); // Throws - size_t link2_ndx = read_int(); // Throws - if (!handler.link_list_swap(link1_ndx, link2_ndx)) // Throws - parser_error(); - return; - } - case instr_LinkListErase: { - size_t link_ndx = read_int(); // Throws - size_t prior_size = read_int(); // Throws - if (!handler.link_list_erase(link_ndx, prior_size)) // Throws - parser_error(); - return; - } - case instr_LinkListNullify: { - size_t link_ndx = read_int(); // Throws - size_t prior_size = read_int(); // Throws - if (!handler.link_list_nullify(link_ndx, prior_size)) // Throws - parser_error(); - return; - } - case instr_LinkListClear: { - size_t old_list_size = read_int(); // Throws - if (!handler.link_list_clear(old_list_size)) // Throws - parser_error(); - return; - } - case instr_SelectLinkList: { - size_t col_ndx = read_int(); // Throws - size_t row_ndx = read_int(); // Throws - size_t target_group_level_ndx = read_int(); // Throws - if (!handler.select_link_list(col_ndx, row_ndx, target_group_level_ndx)) // Throws - parser_error(); - return; - } - case instr_AddSearchIndex: { - size_t col_ndx = read_int(); // Throws - if (!handler.add_search_index(col_ndx)) // Throws - parser_error(); - return; - } - case instr_RemoveSearchIndex: { - size_t col_ndx = read_int(); // Throws - if (!handler.remove_search_index(col_ndx)) // Throws - parser_error(); - return; - } - case instr_SetLinkType: { - size_t col_ndx = read_int(); // Throws - int link_type = read_int(); // Throws - if (!is_valid_link_type(link_type)) - parser_error(); - if (!handler.set_link_type(col_ndx, LinkType(link_type))) // Throws - parser_error(); - return; - } - case instr_InsertColumn: - case instr_InsertNullableColumn: { - size_t col_ndx = read_int(); // Throws - int type = read_int(); // Throws - if (!is_valid_data_type(type)) - parser_error(); - if (REALM_UNLIKELY(type == type_Link || type == type_LinkList)) - parser_error(); - StringData name = read_string(m_string_buffer); // Throws - bool nullable = (Instruction(instr) == instr_InsertNullableColumn); - if (REALM_UNLIKELY(nullable && (type == type_Table || type == type_Mixed))) { - // Nullability not supported for Table and Mixed columns. - parser_error(); - } - if (!handler.insert_column(col_ndx, DataType(type), name, nullable)) // Throws - parser_error(); - return; - } - case instr_InsertLinkColumn: { - size_t col_ndx = read_int(); // Throws - int type = read_int(); // Throws - if (!is_valid_data_type(type)) - parser_error(); - if (REALM_UNLIKELY(type != type_Link && type != type_LinkList)) - parser_error(); - size_t link_target_table_ndx = read_int(); // Throws - size_t backlink_col_ndx = read_int(); // Throws - StringData name = read_string(m_string_buffer); // Throws - if (!handler.insert_link_column(col_ndx, DataType(type), name, link_target_table_ndx, - backlink_col_ndx)) // Throws - parser_error(); - return; - } - case instr_EraseColumn: { - size_t col_ndx = read_int(); // Throws - if (!handler.erase_column(col_ndx)) // Throws - parser_error(); - return; - } - case instr_EraseLinkColumn: { - size_t col_ndx = read_int(); // Throws - size_t link_target_table_ndx = read_int(); // Throws - size_t backlink_col_ndx = read_int(); // Throws - if (!handler.erase_link_column(col_ndx, link_target_table_ndx, backlink_col_ndx)) // Throws - parser_error(); - return; - } - case instr_RenameColumn: { - size_t col_ndx = read_int(); // Throws - StringData name = read_string(m_string_buffer); // Throws - if (!handler.rename_column(col_ndx, name)) // Throws - parser_error(); - return; - } - case instr_MoveColumn: { - size_t col_ndx_1 = read_int(); // Throws - size_t col_ndx_2 = read_int(); // Throws - if (!handler.move_column(col_ndx_1, col_ndx_2)) // Throws - parser_error(); - return; - } - case instr_SelectDescriptor: { - int levels = read_int(); // Throws - if (levels < 0 || levels > m_max_levels) - parser_error(); - m_path.reserve(0, levels); // Throws - size_t* path = m_path.data(); - for (int i = 0; i != levels; ++i) { - size_t col_ndx = read_int(); // Throws - path[i] = col_ndx; - } - if (!handler.select_descriptor(levels, path)) // Throws - parser_error(); - return; - } - case instr_InsertGroupLevelTable: { - size_t table_ndx = read_int(); // Throws - size_t num_tables = read_int(); // Throws - StringData name = read_string(m_string_buffer); // Throws - if (!handler.insert_group_level_table(table_ndx, num_tables, name)) // Throws - parser_error(); - return; - } - case instr_EraseGroupLevelTable: { - size_t table_ndx = read_int(); // Throws - size_t prior_num_tables = read_int(); // Throws - if (!handler.erase_group_level_table(table_ndx, prior_num_tables)) // Throws - parser_error(); - return; - } - case instr_RenameGroupLevelTable: { - size_t table_ndx = read_int(); // Throws - StringData new_name = read_string(m_string_buffer); // Throws - if (!handler.rename_group_level_table(table_ndx, new_name)) // Throws - parser_error(); - return; - } - case instr_MoveGroupLevelTable: { - size_t from_table_ndx = read_int(); // Throws - size_t to_table_ndx = read_int(); // Throws - if (!handler.move_group_level_table(from_table_ndx, to_table_ndx)) // Throws - parser_error(); - return; - } - case instr_OptimizeTable: { - if (!handler.optimize_table()) // Throws - parser_error(); - return; - } - } - - throw BadTransactLog(); -} - - -template -T TransactLogParser::read_int() -{ - T value = 0; - int part = 0; - const int max_bytes = (std::numeric_limits::digits + 1 + 6) / 7; - for (int i = 0; i != max_bytes; ++i) { - char c; - if (!read_char(c)) - goto bad_transact_log; - part = static_cast(c); - if (0xFF < part) - goto bad_transact_log; // Only the first 8 bits may be used in each byte - if ((part & 0x80) == 0) { - T p = part & 0x3F; - if (util::int_shift_left_with_overflow_detect(p, i * 7)) - goto bad_transact_log; - value |= p; - break; - } - if (i == max_bytes - 1) - goto bad_transact_log; // Too many bytes - value |= T(part & 0x7F) << (i * 7); - } - if (part & 0x40) { - // The real value is negative. Because 'value' is positive at - // this point, the following negation is guaranteed by C++11 - // to never overflow. See C99+TC3 section 6.2.6.2 paragraph 2. - REALM_DIAG_PUSH(); - REALM_DIAG_IGNORE_UNSIGNED_MINUS(); - value = -value; - REALM_DIAG_POP(); - if (util::int_subtract_with_overflow_detect(value, 1)) - goto bad_transact_log; - } - return value; - -bad_transact_log: - throw BadTransactLog(); -} - - -inline void TransactLogParser::read_bytes(char* data, size_t size) -{ - for (;;) { - const size_t avail = m_input_end - m_input_begin; - if (size <= avail) - break; - std::copy_n(m_input_begin, avail, data); - if (!next_input_buffer()) - throw BadTransactLog(); - data += avail; - size -= avail; - } - const char* to = m_input_begin + size; - std::copy_n(m_input_begin, size, data); - m_input_begin = to; -} - - -inline BinaryData TransactLogParser::read_buffer(util::StringBuffer& buf, size_t size) -{ - const size_t avail = m_input_end - m_input_begin; - if (avail >= size) { - m_input_begin += size; - return BinaryData(m_input_begin - size, size); - } - - buf.clear(); - buf.resize(size); // Throws - read_bytes(buf.data(), size); - return BinaryData(buf.data(), size); -} - - -inline bool TransactLogParser::read_bool() -{ - return read_int(); -} - - -inline float TransactLogParser::read_float() -{ - static_assert(std::numeric_limits::is_iec559 && - sizeof(float) * std::numeric_limits::digits == 32, - "Unsupported 'float' representation"); - float value; - read_bytes(reinterpret_cast(&value), sizeof value); // Throws - return value; -} - - -inline double TransactLogParser::read_double() -{ - static_assert(std::numeric_limits::is_iec559 && - sizeof(double) * std::numeric_limits::digits == 64, - "Unsupported 'double' representation"); - double value; - read_bytes(reinterpret_cast(&value), sizeof value); // Throws - return value; -} - - -inline StringData TransactLogParser::read_string(util::StringBuffer& buf) -{ - size_t size = read_int(); // Throws - - if (size > Table::max_string_size) - parser_error(); - - BinaryData buffer = read_buffer(buf, size); - return StringData{buffer.data(), size}; -} - -inline Timestamp TransactLogParser::read_timestamp() -{ - REALM_ASSERT(false); - return Timestamp{}; -} - - -inline BinaryData TransactLogParser::read_binary(util::StringBuffer& buf) -{ - size_t size = read_int(); // Throws - - if (size > ArrayBlob::max_binary_size) - parser_error(); - - return read_buffer(buf, size); -} - - -inline void TransactLogParser::read_mixed(Mixed* mixed) -{ - DataType type = DataType(read_int()); // Throws - switch (type) { - case type_Int: { - int_fast64_t value = read_int(); // Throws - mixed->set_int(value); - return; - } - case type_Bool: { - bool value = read_bool(); // Throws - mixed->set_bool(value); - return; - } - case type_Float: { - float value = read_float(); // Throws - mixed->set_float(value); - return; - } - case type_Double: { - double value = read_double(); // Throws - mixed->set_double(value); - return; - } - case type_OldDateTime: { - int_fast64_t value = read_int(); // Throws - mixed->set_olddatetime(value); - return; - } - case type_Timestamp: { - Timestamp value = read_timestamp(); // Throws - mixed->set_timestamp(value); - return; - } - case type_String: { - StringData value = read_string(m_string_buffer); // Throws - mixed->set_string(value); - return; - } - case type_Binary: { - BinaryData value = read_binary(m_string_buffer); // Throws - mixed->set_binary(value); - return; - } - case type_Table: { - *mixed = Mixed::subtable_tag(); - return; - } - case type_Mixed: - break; - case type_Link: - case type_LinkList: - // FIXME: Need to handle new link types here - break; - } - throw BadTransactLog(); -} - - -inline bool TransactLogParser::next_input_buffer() -{ - return m_input->next_block(m_input_begin, m_input_end); -} - - -inline bool TransactLogParser::read_char(char& c) -{ - if (m_input_begin == m_input_end && !next_input_buffer()) - return false; - c = *m_input_begin++; - return true; -} - - -inline bool TransactLogParser::is_valid_data_type(int type) -{ - switch (DataType(type)) { - case type_Int: - case type_Bool: - case type_Float: - case type_Double: - case type_String: - case type_Binary: - case type_OldDateTime: - case type_Timestamp: - case type_Table: - case type_Mixed: - case type_Link: - case type_LinkList: - return true; - } - return false; -} - - -inline bool TransactLogParser::is_valid_link_type(int type) -{ - switch (LinkType(type)) { - case link_Strong: - case link_Weak: - return true; - } - return false; -} - - -class TransactReverser { -public: - bool select_table(size_t group_level_ndx, size_t levels, const size_t* path) - { - sync_table(); - m_encoder.select_table(group_level_ndx, levels, path); - m_pending_ts_instr = get_inst(); - return true; - } - - bool select_descriptor(size_t levels, const size_t* path) - { - sync_descriptor(); - m_encoder.select_descriptor(levels, path); - m_pending_ds_instr = get_inst(); - return true; - } - - bool insert_group_level_table(size_t table_ndx, size_t num_tables, StringData) - { - sync_table(); - m_encoder.erase_group_level_table(table_ndx, num_tables + 1); - append_instruction(); - return true; - } - - bool erase_group_level_table(size_t table_ndx, size_t num_tables) - { - sync_table(); - m_encoder.insert_group_level_table(table_ndx, num_tables - 1, ""); - append_instruction(); - return true; - } - - bool rename_group_level_table(size_t, StringData) - { - sync_table(); - return true; - } - - bool move_group_level_table(size_t from_table_ndx, size_t to_table_ndx) - { - sync_table(); - m_encoder.move_group_level_table(to_table_ndx, from_table_ndx); - append_instruction(); - return true; - } - - bool optimize_table() - { - return true; // No-op - } - - bool insert_empty_rows(size_t row_ndx, size_t num_rows_to_insert, size_t prior_num_rows, bool unordered) - { - size_t num_rows_to_erase = num_rows_to_insert; - size_t prior_num_rows_2 = prior_num_rows + num_rows_to_insert; - m_encoder.erase_rows(row_ndx, num_rows_to_erase, prior_num_rows_2, unordered); // Throws - append_instruction(); - return true; - } - - bool erase_rows(size_t row_ndx, size_t num_rows_to_erase, size_t prior_num_rows, bool unordered) - { - size_t num_rows_to_insert = num_rows_to_erase; - // Number of rows in table after removal, but before inverse insertion - size_t prior_num_rows_2 = prior_num_rows - num_rows_to_erase; - m_encoder.insert_empty_rows(row_ndx, num_rows_to_insert, prior_num_rows_2, unordered); // Throws - append_instruction(); - return true; - } - - bool swap_rows(size_t row_ndx_1, size_t row_ndx_2) - { - m_encoder.swap_rows(row_ndx_1, row_ndx_2); - append_instruction(); - return true; - } - - bool merge_rows(size_t row_ndx, size_t new_row_ndx) - { - static_cast(row_ndx); - static_cast(new_row_ndx); - // There is no instruction we can generate here to change back. - return true; - } - - bool set_int(size_t col_ndx, size_t row_ndx, int_fast64_t value, Instruction variant, size_t prior_num_rows) - { - m_encoder.set_int(col_ndx, row_ndx, value, variant, prior_num_rows); - append_instruction(); - return true; - } - - bool add_int(size_t col_ndx, size_t row_ndx, int_fast64_t value) - { - m_encoder.add_int(col_ndx, row_ndx, -value); - append_instruction(); - return true; - } - - bool set_bool(size_t col_ndx, size_t row_ndx, bool value, Instruction variant) - { - m_encoder.set_bool(col_ndx, row_ndx, value, variant); - append_instruction(); - return true; - } - - bool set_float(size_t col_ndx, size_t row_ndx, float value, Instruction variant) - { - m_encoder.set_float(col_ndx, row_ndx, value, variant); - append_instruction(); - return true; - } - - bool set_double(size_t col_ndx, size_t row_ndx, double value, Instruction variant) - { - m_encoder.set_double(col_ndx, row_ndx, value, variant); - append_instruction(); - return true; - } - - bool set_string(size_t col_ndx, size_t row_ndx, StringData value, Instruction variant, size_t prior_num_rows) - { - m_encoder.set_string(col_ndx, row_ndx, value, variant, prior_num_rows); - append_instruction(); - return true; - } - - bool set_binary(size_t col_ndx, size_t row_ndx, BinaryData value, Instruction variant) - { - m_encoder.set_binary(col_ndx, row_ndx, value, variant); - append_instruction(); - return true; - } - - bool set_olddatetime(size_t col_ndx, size_t row_ndx, OldDateTime value, Instruction variant) - { - m_encoder.set_olddatetime(col_ndx, row_ndx, value, variant); - append_instruction(); - return true; - } - - bool set_timestamp(size_t col_ndx, size_t row_ndx, Timestamp value, Instruction variant) - { - m_encoder.set_timestamp(col_ndx, row_ndx, value, variant); - append_instruction(); - return true; - } - - bool set_table(size_t col_ndx, size_t row_ndx, Instruction variant) - { - m_encoder.set_table(col_ndx, row_ndx, variant); - append_instruction(); - return true; - } - - bool set_mixed(size_t col_ndx, size_t row_ndx, const Mixed& value, Instruction variant) - { - m_encoder.set_mixed(col_ndx, row_ndx, value, variant); - append_instruction(); - return true; - } - - bool set_null(size_t col_ndx, size_t row_ndx, Instruction variant, size_t prior_num_rows) - { - m_encoder.set_null(col_ndx, row_ndx, variant, prior_num_rows); - append_instruction(); - return true; - } - - bool set_link(size_t col_ndx, size_t row_ndx, size_t value, size_t target_group_level_ndx, Instruction variant) - { - m_encoder.set_link(col_ndx, row_ndx, value, target_group_level_ndx, variant); - append_instruction(); - return true; - } - - bool insert_substring(size_t, size_t, size_t, StringData) - { - return true; // No-op - } - - bool erase_substring(size_t, size_t, size_t, size_t) - { - return true; // No-op - } - - bool clear_table() - { - // FIXME: Add a comment on why we call insert_empty_rows() inside clear_table() - m_encoder.insert_empty_rows(0, 0, 0, true); - append_instruction(); - return true; - } - - bool add_search_index(size_t) - { - return true; // No-op - } - - bool remove_search_index(size_t) - { - return true; // No-op - } - - bool set_link_type(size_t, LinkType) - { - return true; // No-op - } - - bool insert_link_column(size_t col_idx, DataType, StringData, size_t target_table_idx, size_t backlink_col_ndx) - { - m_encoder.erase_link_column(col_idx, target_table_idx, backlink_col_ndx); - append_instruction(); - return true; - } - - bool erase_link_column(size_t col_idx, size_t target_table_idx, size_t backlink_col_idx) - { - DataType type = type_Link; // The real type of the column doesn't matter here, - // but the encoder asserts that it's actually a link type. - m_encoder.insert_link_column(col_idx, type, "", target_table_idx, backlink_col_idx); - append_instruction(); - return true; - } - - bool insert_column(size_t col_idx, DataType, StringData, bool) - { - m_encoder.erase_column(col_idx); - append_instruction(); - return true; - } - - bool erase_column(size_t col_idx) - { - m_encoder.insert_column(col_idx, DataType(), ""); - append_instruction(); - return true; - } - - bool rename_column(size_t, StringData) - { - return true; // No-op - } - - bool move_column(size_t col_ndx_1, size_t col_ndx_2) - { - m_encoder.move_column(col_ndx_2, col_ndx_1); - append_instruction(); - return true; - } - - bool select_link_list(size_t col_ndx, size_t row_ndx, size_t link_target_group_level_ndx) - { - sync_linkview(); - m_encoder.select_link_list(col_ndx, row_ndx, link_target_group_level_ndx); - m_pending_lv_instr = get_inst(); - return true; - } - - bool link_list_set(size_t row, size_t value, size_t prior_size) - { - m_encoder.link_list_set(row, value, prior_size); - append_instruction(); - return true; - } - - bool link_list_insert(size_t link_ndx, size_t, size_t prior_size) - { - m_encoder.link_list_erase(link_ndx, prior_size + 1); - append_instruction(); - return true; - } - - bool link_list_move(size_t from_link_ndx, size_t to_link_ndx) - { - m_encoder.link_list_move(from_link_ndx, to_link_ndx); - append_instruction(); - return true; - } - - bool link_list_swap(size_t link1_ndx, size_t link2_ndx) - { - m_encoder.link_list_swap(link1_ndx, link2_ndx); - append_instruction(); - return true; - } - - bool link_list_erase(size_t link_ndx, size_t prior_size) - { - m_encoder.link_list_insert(link_ndx, 0, prior_size - 1); - append_instruction(); - return true; - } - - bool link_list_clear(size_t old_list_size) - { - // Append in reverse order because the reversed log is itself applied - // in reverse, and this way it generates all back-insertions rather than - // all front-insertions - for (size_t i = old_list_size; i > 0; --i) { - m_encoder.link_list_insert(i - 1, 0, old_list_size - i); - append_instruction(); - } - return true; - } - - bool nullify_link(size_t col_ndx, size_t row_ndx, size_t target_group_level_ndx) - { - size_t value = 0; - // FIXME: Is zero this right value to pass here, or should - // TransactReverser::nullify_link() also have taken a - // `target_group_level_ndx` argument. - m_encoder.set_link(col_ndx, row_ndx, value, target_group_level_ndx); - append_instruction(); - return true; - } - - bool link_list_nullify(size_t link_ndx, size_t prior_size) - { - m_encoder.link_list_insert(link_ndx, 0, prior_size - 1); - append_instruction(); - return true; - } - -private: - _impl::TransactLogBufferStream m_buffer; - _impl::TransactLogEncoder m_encoder{m_buffer}; - struct Instr { - size_t begin; - size_t end; - }; - std::vector m_instructions; - size_t current_instr_start = 0; - Instr m_pending_ts_instr{0, 0}; - Instr m_pending_ds_instr{0, 0}; - Instr m_pending_lv_instr{0, 0}; - - Instr get_inst() - { - Instr instr; - instr.begin = current_instr_start; - current_instr_start = transact_log_size(); - instr.end = current_instr_start; - return instr; - } - - size_t transact_log_size() const - { - REALM_ASSERT_3(m_encoder.write_position(), >=, m_buffer.transact_log_data()); - return m_encoder.write_position() - m_buffer.transact_log_data(); - } - - void append_instruction() - { - m_instructions.push_back(get_inst()); - } - - void append_instruction(Instr instr) - { - m_instructions.push_back(instr); - } - - void sync_select(Instr& pending_instr) - { - if (pending_instr.begin != pending_instr.end) { - append_instruction(pending_instr); - pending_instr = {0, 0}; - } - } - - void sync_linkview() - { - sync_select(m_pending_lv_instr); - } - - void sync_descriptor() - { - sync_linkview(); - sync_select(m_pending_ds_instr); - } - - void sync_table() - { - sync_descriptor(); - sync_select(m_pending_ts_instr); - } - - friend class ReversedNoCopyInputStream; -}; - - -class ReversedNoCopyInputStream : public NoCopyInputStream { -public: - ReversedNoCopyInputStream(TransactReverser& reverser) - : m_instr_order(reverser.m_instructions) - { - // push any pending select_table or select_descriptor into the buffer - reverser.sync_table(); - - m_buffer = reverser.m_buffer.transact_log_data(); - m_current = m_instr_order.size(); - } - - bool next_block(const char*& begin, const char*& end) override - { - if (m_current != 0) { - m_current--; - begin = m_buffer + m_instr_order[m_current].begin; - end = m_buffer + m_instr_order[m_current].end; - return (end > begin); - } - return false; - } - -private: - const char* m_buffer; - std::vector& m_instr_order; - size_t m_current; -}; - -} // namespace _impl -} // namespace realm - -#endif // REALM_IMPL_TRANSACT_LOG_HPP diff --git a/Pods/Realm/include/core/realm/importer.hpp b/Pods/Realm/include/core/realm/importer.hpp deleted file mode 100644 index 9ef54dc2..00000000 --- a/Pods/Realm/include/core/realm/importer.hpp +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_IMPORTER_HPP -#define REALM_IMPORTER_HPP - -/* -Main method: import_csv(). Arguments: ---------------------------------------------------------------------------------------------------------------------- -empty_as_string_flag: - Imports a column that has occurences of empty strings as String type column. Else fields arec onverted to - false/0/0.0 - -type_detection_rows: - tells how many rows to read before analyzing data types (to see if numeric rows are really - numeric everywhere, and not strings that happen to just mostly contain numeric characters - - -This library supports: ---------------------------------------------------------------------------------------------------------------------- - * Auto detection of float vs. double, depending on number of significant digits - * Bool types can be case insensitive "true, false, 0, 1, yes, no" - * Newline inside data fields, plus auto detection of non-conforming non-quoted newlines (as in some IBM sample - files) - * Realm types String, Integer, Bool, Float and Double - * Auto detection of header and naming of Realm columns accordingly - * double-quoted and non-quoted fields, and these can be mixed arbitrarely - * double-quotes inside data field - * *nix + MacOSv9 + Windows line feed - * Scientific notation of floats/doubles (+1.23e-10) - * Comma in floats - but ONLY if field is double-quoted - * FAST FAST FAST (200 MB/s). Uses state-machine instead of traditional char-by-char loop with state checks inside - - -Problems: ---------------------------------------------------------------------------------------------------------------------- - A csv file does not tell its sheme. So we auto-detect it, based on the first N rows. However if a given column - contains 'false, false, false, hello' and we detect and create Realm table scheme using the first 3 rows, we fail - when we meet 'hello' (this error is handled with a thorough error message) - - Does not support commas in floats unless field is double-quoted - - -Design: ---------------------------------------------------------------------------------------------------------------------- - -import_csv(csv file handle, realm table) - Calls tokenize(csv file handle): - reads payload chunk and returns std::vector> with the right dimensions filled with - rows and columns of the chunk payload - Calls parse_float(), parse_bool(), etc, which tests for type and returns converted values - Calls table.add_empty_row(), table.set_float(), table.set_bool() -*/ - -#include - -// Disk read chunk size. This MUST be large enough to contain at least TWO rows of csv plaintext! It's a good idea -// to set it as low as ever possible (like 32 K) even though it's counter-intuitive with respect to performance. It -// will make the operating system read 32 K from disk and return it, and then read-ahead 32-64 K more after fread() -// has returned. This read-ahead behaviour does NOT occur if we request megabyte-sized chunks (observed on Windows 7 / -// Ubuntu) -static const size_t chunk_size = 32 * 1024; - -// Number of rows to csv-parse + insert into realm in each iteration. -static const size_t record_chunks = 100; - -// Width of each column when printing them on screen (non-Quiet mode) -const size_t print_width = 25; - -#include -#include - -namespace realm { - -class Importer { -public: - Importer(); - size_t import_csv_auto(FILE* file, Table& table, size_t type_detection_rows = 1000, - size_t import_rows = static_cast(-1)); - - size_t import_csv_manual(FILE* file, Table& table, std::vector scheme, - std::vector column_names, size_t skip_first_rows = 0, - size_t import_rows = static_cast(-1)); - - bool Quiet; // Quiet mode, only print to screen upon errors - char Separator; // csv delimitor/separator - bool Empty_as_string; // Import columns that have occurences of empty strings as String type column - -private: - size_t import_csv(FILE* file, Table& table, std::vector* import_scheme, - std::vector* column_names, size_t type_detection_rows, size_t skip_first_rows, - size_t import_rows); - template - float parse_float(const char* col, bool* success = nullptr); - template - double parse_double(const char* col, bool* success = nullptr, size_t* significants = nullptr); - template - int64_t parse_integer(const char* col, bool* success = nullptr); - template - bool parse_bool(const char* col, bool* success = nullptr); - std::vector types(std::vector v); - size_t tokenize(std::vector>& payload, size_t records); - std::vector detect_scheme(std::vector> payload, size_t begin, size_t end); - std::vector lowest_common(std::vector types1, std::vector types2); - - char src[2 * chunk_size]; // .csv input buffer - size_t m_top; // points at top of buffer - size_t m_curpos; // points at next byte to parse - FILE* m_file; // handle to .csv file - size_t m_fields; // number of fields in each row - size_t m_row; // current row in .csv file, including field-embedded line breaks. Used for err msg only -}; - -} // namespace realm - -#endif // REALM_IMPORTER_HPP diff --git a/Pods/Realm/include/core/realm/index_string.hpp b/Pods/Realm/include/core/realm/index_string.hpp deleted file mode 100644 index 76cb68c7..00000000 --- a/Pods/Realm/include/core/realm/index_string.hpp +++ /dev/null @@ -1,607 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_INDEX_STRING_HPP -#define REALM_INDEX_STRING_HPP - -#include -#include -#include - -#include -#include - -/* -The StringIndex class is used for both type_String and all integral types, such as type_Bool, type_OldDateTime and -type_Int. When used for integral types, the 64-bit integer is simply casted to a string of 8 bytes through a -pretty simple "wrapper layer" in all public methods. - -The StringIndex data structure is like an "inversed" B+ tree where the leafs contain row indexes and the non-leafs -contain 4-byte chunks of payload. Imagine a table with following strings: - - hello, kitty, kitten, foobar, kitty, foobar - -The topmost level of the index tree contains prefixes of the payload strings of length <= 4. The next level contains -prefixes of the remaining parts of the strings. Unnecessary levels of the tree are optimized away; the prefix "foob" -is shared only by rows that are identical ("foobar"), so "ar" is not needed to be stored in the tree. - - hell kitt foob - | /\ | - 0 en y {3, 5} - | \ - {1, 4} 2 - -Each non-leafs consists of two integer arrays of the same length, one containing payload and the other containing -references to the sublevel nodes. - -The leafs can be either a single value or a Column. If the reference in its parent node has its least significant -bit set, then the remaining upper bits specify the row index at which the string is stored. If the bit is clear, -it must be interpreted as a reference to a Column that stores the row indexes at which the string is stored. - -If a Column is used, then all row indexes are guaranteed to be sorted increasingly, which means you an search in it -using our binary search functions such as upper_bound() and lower_bound(). Each duplicate value will be stored in -the same Column, but Columns may contain more than just duplicates if the depth of the tree exceeds the value -`s_max_offset` This is to avoid stack overflow problems with many of our recursive functions if we have two very -long strings that have a long common prefix but differ in the last couple bytes. If a Column stores more than just -duplicates, then the list is kept sorted in ascending order by string value and within the groups of common -strings, the rows are sorted in ascending order. -*/ - -namespace realm { - -class Spec; -class Timestamp; - -class IndexArray : public Array { -public: - IndexArray(Allocator& allocator) - : Array(allocator) - { - } - - size_t index_string_find_first(StringData value, ColumnBase* column) const; - void index_string_find_all(IntegerColumn& result, StringData value, ColumnBase* column) const; - FindRes index_string_find_all_no_copy(StringData value, ColumnBase* column, InternalFindResult& result) const; - size_t index_string_count(StringData value, ColumnBase* column) const; - -private: - template - size_t from_list(StringData value, IntegerColumn& result, InternalFindResult& result_ref, - const IntegerColumn& rows, ColumnBase* column) const; - - template - size_t index_string(StringData value, IntegerColumn& result, InternalFindResult& result_ref, - ColumnBase* column) const; -}; - - -class StringIndex { -public: - StringIndex(ColumnBase* target_column, Allocator&); - StringIndex(ref_type, ArrayParent*, size_t ndx_in_parent, ColumnBase* target_column, bool allow_duplicate_values, - Allocator&); - ~StringIndex() noexcept - { - } - void set_target(ColumnBase* target_column) noexcept; - - // Accessor concept: - Allocator& get_alloc() const noexcept; - void destroy() noexcept; - void detach(); - bool is_attached() const noexcept; - void set_parent(ArrayParent* parent, size_t ndx_in_parent) noexcept; - size_t get_ndx_in_parent() const noexcept; - void set_ndx_in_parent(size_t ndx_in_parent) noexcept; - void update_from_parent(size_t old_baseline) noexcept; - void refresh_accessor_tree(size_t, const Spec&); - ref_type get_ref() const noexcept; - - // StringIndex interface: - - // 12 is the biggest element size of any non-string/binary Realm type - static const size_t string_conversion_buffer_size = 12; - using StringConversionBuffer = std::array; - - bool is_empty() const; - - template - void insert(size_t row_ndx, T value, size_t num_rows, bool is_append); - template - void insert(size_t row_ndx, util::Optional value, size_t num_rows, bool is_append); - - template - void set(size_t row_ndx, T new_value); - template - void set(size_t row_ndx, util::Optional new_value); - - template - void erase(size_t row_ndx, bool is_last); - - template - size_t find_first(T value) const; - template - void find_all(IntegerColumn& result, T value) const; - template - FindRes find_all_no_copy(T value, InternalFindResult& result) const; - template - size_t count(T value) const; - template - void update_ref(T value, size_t old_row_ndx, size_t new_row_ndx); - - void clear(); - - void distinct(IntegerColumn& result) const; - bool has_duplicate_values() const noexcept; - - /// By default, duplicate values are allowed. - void set_allow_duplicate_values(bool) noexcept; - - void verify() const; -#ifdef REALM_DEBUG - void verify_entries(const StringColumn& column) const; - void do_dump_node_structure(std::ostream&, int) const; - void to_dot() const; - void to_dot(std::ostream&, StringData title = StringData()) const; -#endif - - typedef int32_t key_type; - - // s_max_offset specifies the number of levels of recursive string indexes - // allowed before storing everything in lists. This is to avoid nesting - // to too deep of a level. Since every SubStringIndex stores 4 bytes, this - // means that a StringIndex is helpful for strings of a common prefix up to - // 4 times this limit (200 bytes shared). Lists are stored in sorted order, - // so strings sharing a common prefix of more than this limit will use a - // binary search of approximate complexity log2(n) from `std::lower_bound`. - static const size_t s_max_offset = 200; // max depth * s_index_key_length - static const size_t s_index_key_length = 4; - static key_type create_key(StringData) noexcept; - static key_type create_key(StringData, size_t) noexcept; - -private: - // m_array is a compact representation for storing the children of this StringIndex. - // Children can be: - // 1) a row number - // 2) a reference to a list which stores row numbers (for duplicate strings). - // 3) a reference to a sub-index - // m_array[0] is always a reference to a values array which stores the 4 byte chunk - // of payload data for quick string chunk comparisons. The array stored - // at m_array[0] lines up with the indices of values in m_array[1] so for example - // starting with an empty StringIndex: - // StringColumn::insert(target_row_ndx=42, value="test_string") would result with - // get_array_from_ref(m_array[0])[0] == create_key("test") and - // m_array[1] == 42 - // In this way, m_array which stores one child has a size of two. - // Children are type 1 (row number) if the LSB of the value is set. - // To get the actual row value, shift value down by one. - // If the LSB of the value is 0 then the value is a reference and can be either - // type 2, or type 3 (no shifting in either case). - // References point to a list if the context header flag is NOT set. - // If the header flag is set, references point to a sub-StringIndex (nesting). - std::unique_ptr m_array; - ColumnBase* m_target_column; - bool m_deny_duplicate_values; - - struct inner_node_tag { - }; - StringIndex(inner_node_tag, Allocator&); - - static IndexArray* create_node(Allocator&, bool is_leaf); - - void insert_with_offset(size_t row_ndx, StringData value, size_t offset); - void insert_row_list(size_t ref, size_t offset, StringData value); - void insert_to_existing_list(size_t row, StringData value, IntegerColumn& list); - void insert_to_existing_list_at_lower(size_t row, StringData value, IntegerColumn& list, - const IntegerColumnIterator& lower); - key_type get_last_key() const; - - /// Add small signed \a diff to all elements that are greater than, or equal - /// to \a min_row_ndx. - void adjust_row_indexes(size_t min_row_ndx, int diff); - - struct NodeChange { - size_t ref1; - size_t ref2; - enum ChangeType { none, insert_before, insert_after, split } type; - NodeChange(ChangeType t, size_t r1 = 0, size_t r2 = 0) - : ref1(r1) - , ref2(r2) - , type(t) - { - } - NodeChange() - : ref1(0) - , ref2(0) - , type(none) - { - } - }; - - // B-Tree functions - void TreeInsert(size_t row_ndx, key_type, size_t offset, StringData value); - NodeChange do_insert(size_t ndx, key_type, size_t offset, StringData value); - /// Returns true if there is room or it can join existing entries - bool leaf_insert(size_t row_ndx, key_type, size_t offset, StringData value, bool noextend = false); - void node_insert_split(size_t ndx, size_t new_ref); - void node_insert(size_t ndx, size_t ref); - void do_delete(size_t ndx, StringData, size_t offset); - void do_update_ref(StringData value, size_t row_ndx, size_t new_row_ndx, size_t offset); - - StringData get(size_t ndx, StringConversionBuffer& buffer) const; - - void node_add_key(ref_type ref); - -#ifdef REALM_DEBUG - static void dump_node_structure(const Array& node, std::ostream&, int level); - void to_dot_2(std::ostream&, StringData title = StringData()) const; - static void array_to_dot(std::ostream&, const Array&); - static void keys_to_dot(std::ostream&, const Array&, StringData title = StringData()); -#endif -}; - - -class SortedListComparator { -public: - SortedListComparator(ColumnBase& column_values); - bool operator()(int64_t ndx, StringData needle); - bool operator()(StringData needle, int64_t ndx); - -private: - ColumnBase& values; -}; - - -// Implementation: - -template -struct GetIndexData; - -template <> -struct GetIndexData { - static StringData get_index_data(const int64_t& value, StringIndex::StringConversionBuffer& buffer) - { - const char* c = reinterpret_cast(&value); - std::copy_n(c, sizeof(int64_t), buffer.data()); - return StringData{buffer.data(), sizeof(int64_t)}; - } -}; - -template <> -struct GetIndexData { - static StringData get_index_data(StringData data, StringIndex::StringConversionBuffer&) - { - return data; - } -}; - -template <> -struct GetIndexData { - static StringData get_index_data(null, StringIndex::StringConversionBuffer&) - { - return null{}; - } -}; - -template <> -struct GetIndexData { - static StringData get_index_data(const Timestamp&, StringIndex::StringConversionBuffer&); -}; - -template -struct GetIndexData> { - static StringData get_index_data(const util::Optional& value, StringIndex::StringConversionBuffer& buffer) - { - if (value) - return GetIndexData::get_index_data(*value, buffer); - return null{}; - } -}; - -template <> -struct GetIndexData { - static StringData get_index_data(float, StringIndex::StringConversionBuffer&) - { - REALM_ASSERT_RELEASE(false); // LCOV_EXCL_LINE; Index on float not supported - } -}; - -template <> -struct GetIndexData { - static StringData get_index_data(double, StringIndex::StringConversionBuffer&) - { - REALM_ASSERT_RELEASE(false); // LCOV_EXCL_LINE; Index on float not supported - } -}; - -template <> -struct GetIndexData : GetIndexData { -}; - -// to_str() is used by the integer index. The existing StringIndex is re-used for this -// by making IntegerColumn convert its integers to strings by calling to_str(). - -template -inline StringData to_str(T&& value, StringIndex::StringConversionBuffer& buffer) -{ - return GetIndexData::type>::get_index_data(value, buffer); -} - - -inline StringIndex::StringIndex(ColumnBase* target_column, Allocator& alloc) - : m_array(create_node(alloc, true)) // Throws - , m_target_column(target_column) - , m_deny_duplicate_values(false) -{ -} - -inline StringIndex::StringIndex(ref_type ref, ArrayParent* parent, size_t ndx_in_parent, ColumnBase* target_column, - bool deny_duplicate_values, Allocator& alloc) - : m_array(new IndexArray(alloc)) - , m_target_column(target_column) - , m_deny_duplicate_values(deny_duplicate_values) -{ - REALM_ASSERT_EX(Array::get_context_flag_from_header(alloc.translate(ref)), ref, size_t(alloc.translate(ref))); - m_array->init_from_ref(ref); - set_parent(parent, ndx_in_parent); -} - -inline StringIndex::StringIndex(inner_node_tag, Allocator& alloc) - : m_array(create_node(alloc, false)) // Throws - , m_target_column(nullptr) - , m_deny_duplicate_values(false) -{ -} - -inline void StringIndex::set_allow_duplicate_values(bool allow) noexcept -{ - m_deny_duplicate_values = !allow; -} - -// Byte order of the key is *reversed*, so that for the integer index, the least significant -// byte comes first, so that it fits little-endian machines. That way we can perform fast -// range-lookups and iterate in order, etc, as future features. This, however, makes the same -// features slower for string indexes. Todo, we should reverse the order conditionally, depending -// on the column type. -inline StringIndex::key_type StringIndex::create_key(StringData str) noexcept -{ - key_type key = 0; - - if (str.size() >= 4) - goto four; - if (str.size() < 2) { - if (str.size() == 0) - goto none; - goto one; - } - if (str.size() == 2) - goto two; - goto three; - -// Create 4 byte index key -// (encoded like this to allow literal comparisons -// independently of endianness) -four: - key |= (key_type(static_cast(str[3])) << 0); -three: - key |= (key_type(static_cast(str[2])) << 8); -two: - key |= (key_type(static_cast(str[1])) << 16); -one: - key |= (key_type(static_cast(str[0])) << 24); -none: - return key; -} - -// Index works as follows: All non-NULL values are stored as if they had appended an 'X' character at the end. So -// "foo" is stored as if it was "fooX", and "" (empty string) is stored as "X". And NULLs are stored as empty strings. -inline StringIndex::key_type StringIndex::create_key(StringData str, size_t offset) noexcept -{ - if (str.is_null()) - return 0; - - if (offset > str.size()) - return 0; - - // for very short strings - size_t tail = str.size() - offset; - if (tail <= sizeof(key_type) - 1) { - char buf[sizeof(key_type)]; - memset(buf, 0, sizeof(key_type)); - buf[tail] = 'X'; - memcpy(buf, str.data() + offset, tail); - return create_key(StringData(buf, tail + 1)); - } - // else fallback - return create_key(str.substr(offset)); -} - -template -void StringIndex::insert(size_t row_ndx, T value, size_t num_rows, bool is_append) -{ - REALM_ASSERT_3(row_ndx, !=, npos); - - // If the new row is inserted after the last row in the table, we don't need - // to adjust any row indexes. - if (!is_append) { - for (size_t i = 0; i < num_rows; ++i) { - size_t row_ndx_2 = row_ndx + i; - adjust_row_indexes(row_ndx_2, 1); // Throws - } - } - - StringConversionBuffer buffer; - - for (size_t i = 0; i < num_rows; ++i) { - size_t row_ndx_2 = row_ndx + i; - size_t offset = 0; // First key from beginning of string - insert_with_offset(row_ndx_2, to_str(value, buffer), offset); // Throws - } -} - -template -void StringIndex::insert(size_t row_ndx, util::Optional value, size_t num_rows, bool is_append) -{ - if (value) { - insert(row_ndx, *value, num_rows, is_append); - } - else { - insert(row_ndx, null{}, num_rows, is_append); - } -} - -template -void StringIndex::set(size_t row_ndx, T new_value) -{ - StringConversionBuffer buffer; - StringConversionBuffer buffer2; - StringData old_value = get(row_ndx, buffer); - StringData new_value2 = to_str(new_value, buffer2); - - // Note that insert_with_offset() throws UniqueConstraintViolation. - - if (REALM_LIKELY(new_value2 != old_value)) { - // We must erase this row first because erase uses find_first which - // might find the duplicate if we insert before erasing. - bool is_last = true; // To avoid updating refs - erase(row_ndx, is_last); // Throws - - size_t offset = 0; // First key from beginning of string - insert_with_offset(row_ndx, new_value2, offset); // Throws - } -} - -template -void StringIndex::set(size_t row_ndx, util::Optional new_value) -{ - if (new_value) { - set(row_ndx, *new_value); - } - else { - set(row_ndx, null{}); - } -} - -template -void StringIndex::erase(size_t row_ndx, bool is_last) -{ - StringConversionBuffer buffer; - StringData value = get(row_ndx, buffer); - - do_delete(row_ndx, value, 0); - - // Collapse top nodes with single item - while (m_array->is_inner_bptree_node()) { - REALM_ASSERT(m_array->size() > 1); // node cannot be empty - if (m_array->size() > 2) - break; - - ref_type ref = m_array->get_as_ref(1); - m_array->set(1, 1); // avoid destruction of the extracted ref - m_array->destroy_deep(); - m_array->init_from_ref(ref); - m_array->update_parent(); - } - - // If it is last item in column, we don't have to update refs - if (!is_last) - adjust_row_indexes(row_ndx, -1); -} - -template -size_t StringIndex::find_first(T value) const -{ - // Use direct access method - StringConversionBuffer buffer; - return m_array->index_string_find_first(to_str(value, buffer), m_target_column); -} - -template -void StringIndex::find_all(IntegerColumn& result, T value) const -{ - // Use direct access method - StringConversionBuffer buffer; - return m_array->index_string_find_all(result, to_str(value, buffer), m_target_column); -} - -template -FindRes StringIndex::find_all_no_copy(T value, InternalFindResult& result) const -{ - // Use direct access method - StringConversionBuffer buffer; - return m_array->index_string_find_all_no_copy(to_str(value, buffer), m_target_column, result); -} - -template -size_t StringIndex::count(T value) const -{ - // Use direct access method - StringConversionBuffer buffer; - return m_array->index_string_count(to_str(value, buffer), m_target_column); -} - -template -void StringIndex::update_ref(T value, size_t old_row_ndx, size_t new_row_ndx) -{ - StringConversionBuffer buffer; - do_update_ref(to_str(value, buffer), old_row_ndx, new_row_ndx, 0); -} - -inline void StringIndex::destroy() noexcept -{ - return m_array->destroy_deep(); -} - -inline bool StringIndex::is_attached() const noexcept -{ - return m_array->is_attached(); -} - -inline void StringIndex::refresh_accessor_tree(size_t, const Spec&) -{ - m_array->init_from_parent(); -} - -inline ref_type StringIndex::get_ref() const noexcept -{ - return m_array->get_ref(); -} - -inline void StringIndex::set_parent(ArrayParent* parent, size_t ndx_in_parent) noexcept -{ - m_array->set_parent(parent, ndx_in_parent); -} - -inline size_t StringIndex::get_ndx_in_parent() const noexcept -{ - return m_array->get_ndx_in_parent(); -} - -inline void StringIndex::set_ndx_in_parent(size_t ndx_in_parent) noexcept -{ - m_array->set_ndx_in_parent(ndx_in_parent); -} - -inline void StringIndex::update_from_parent(size_t old_baseline) noexcept -{ - m_array->update_from_parent(old_baseline); -} - -} // namespace realm - -#endif // REALM_INDEX_STRING_HPP diff --git a/Pods/Realm/include/core/realm/lang_bind_helper.hpp b/Pods/Realm/include/core/realm/lang_bind_helper.hpp deleted file mode 100644 index 9e93c77b..00000000 --- a/Pods/Realm/include/core/realm/lang_bind_helper.hpp +++ /dev/null @@ -1,380 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_LANG_BIND_HELPER_HPP -#define REALM_LANG_BIND_HELPER_HPP - -#include - -#include -#include -#include -#include -#include - -#include - -namespace realm { - - -/// These functions are only to be used by language bindings to gain -/// access to certain memebers that are othewise private. -/// -/// \note Applications are not supposed to call any of these functions -/// directly. -/// -/// All of the get_subtable_ptr() functions bind the table accessor pointer -/// before it is returned (bind_table_ptr()). The caller is then responsible for -/// making the corresponding call to unbind_table_ptr(). -class LangBindHelper { -public: - /// Increment the reference counter of the specified table accessor. This is - /// done automatically by all of the functions in this class that return - /// table accessor pointers, but if the binding/application makes a copy of - /// such a pointer, and the copy needs to have an "independent life", then - /// the binding/application must bind that copy using this function. - static void bind_table_ptr(const Table*) noexcept; - - /// Decrement the reference counter of the specified table accessor. The - /// binding/application must call this function for every bound table - /// accessor pointer object, when that pointer object ends its life. - static void unbind_table_ptr(const Table*) noexcept; - - /// Construct a new freestanding table. The table accessor pointer is bound - /// by the callee before it is returned (bind_table_ptr()). - static Table* new_table(); - - /// Construct a new freestanding table as a copy of the specified one. The - /// table accessor pointer is bound by the callee before it is returned - /// (bind_table_ptr()). - static Table* copy_table(const Table&); - - //@{ - - /// These functions are like their namesakes in Group, but these bypass the - /// construction of a smart-pointer object (TableRef). The table accessor - /// pointer is bound by the callee before it is returned (bind_table_ptr()). - - static Table* get_table(Group&, size_t index_in_group); - static const Table* get_table(const Group&, size_t index_in_group); - - static Table* get_table(Group&, StringData name); - static const Table* get_table(const Group&, StringData name); - - static Table* add_table(Group&, StringData name, bool require_unique_name = true); - static Table* get_or_add_table(Group&, StringData name, bool* was_added = nullptr); - - //@} - - static Table* get_subtable_ptr(Table*, size_t column_ndx, size_t row_ndx); - static const Table* get_subtable_ptr(const Table*, size_t column_ndx, size_t row_ndx); - - // FIXME: This is an 'oddball', do we really need it? If we do, - // please provide a comment that explains why it is needed! - static Table* get_subtable_ptr_during_insert(Table*, size_t col_ndx, size_t row_ndx); - - static Table* get_subtable_ptr(TableView*, size_t column_ndx, size_t row_ndx); - static const Table* get_subtable_ptr(const TableView*, size_t column_ndx, size_t row_ndx); - static const Table* get_subtable_ptr(const ConstTableView*, size_t column_ndx, size_t row_ndx); - - /// Calls parent.set_mixed_subtable(col_ndx, row_ndx, &source). Note - /// that the source table must have a descriptor that is - /// compatible with the target subtable column. - static void set_mixed_subtable(Table& parent, size_t col_ndx, size_t row_ndx, const Table& source); - - static const LinkViewRef& get_linklist_ptr(Row&, size_t col_ndx); - static void unbind_linklist_ptr(const LinkViewRef&); - - using VersionID = SharedGroup::VersionID; - - /// \defgroup lang_bind_helper_transactions Continuous Transactions - /// - /// advance_read() is equivalent to terminating the current read transaction - /// (SharedGroup::end_read()), and initiating a new one - /// (SharedGroup::begin_read()), except that all subordinate accessors - /// (Table, Row, Descriptor) will remain attached to the underlying objects, - /// unless those objects were removed in the target snapshot. By default, - /// the read transaction is advanced to the latest available snapshot, but - /// see SharedGroup::begin_read() for information about \a version. - /// - /// promote_to_write() is equivalent to terminating the current read - /// transaction (SharedGroup::end_read()), and initiating a new write - /// transaction (SharedGroup::begin_write()), except that all subordinate - /// accessors (Table, Row, Descriptor) will remain attached to the - /// underlying objects, unless those objects were removed in the target - /// snapshot. - /// - /// commit_and_continue_as_read() is equivalent to committing the current - /// write transaction (SharedGroup::commit()) and initiating a new read - /// transaction, which is bound to the snapshot produced by the write - /// transaction (SharedGroup::begin_read()), except that all subordinate - /// accessors (Table, Row, Descriptor) will remain attached to the - /// underlying objects. commit_and_continue_as_read() returns the version - /// produced by the committed transaction. - /// - /// rollback_and_continue_as_read() is equivalent to rolling back the - /// current write transaction (SharedGroup::rollback()) and initiating a new - /// read transaction, which is bound to the snapshot, that the write - /// transaction was based on (SharedGroup::begin_read()), except that all - /// subordinate accessors (Table, Row, Descriptor) will remain attached to - /// the underlying objects, unless they were attached to object that were - /// added during the rolled back transaction. - /// - /// If advance_read(), promote_to_write(), commit_and_continue_as_read(), or - /// rollback_and_continue_as_read() throws, the associated group accessor - /// and all of its subordinate accessors are left in a state that may not be - /// fully consistent. Only minimal consistency is guaranteed (see - /// AccessorConsistencyLevels). In this case, the application is required to - /// either destroy the SharedGroup object, forcing all associated accessors - /// to become detached, or take some other equivalent action that involves a - /// complete accessor detachment, such as terminating the transaction in - /// progress. Until then it is an error, and unsafe if the application - /// attempts to access any of those accessors. - /// - /// The application must use SharedGroup::end_read() if it wants to - /// terminate the transaction after advance_read() or promote_to_write() has - /// thrown an exception. Likewise, it must use SharedGroup::rollback() if it - /// wants to terminate the transaction after commit_and_continue_as_read() - /// or rollback_and_continue_as_read() has thrown an exception. - /// - /// \param observer An optional custom replication instruction handler. The - /// application may pass such a handler to observe the sequence of - /// modifications that advances (or rolls back) the state of the Realm. - /// - /// \throw SharedGroup::BadVersion Thrown by advance_read() if the specified - /// version does not correspond to a bound (or tethered) snapshot. - /// - //@{ - - static void advance_read(SharedGroup&, VersionID = VersionID()); - template - static void advance_read(SharedGroup&, O&& observer, VersionID = VersionID()); - static void promote_to_write(SharedGroup&); - template - static void promote_to_write(SharedGroup&, O&& observer); - static SharedGroup::version_type commit_and_continue_as_read(SharedGroup&); - static void rollback_and_continue_as_read(SharedGroup&); - template - static void rollback_and_continue_as_read(SharedGroup&, O&& observer); - - //@} - - /// Returns the name of the specified data type. Examples: - /// - ///
-    ///
-    ///   type_Int          ->  "int"
-    ///   type_Bool         ->  "bool"
-    ///   type_Float        ->  "float"
-    ///   ...
-    ///
-    /// 
- static const char* get_data_type_name(DataType) noexcept; - - static SharedGroup::version_type get_version_of_latest_snapshot(SharedGroup&); -}; - - -// Implementation: - -inline Table* LangBindHelper::new_table() -{ - typedef _impl::TableFriend tf; - Allocator& alloc = Allocator::get_default(); - size_t ref = tf::create_empty_table(alloc); // Throws - Table::Parent* parent = nullptr; - size_t ndx_in_parent = 0; - Table* table = tf::create_accessor(alloc, ref, parent, ndx_in_parent); // Throws - bind_table_ptr(table); - return table; -} - -inline Table* LangBindHelper::copy_table(const Table& table) -{ - typedef _impl::TableFriend tf; - Allocator& alloc = Allocator::get_default(); - size_t ref = tf::clone(table, alloc); // Throws - Table::Parent* parent = nullptr; - size_t ndx_in_parent = 0; - Table* copy_of_table = tf::create_accessor(alloc, ref, parent, ndx_in_parent); // Throws - bind_table_ptr(copy_of_table); - return copy_of_table; -} - -inline Table* LangBindHelper::get_subtable_ptr(Table* t, size_t column_ndx, size_t row_ndx) -{ - Table* subtab = t->get_subtable_ptr(column_ndx, row_ndx); // Throws - subtab->bind_ptr(); - return subtab; -} - -inline const Table* LangBindHelper::get_subtable_ptr(const Table* t, size_t column_ndx, size_t row_ndx) -{ - const Table* subtab = t->get_subtable_ptr(column_ndx, row_ndx); // Throws - subtab->bind_ptr(); - return subtab; -} - -inline Table* LangBindHelper::get_subtable_ptr(TableView* tv, size_t column_ndx, size_t row_ndx) -{ - return get_subtable_ptr(&tv->get_parent(), column_ndx, tv->get_source_ndx(row_ndx)); -} - -inline const Table* LangBindHelper::get_subtable_ptr(const TableView* tv, size_t column_ndx, size_t row_ndx) -{ - return get_subtable_ptr(&tv->get_parent(), column_ndx, tv->get_source_ndx(row_ndx)); -} - -inline const Table* LangBindHelper::get_subtable_ptr(const ConstTableView* tv, size_t column_ndx, size_t row_ndx) -{ - return get_subtable_ptr(&tv->get_parent(), column_ndx, tv->get_source_ndx(row_ndx)); -} - -inline Table* LangBindHelper::get_table(Group& group, size_t index_in_group) -{ - typedef _impl::GroupFriend gf; - Table* table = &gf::get_table(group, index_in_group); // Throws - table->bind_ptr(); - return table; -} - -inline const Table* LangBindHelper::get_table(const Group& group, size_t index_in_group) -{ - typedef _impl::GroupFriend gf; - const Table* table = &gf::get_table(group, index_in_group); // Throws - table->bind_ptr(); - return table; -} - -inline Table* LangBindHelper::get_table(Group& group, StringData name) -{ - typedef _impl::GroupFriend gf; - Table* table = gf::get_table(group, name); // Throws - if (table) - table->bind_ptr(); - return table; -} - -inline const Table* LangBindHelper::get_table(const Group& group, StringData name) -{ - typedef _impl::GroupFriend gf; - const Table* table = gf::get_table(group, name); // Throws - if (table) - table->bind_ptr(); - return table; -} - -inline Table* LangBindHelper::add_table(Group& group, StringData name, bool require_unique_name) -{ - typedef _impl::GroupFriend gf; - Table* table = &gf::add_table(group, name, require_unique_name); // Throws - table->bind_ptr(); - return table; -} - -inline Table* LangBindHelper::get_or_add_table(Group& group, StringData name, bool* was_added) -{ - typedef _impl::GroupFriend gf; - Table* table = &gf::get_or_add_table(group, name, was_added); // Throws - table->bind_ptr(); - return table; -} - -inline void LangBindHelper::unbind_table_ptr(const Table* t) noexcept -{ - t->unbind_ptr(); -} - -inline void LangBindHelper::bind_table_ptr(const Table* t) noexcept -{ - t->bind_ptr(); -} - -inline void LangBindHelper::set_mixed_subtable(Table& parent, size_t col_ndx, size_t row_ndx, const Table& source) -{ - parent.set_mixed_subtable(col_ndx, row_ndx, &source); -} - -inline const LinkViewRef& LangBindHelper::get_linklist_ptr(Row& row, size_t col_ndx) -{ - LinkViewRef* link_view = new LinkViewRef(row.get_linklist(col_ndx)); - return *link_view; -} - -inline void LangBindHelper::unbind_linklist_ptr(const LinkViewRef& link_view) -{ - delete (&link_view); -} - -inline void LangBindHelper::advance_read(SharedGroup& sg, VersionID version) -{ - using sgf = _impl::SharedGroupFriend; - _impl::NullInstructionObserver* observer = nullptr; - sgf::advance_read(sg, observer, version); // Throws -} - -template -inline void LangBindHelper::advance_read(SharedGroup& sg, O&& observer, VersionID version) -{ - using sgf = _impl::SharedGroupFriend; - sgf::advance_read(sg, &observer, version); // Throws -} - -inline void LangBindHelper::promote_to_write(SharedGroup& sg) -{ - using sgf = _impl::SharedGroupFriend; - _impl::NullInstructionObserver* observer = nullptr; - sgf::promote_to_write(sg, observer); // Throws -} - -template -inline void LangBindHelper::promote_to_write(SharedGroup& sg, O&& observer) -{ - using sgf = _impl::SharedGroupFriend; - sgf::promote_to_write(sg, &observer); // Throws -} - -inline SharedGroup::version_type LangBindHelper::commit_and_continue_as_read(SharedGroup& sg) -{ - using sgf = _impl::SharedGroupFriend; - return sgf::commit_and_continue_as_read(sg); // Throws -} - -inline void LangBindHelper::rollback_and_continue_as_read(SharedGroup& sg) -{ - using sgf = _impl::SharedGroupFriend; - _impl::NullInstructionObserver* observer = nullptr; - sgf::rollback_and_continue_as_read(sg, observer); // Throws -} - -template -inline void LangBindHelper::rollback_and_continue_as_read(SharedGroup& sg, O&& observer) -{ - using sgf = _impl::SharedGroupFriend; - sgf::rollback_and_continue_as_read(sg, &observer); // Throws -} - -inline SharedGroup::version_type LangBindHelper::get_version_of_latest_snapshot(SharedGroup& sg) -{ - using sgf = _impl::SharedGroupFriend; - return sgf::get_version_of_latest_snapshot(sg); // Throws -} - -} // namespace realm - -#endif // REALM_LANG_BIND_HELPER_HPP diff --git a/Pods/Realm/include/core/realm/link_view.hpp b/Pods/Realm/include/core/realm/link_view.hpp deleted file mode 100644 index 89ce9da3..00000000 --- a/Pods/Realm/include/core/realm/link_view.hpp +++ /dev/null @@ -1,375 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_LINK_VIEW_HPP -#define REALM_LINK_VIEW_HPP - -#include -#include -#include -#include - -namespace realm { - -class LinkListColumn; - -namespace _impl { -class LinkListFriend; -class TransactLogConvenientEncoder; -} - - -/// The effect of calling most of the link list functions on a detached accessor -/// is unspecified and may lead to general corruption, or even a crash. The -/// exceptions are is_attached() and the destructor. -/// -/// FIXME: Rename this class to `LinkList`. -class LinkView : public RowIndexes, public std::enable_shared_from_this { -public: - ~LinkView() noexcept; - bool is_attached() const noexcept; - - /// This method will return true if the LinkView is detached (no assert). - bool is_empty() const noexcept; - - /// This method will return 0 if the LinkView is detached (no assert). - size_t size() const noexcept override; - - bool operator==(const LinkView&) const noexcept; - bool operator!=(const LinkView&) const noexcept; - - // Getting links - Table::ConstRowExpr operator[](size_t link_ndx) const noexcept; - Table::RowExpr operator[](size_t link_ndx) noexcept; - Table::ConstRowExpr get(size_t link_ndx) const noexcept; - Table::RowExpr get(size_t link_ndx) noexcept; - - // Modifiers - void add(size_t target_row_ndx); - void insert(size_t link_ndx, size_t target_row_ndx); - void set(size_t link_ndx, size_t target_row_ndx); - /// Move the link at \a from_ndx such that it ends up at \a to_ndx. Other - /// links are shifted as necessary in such a way that their order is - /// preserved. - /// - /// Note that \a to_ndx is the desired final index of the moved link, - /// therefore, `move(1,1)` is a no-op, while `move(1,2)` moves the link at - /// index 1 by one position, such that it ends up at index 2. A side-effect - /// of that, is that the link, that was originally at index 2, is moved to - /// index 1. - void move(size_t from_ndx, size_t to_ndx); - void swap(size_t link1_ndx, size_t link2_ndx); - void remove(size_t link_ndx); - void clear(); - - void sort(size_t column, bool ascending = true); - void sort(const SortDescriptor& order); - - TableView get_sorted_view(size_t column_index, bool ascending = true) const; - TableView get_sorted_view(SortDescriptor order) const; - - /// Remove the target row of the specified link from the target table. This - /// also removes the specified link from this link list, and any other link - /// pointing to that row. This is merely a shorthand for - /// `get_target_table.move_last_over(get(link_ndx))`. - void remove_target_row(size_t link_ndx); - - /// Remove all target rows pointed to by links in this link list, and clear - /// this link list. - void remove_all_target_rows(); - - /// Search this list for a link to the specified target table row (specified - /// by its index in the target table). If found, the index of the link to - /// that row within this list is returned, otherwise `realm::not_found` is - /// returned. - size_t find(size_t target_row_ndx, size_t start = 0) const noexcept; - - const ColumnBase& get_column_base(size_t index) - const override; // FIXME: `ColumnBase` is not part of the public API, so this function must be made private. - const Table& get_origin_table() const noexcept; - Table& get_origin_table() noexcept; - - size_t get_origin_row_index() const noexcept; - - const Table& get_target_table() const noexcept; - Table& get_target_table() noexcept; - - // No-op because LinkViews are always kept in sync. - uint_fast64_t sync_if_needed() const override; - bool is_in_sync() const override - { - return true; - } - -private: - struct ctor_cookie { - }; - - TableRef m_origin_table; - LinkListColumn& m_origin_column; - - using HandoverPatch = LinkViewHandoverPatch; - static void generate_patch(const ConstLinkViewRef& ref, std::unique_ptr& patch); - static LinkViewRef create_from_and_consume_patch(std::unique_ptr& patch, Group& group); - - void detach(); - void set_origin_row_index(size_t row_ndx) noexcept; - - void do_insert(size_t link_ndx, size_t target_row_ndx); - size_t do_set(size_t link_ndx, size_t target_row_ndx); - size_t do_remove(size_t link_ndx); - void do_clear(bool broken_reciprocal_backlinks); - - void do_nullify_link(size_t old_target_row_ndx); - void do_update_link(size_t old_target_row_ndx, size_t new_target_row_ndx); - void do_swap_link(size_t target_row_ndx_1, size_t target_row_ndx_2); - - void refresh_accessor_tree(size_t new_row_ndx) noexcept; - - void update_from_parent(size_t old_baseline) noexcept; - - Replication* get_repl() noexcept; - void repl_unselect() noexcept; - friend class _impl::TransactLogConvenientEncoder; - -#ifdef REALM_DEBUG - void verify(size_t row_ndx) const; -#endif - // allocate using make_shared: - static std::shared_ptr create(Table* origin_table, LinkListColumn&, size_t row_ndx); - - friend class _impl::LinkListFriend; - friend class LinkListColumn; - friend class LangBindHelper; - friend class SharedGroup; - friend class Query; - friend class TableViewBase; - - // must be public for use by make_shared, but cannot be called from outside, - // because ctor_cookie is private -public: - LinkView(const ctor_cookie&, Table* origin_table, LinkListColumn&, size_t row_ndx); -}; - - -// Implementation - -inline LinkView::LinkView(const ctor_cookie&, Table* origin_table, LinkListColumn& column, size_t row_ndx) - : RowIndexes(IntegerColumn::unattached_root_tag(), column.get_alloc()) // Throws - , m_origin_table(origin_table->get_table_ref()) - , m_origin_column(column) -{ - m_row_indexes.set_parent(&m_origin_column, row_ndx); - m_row_indexes.init_from_parent(); -} - -inline std::shared_ptr LinkView::create(Table* origin_table, LinkListColumn& column, size_t row_ndx) -{ - return std::make_shared(ctor_cookie(), origin_table, column, row_ndx); -} - -inline LinkView::~LinkView() noexcept -{ - if (is_attached()) { - repl_unselect(); - m_origin_column.unregister_linkview(); - } -} - -inline void LinkView::detach() -{ - REALM_ASSERT(is_attached()); - repl_unselect(); - m_origin_table.reset(); - m_row_indexes.detach(); -} - -inline bool LinkView::is_attached() const noexcept -{ - return static_cast(m_origin_table); -} - -inline bool LinkView::is_empty() const noexcept -{ - if (!is_attached()) - return true; - - if (!m_row_indexes.is_attached()) - return true; - - return m_row_indexes.is_empty(); -} - -inline size_t LinkView::size() const noexcept -{ - if (!is_attached()) - return 0; - - if (!m_row_indexes.is_attached()) - return 0; - - return m_row_indexes.size(); -} - -inline bool LinkView::operator==(const LinkView& link_list) const noexcept -{ - Table& target_table_1 = m_origin_column.get_target_table(); - Table& target_table_2 = link_list.m_origin_column.get_target_table(); - if (target_table_1.get_index_in_group() != target_table_2.get_index_in_group()) - return false; - if (!m_row_indexes.is_attached() || m_row_indexes.is_empty()) { - return !link_list.m_row_indexes.is_attached() || link_list.m_row_indexes.is_empty(); - } - return link_list.m_row_indexes.is_attached() && m_row_indexes.compare(link_list.m_row_indexes); -} - -inline bool LinkView::operator!=(const LinkView& link_list) const noexcept -{ - return !(*this == link_list); -} - -inline Table::ConstRowExpr LinkView::get(size_t link_ndx) const noexcept -{ - return const_cast(this)->get(link_ndx); -} - -inline Table::RowExpr LinkView::get(size_t link_ndx) noexcept -{ - REALM_ASSERT(is_attached()); - REALM_ASSERT(m_row_indexes.is_attached()); - REALM_ASSERT_3(link_ndx, <, m_row_indexes.size()); - - Table& target_table = m_origin_column.get_target_table(); - size_t target_row_ndx = to_size_t(m_row_indexes.get(link_ndx)); - return target_table[target_row_ndx]; -} - -inline Table::ConstRowExpr LinkView::operator[](size_t link_ndx) const noexcept -{ - return get(link_ndx); -} - -inline Table::RowExpr LinkView::operator[](size_t link_ndx) noexcept -{ - return get(link_ndx); -} - -inline void LinkView::add(size_t target_row_ndx) -{ - REALM_ASSERT(is_attached()); - size_t ins_pos = (m_row_indexes.is_attached()) ? m_row_indexes.size() : 0; - insert(ins_pos, target_row_ndx); -} - -inline size_t LinkView::find(size_t target_row_ndx, size_t start) const noexcept -{ - REALM_ASSERT(is_attached()); - REALM_ASSERT_3(target_row_ndx, <, m_origin_column.get_target_table().size()); - REALM_ASSERT_3(start, <=, size()); - - if (!m_row_indexes.is_attached()) - return not_found; - - return m_row_indexes.find_first(target_row_ndx, start); -} - -inline const ColumnBase& LinkView::get_column_base(size_t index) const -{ - return get_target_table().get_column_base(index); -} - -inline const Table& LinkView::get_origin_table() const noexcept -{ - return *m_origin_table; -} - -inline Table& LinkView::get_origin_table() noexcept -{ - return *m_origin_table; -} - -inline size_t LinkView::get_origin_row_index() const noexcept -{ - REALM_ASSERT(is_attached()); - return m_row_indexes.get_root_array()->get_ndx_in_parent(); -} - -inline void LinkView::set_origin_row_index(size_t row_ndx) noexcept -{ - REALM_ASSERT(is_attached()); - m_row_indexes.get_root_array()->set_ndx_in_parent(row_ndx); -} - -inline const Table& LinkView::get_target_table() const noexcept -{ - return m_origin_column.get_target_table(); -} - -inline Table& LinkView::get_target_table() noexcept -{ - return m_origin_column.get_target_table(); -} - -inline void LinkView::refresh_accessor_tree(size_t new_row_ndx) noexcept -{ - set_origin_row_index(new_row_ndx); - m_row_indexes.init_from_parent(); -} - -inline void LinkView::update_from_parent(size_t old_baseline) noexcept -{ - if (m_row_indexes.is_attached()) - m_row_indexes.update_from_parent(old_baseline); -} - -inline Replication* LinkView::get_repl() noexcept -{ - typedef _impl::TableFriend tf; - return tf::get_repl(*m_origin_table); -} - - -// The purpose of this class is to give internal access to some, but not all of -// the non-public parts of LinkView. -class _impl::LinkListFriend { -public: - static void do_set(LinkView& list, size_t link_ndx, size_t target_row_ndx) - { - list.do_set(link_ndx, target_row_ndx); - } - - static void do_remove(LinkView& list, size_t link_ndx) - { - list.do_remove(link_ndx); - } - - static void do_clear(LinkView& list) - { - bool broken_reciprocal_backlinks = false; - list.do_clear(broken_reciprocal_backlinks); - } - - static void do_insert(LinkView& list, size_t link_ndx, size_t target_row_ndx) - { - list.do_insert(link_ndx, target_row_ndx); - } -}; - -} // namespace realm - -#endif // REALM_LINK_VIEW_HPP diff --git a/Pods/Realm/include/core/realm/link_view_fwd.hpp b/Pods/Realm/include/core/realm/link_view_fwd.hpp deleted file mode 100644 index cba8801e..00000000 --- a/Pods/Realm/include/core/realm/link_view_fwd.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_LINK_VIEW_FWD_HPP -#define REALM_LINK_VIEW_FWD_HPP - -#include - -namespace realm { - -class LinkView; -using LinkViewRef = std::shared_ptr; -using ConstLinkViewRef = std::shared_ptr; - -} // namespace realm - -#endif // REALM_LINK_VIEW_FWD_HPP diff --git a/Pods/Realm/include/core/realm/mixed.hpp b/Pods/Realm/include/core/realm/mixed.hpp deleted file mode 100644 index 8f07f4fc..00000000 --- a/Pods/Realm/include/core/realm/mixed.hpp +++ /dev/null @@ -1,657 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_MIXED_HPP -#define REALM_MIXED_HPP - -#include // int64_t - not part of C++03, not even required by C++11 (see C++11 section 18.4.1) - -#include // size_t -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace realm { - - -/// This class represents a polymorphic Realm value. -/// -/// At any particular moment an instance of this class stores a -/// definite value of a definite type. If, for instance, that is an -/// integer value, you may call get_int() to extract that value. You -/// may call get_type() to discover what type of value is currently -/// stored. Calling get_int() on an instance that does not store an -/// integer, has undefined behavior, and likewise for all the other -/// types that can be stored. -/// -/// It is crucial to understand that the act of extracting a value of -/// a particular type requires definite knowledge about the stored -/// type. Calling a getter method for any particular type, that is not -/// the same type as the stored value, has undefined behavior. -/// -/// While values of numeric types are contained directly in a Mixed -/// instance, character and binary data are merely referenced. A Mixed -/// instance never owns the referenced data, nor does it in any other -/// way attempt to manage its lifetime. -/// -/// For compatibility with C style strings, when a string (character -/// data) is stored in a Realm database, it is always followed by a -/// terminating null character. This is also true when strings are -/// stored in a mixed type column. This means that in the following -/// code, if the 'mixed' value of the 8th row stores a string, then \c -/// c_str will always point to a null-terminated string: -/// -/// \code{.cpp} -/// -/// const char* c_str = my_table[7].mixed.data(); // Always null-terminated -/// -/// \endcode -/// -/// Note that this assumption does not hold in general for strings in -/// instances of Mixed. Indeed there is nothing stopping you from -/// constructing a new Mixed instance that refers to a string without -/// a terminating null character. -/// -/// At the present time no soultion has been found that would allow -/// for a Mixed instance to directly store a reference to a table. The -/// problem is roughly as follows: From most points of view, the -/// desirable thing to do, would be to store the table reference in a -/// Mixed instance as a plain pointer without any ownership -/// semantics. This would have no negative impact on the performance -/// of copying and destroying Mixed instances, and it would serve just -/// fine for passing a table as argument when setting the value of an -/// entry in a mixed column. In that case a copy of the referenced -/// table would be inserted into the mixed column. -/// -/// On the other hand, when retrieving a table reference from a mixed -/// column, storing it as a plain pointer in a Mixed instance is no -/// longer an acceptable option. The complex rules for managing the -/// lifetime of a Table instance, that represents a subtable, -/// necessitates the use of a "smart pointer" such as -/// TableRef. Enhancing the Mixed class to be able to act as a -/// TableRef would be possible, but would also lead to several new -/// problems. One problem is the risk of a Mixed instance outliving a -/// stack allocated Table instance that it references. This would be a -/// fatal error. Another problem is the impact that the nontrivial -/// table reference has on the performance of copying and destroying -/// Mixed instances. -/// -/// \sa StringData -class Mixed { -public: - Mixed() noexcept; - - Mixed(bool) noexcept; - Mixed(int64_t) noexcept; - Mixed(float) noexcept; - Mixed(double) noexcept; - Mixed(StringData) noexcept; - Mixed(BinaryData) noexcept; - Mixed(OldDateTime) noexcept; - Mixed(Timestamp) noexcept; - - // These are shortcuts for Mixed(StringData(c_str)), and are - // needed to avoid unwanted implicit conversion of char* to bool. - Mixed(char* c_str) noexcept - { - set_string(c_str); - } - Mixed(const char* c_str) noexcept - { - set_string(c_str); - } - - struct subtable_tag { - }; - Mixed(subtable_tag) noexcept - : m_type(type_Table) - { - } - - ~Mixed() noexcept - { - } - - DataType get_type() const noexcept - { - return m_type; - } - - int64_t get_int() const noexcept; - bool get_bool() const noexcept; - float get_float() const noexcept; - double get_double() const noexcept; - StringData get_string() const noexcept; - BinaryData get_binary() const noexcept; - OldDateTime get_olddatetime() const noexcept; - Timestamp get_timestamp() const noexcept; - - void set_int(int64_t) noexcept; - void set_bool(bool) noexcept; - void set_float(float) noexcept; - void set_double(double) noexcept; - void set_string(StringData) noexcept; - void set_binary(BinaryData) noexcept; - void set_binary(const char* data, size_t size) noexcept; - void set_olddatetime(OldDateTime) noexcept; - void set_timestamp(Timestamp) noexcept; - - template - friend std::basic_ostream& operator<<(std::basic_ostream&, const Mixed&); - -private: - DataType m_type; - union { - int64_t m_int; - bool m_bool; - float m_float; - double m_double; - const char* m_data; - int_fast64_t m_date; - Timestamp m_timestamp; - }; - size_t m_size = 0; -}; - -// Note: We cannot compare two mixed values, since when the type of -// both is type_Table, we would have to compare the two tables, but -// the mixed values do not provide access to those tables. - -// Note: The mixed values are specified as Wrap. If they were -// not, these operators would apply to simple comparisons, such as int -// vs int64_t, and cause ambiguity. This is because the constructors -// of Mixed are not explicit. - -// Compare mixed with integer -template -bool operator==(Wrap, const T&) noexcept; -template -bool operator!=(Wrap, const T&) noexcept; -template -bool operator==(const T&, Wrap) noexcept; -template -bool operator!=(const T&, Wrap) noexcept; - -// Compare mixed with boolean -bool operator==(Wrap, bool) noexcept; -bool operator!=(Wrap, bool) noexcept; -bool operator==(bool, Wrap) noexcept; -bool operator!=(bool, Wrap) noexcept; - -// Compare mixed with float -bool operator==(Wrap, float); -bool operator!=(Wrap, float); -bool operator==(float, Wrap); -bool operator!=(float, Wrap); - -// Compare mixed with double -bool operator==(Wrap, double); -bool operator!=(Wrap, double); -bool operator==(double, Wrap); -bool operator!=(double, Wrap); - -// Compare mixed with string -bool operator==(Wrap, StringData) noexcept; -bool operator!=(Wrap, StringData) noexcept; -bool operator==(StringData, Wrap) noexcept; -bool operator!=(StringData, Wrap) noexcept; -bool operator==(Wrap, const char* c_str) noexcept; -bool operator!=(Wrap, const char* c_str) noexcept; -bool operator==(const char* c_str, Wrap) noexcept; -bool operator!=(const char* c_str, Wrap) noexcept; -bool operator==(Wrap, char* c_str) noexcept; -bool operator!=(Wrap, char* c_str) noexcept; -bool operator==(char* c_str, Wrap) noexcept; -bool operator!=(char* c_str, Wrap) noexcept; - -// Compare mixed with binary data -bool operator==(Wrap, BinaryData) noexcept; -bool operator!=(Wrap, BinaryData) noexcept; -bool operator==(BinaryData, Wrap) noexcept; -bool operator!=(BinaryData, Wrap) noexcept; - -// Compare mixed with date -bool operator==(Wrap, OldDateTime) noexcept; -bool operator!=(Wrap, OldDateTime) noexcept; -bool operator==(OldDateTime, Wrap) noexcept; -bool operator!=(OldDateTime, Wrap) noexcept; - - -// Implementation: - -inline Mixed::Mixed() noexcept -{ - m_type = type_Int; - m_int = 0; -} - -inline Mixed::Mixed(int64_t v) noexcept -{ - m_type = type_Int; - m_int = v; -} - -inline Mixed::Mixed(bool v) noexcept -{ - m_type = type_Bool; - m_bool = v; -} - -inline Mixed::Mixed(float v) noexcept -{ - m_type = type_Float; - m_float = v; -} - -inline Mixed::Mixed(double v) noexcept -{ - m_type = type_Double; - m_double = v; -} - -inline Mixed::Mixed(StringData v) noexcept -{ - m_type = type_String; - m_data = v.data(); - m_size = v.size(); -} - -inline Mixed::Mixed(BinaryData v) noexcept -{ - m_type = type_Binary; - m_data = v.data(); - m_size = v.size(); -} - -inline Mixed::Mixed(OldDateTime v) noexcept -{ - m_type = type_OldDateTime; - m_date = v.get_olddatetime(); -} - -inline Mixed::Mixed(Timestamp v) noexcept -{ - m_type = type_Timestamp; - m_timestamp = v; -} - -inline int64_t Mixed::get_int() const noexcept -{ - REALM_ASSERT(m_type == type_Int); - return m_int; -} - -inline bool Mixed::get_bool() const noexcept -{ - REALM_ASSERT(m_type == type_Bool); - return m_bool; -} - -inline float Mixed::get_float() const noexcept -{ - REALM_ASSERT(m_type == type_Float); - return m_float; -} - -inline double Mixed::get_double() const noexcept -{ - REALM_ASSERT(m_type == type_Double); - return m_double; -} - -inline StringData Mixed::get_string() const noexcept -{ - REALM_ASSERT(m_type == type_String); - return StringData(m_data, m_size); -} - -inline BinaryData Mixed::get_binary() const noexcept -{ - REALM_ASSERT(m_type == type_Binary); - return BinaryData(m_data, m_size); -} - -inline OldDateTime Mixed::get_olddatetime() const noexcept -{ - REALM_ASSERT(m_type == type_OldDateTime); - return m_date; -} - -inline Timestamp Mixed::get_timestamp() const noexcept -{ - REALM_ASSERT(m_type == type_Timestamp); - return m_timestamp; -} - -inline void Mixed::set_int(int64_t v) noexcept -{ - m_type = type_Int; - m_int = v; -} - -inline void Mixed::set_bool(bool v) noexcept -{ - m_type = type_Bool; - m_bool = v; -} - -inline void Mixed::set_float(float v) noexcept -{ - m_type = type_Float; - m_float = v; -} - -inline void Mixed::set_double(double v) noexcept -{ - m_type = type_Double; - m_double = v; -} - -inline void Mixed::set_string(StringData v) noexcept -{ - m_type = type_String; - m_data = v.data(); - m_size = v.size(); -} - -inline void Mixed::set_binary(BinaryData v) noexcept -{ - set_binary(v.data(), v.size()); -} - -inline void Mixed::set_binary(const char* data, size_t size) noexcept -{ - m_type = type_Binary; - m_data = data; - m_size = size; -} - -inline void Mixed::set_olddatetime(OldDateTime v) noexcept -{ - m_type = type_OldDateTime; - m_date = v.get_olddatetime(); -} - -// LCOV_EXCL_START -inline void Mixed::set_timestamp(Timestamp v) noexcept -{ - REALM_ASSERT(false && "not yet implemented"); - m_type = type_Timestamp; - m_timestamp = v; -} -// LCOV_EXCL_STOP - -// LCOV_EXCL_START -template -inline std::basic_ostream& operator<<(std::basic_ostream& out, const Mixed& m) -{ - out << "Mixed("; - switch (m.m_type) { - case type_Int: - out << m.m_int; - break; - case type_Bool: - out << m.m_bool; - break; - case type_Float: - out << m.m_float; - break; - case type_Double: - out << m.m_double; - break; - case type_String: - out << StringData(m.m_data, m.m_size); - break; - case type_Binary: - out << BinaryData(m.m_data, m.m_size); - break; - case type_OldDateTime: - out << OldDateTime(m.m_date); - break; - case type_Timestamp: - out << Timestamp(m.m_timestamp); - break; - case type_Table: - out << "subtable"; - break; - case type_Mixed: - case type_Link: - case type_LinkList: - REALM_ASSERT(false); - } - out << ")"; - return out; -} -// LCOV_EXCL_STOP - - -// Compare mixed with integer - -template -inline bool operator==(Wrap a, const T& b) noexcept -{ - return Mixed(a).get_type() == type_Int && Mixed(a).get_int() == b; -} - -template -inline bool operator!=(Wrap a, const T& b) noexcept -{ - return Mixed(a).get_type() != type_Int || Mixed(a).get_int() != b; -} - -template -inline bool operator==(const T& a, Wrap b) noexcept -{ - return type_Int == Mixed(b).get_type() && a == Mixed(b).get_int(); -} - -template -inline bool operator!=(const T& a, Wrap b) noexcept -{ - return type_Int != Mixed(b).get_type() || a != Mixed(b).get_int(); -} - - -// Compare mixed with boolean - -inline bool operator==(Wrap a, bool b) noexcept -{ - return Mixed(a).get_type() == type_Bool && Mixed(a).get_bool() == b; -} - -inline bool operator!=(Wrap a, bool b) noexcept -{ - return Mixed(a).get_type() != type_Bool || Mixed(a).get_bool() != b; -} - -inline bool operator==(bool a, Wrap b) noexcept -{ - return type_Bool == Mixed(b).get_type() && a == Mixed(b).get_bool(); -} - -inline bool operator!=(bool a, Wrap b) noexcept -{ - return type_Bool != Mixed(b).get_type() || a != Mixed(b).get_bool(); -} - - -// Compare mixed with float - -inline bool operator==(Wrap a, float b) -{ - return Mixed(a).get_type() == type_Float && Mixed(a).get_float() == b; -} - -inline bool operator!=(Wrap a, float b) -{ - return Mixed(a).get_type() != type_Float || Mixed(a).get_float() != b; -} - -inline bool operator==(float a, Wrap b) -{ - return type_Float == Mixed(b).get_type() && a == Mixed(b).get_float(); -} - -inline bool operator!=(float a, Wrap b) -{ - return type_Float != Mixed(b).get_type() || a != Mixed(b).get_float(); -} - - -// Compare mixed with double - -inline bool operator==(Wrap a, double b) -{ - return Mixed(a).get_type() == type_Double && Mixed(a).get_double() == b; -} - -inline bool operator!=(Wrap a, double b) -{ - return Mixed(a).get_type() != type_Double || Mixed(a).get_double() != b; -} - -inline bool operator==(double a, Wrap b) -{ - return type_Double == Mixed(b).get_type() && a == Mixed(b).get_double(); -} - -inline bool operator!=(double a, Wrap b) -{ - return type_Double != Mixed(b).get_type() || a != Mixed(b).get_double(); -} - - -// Compare mixed with string - -inline bool operator==(Wrap a, StringData b) noexcept -{ - return Mixed(a).get_type() == type_String && Mixed(a).get_string() == b; -} - -inline bool operator!=(Wrap a, StringData b) noexcept -{ - return Mixed(a).get_type() != type_String || Mixed(a).get_string() != b; -} - -inline bool operator==(StringData a, Wrap b) noexcept -{ - return type_String == Mixed(b).get_type() && a == Mixed(b).get_string(); -} - -inline bool operator!=(StringData a, Wrap b) noexcept -{ - return type_String != Mixed(b).get_type() || a != Mixed(b).get_string(); -} - -inline bool operator==(Wrap a, const char* b) noexcept -{ - return a == StringData(b); -} - -inline bool operator!=(Wrap a, const char* b) noexcept -{ - return a != StringData(b); -} - -inline bool operator==(const char* a, Wrap b) noexcept -{ - return StringData(a) == b; -} - -inline bool operator!=(const char* a, Wrap b) noexcept -{ - return StringData(a) != b; -} - -inline bool operator==(Wrap a, char* b) noexcept -{ - return a == StringData(b); -} - -inline bool operator!=(Wrap a, char* b) noexcept -{ - return a != StringData(b); -} - -inline bool operator==(char* a, Wrap b) noexcept -{ - return StringData(a) == b; -} - -inline bool operator!=(char* a, Wrap b) noexcept -{ - return StringData(a) != b; -} - - -// Compare mixed with binary data - -inline bool operator==(Wrap a, BinaryData b) noexcept -{ - return Mixed(a).get_type() == type_Binary && Mixed(a).get_binary() == b; -} - -inline bool operator!=(Wrap a, BinaryData b) noexcept -{ - return Mixed(a).get_type() != type_Binary || Mixed(a).get_binary() != b; -} - -inline bool operator==(BinaryData a, Wrap b) noexcept -{ - return type_Binary == Mixed(b).get_type() && a == Mixed(b).get_binary(); -} - -inline bool operator!=(BinaryData a, Wrap b) noexcept -{ - return type_Binary != Mixed(b).get_type() || a != Mixed(b).get_binary(); -} - - -// Compare mixed with date - -inline bool operator==(Wrap a, OldDateTime b) noexcept -{ - return Mixed(a).get_type() == type_OldDateTime && OldDateTime(Mixed(a).get_olddatetime()) == b; -} - -inline bool operator!=(Wrap a, OldDateTime b) noexcept -{ - return Mixed(a).get_type() != type_OldDateTime || OldDateTime(Mixed(a).get_olddatetime()) != b; -} - -inline bool operator==(OldDateTime a, Wrap b) noexcept -{ - return type_OldDateTime == Mixed(b).get_type() && a == OldDateTime(Mixed(b).get_olddatetime()); -} - -inline bool operator!=(OldDateTime a, Wrap b) noexcept -{ - return type_OldDateTime != Mixed(b).get_type() || a != OldDateTime(Mixed(b).get_olddatetime()); -} - - -} // namespace realm - -#endif // REALM_MIXED_HPP diff --git a/Pods/Realm/include/core/realm/null.hpp b/Pods/Realm/include/core/realm/null.hpp deleted file mode 100644 index be010b8f..00000000 --- a/Pods/Realm/include/core/realm/null.hpp +++ /dev/null @@ -1,164 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_NULL_HPP -#define REALM_NULL_HPP - -#include - -#include -#include -#include -#include - -namespace realm { - -/* -Represents null in Query, find(), get(), set(), etc. - -Float/Double: Realm can both store user-given NaNs and null. Any user-given signaling NaN is converted to -0x7fa00000 (if float) or 0x7ff4000000000000 (if double). Any user-given quiet NaN is converted to -0x7fc00000 (if float) or 0x7ff8000000000000 (if double). So Realm does not preserve the optional bits in -user-given NaNs. - -However, since both clang and gcc on x64 and ARM, and also Java on x64, return these bit patterns when -requesting NaNs, these will actually seem to roundtrip bit-exact for the end-user in most cases. - -If set_null() is called, a null is stored in form of the bit pattern 0xffffffff (if float) or -0xffffffffffffffff (if double). These are quiet NaNs. - -Executing a query that involves a float/double column that contains NaNs gives an undefined result. If -it contains signaling NaNs, it may throw an exception. - -Notes on IEEE: - -A NaN float is any bit pattern `s 11111111 S xxxxxxxxxxxxxxxxxxxxxx` where `s` and `x` are arbitrary, but at -least 1 `x` must be 1. If `S` is 1, it's a quiet NaN, else it's a signaling NaN. - -A NaN doubule is the same as above, but for `s eeeeeeeeeee S xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx` - -The `S` bit is at position 22 (float) or 51 (double). -*/ - -struct null { - null() - { - } - operator int64_t() - { - throw(LogicError::type_mismatch); - } - template - operator util::Optional() - { - return util::none; - } - - template - bool operator==(const T&) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator!=(const T&) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator>(const T&) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator>=(const T&) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator<=(const T&) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator<(const T&) const - { - REALM_ASSERT(false); - return false; - } - - /// Returns whether `v` bitwise equals the null bit-pattern - template - static bool is_null_float(T v) - { - T i = null::get_null_float(); - return std::memcmp(&i, &v, sizeof(T)) == 0; - } - - /// Returns the quiet NaNs that represent null for floats/doubles in Realm in stored payload. - template - static T get_null_float() - { - typename std::conditional::value, uint32_t, uint64_t>::type i; - int64_t double_nan = 0x7ff80000000000aa; - i = std::is_same::value ? 0x7fc000aa : static_cast(double_nan); - T d = type_punning(i); - REALM_ASSERT_DEBUG(std::isnan(d)); - REALM_ASSERT_DEBUG(!is_signaling(d)); - return d; - } - - /// Takes a NaN as argument and returns whether or not it's signaling - template - static bool is_signaling(T v) - { - REALM_ASSERT(std::isnan(static_cast(v))); - typename std::conditional::value, uint32_t, uint64_t>::type i; - size_t signal_bit = std::is_same::value ? 22 : 51; // If this bit is set, it's quiet - i = type_punning(v); - return !(i & (1ull << signal_bit)); - } - - /// Converts any signaling or quiet NaN to their their respective bit patterns that are used on x64 gcc+clang, - /// ARM clang and x64 Java. - template - static T to_realm(T v) - { - if (std::isnan(static_cast(v))) { - typename std::conditional::value, uint32_t, uint64_t>::type i; - if (std::is_same::value) { - i = is_signaling(v) ? 0x7fa00000 : 0x7fc00000; - } - else { - i = static_cast(is_signaling(v) ? 0x7ff4000000000000 : 0x7ff8000000000000); - } - return type_punning(i); - } - else { - return v; - } - } -}; - -} // namespace realm - -#endif // REALM_NULL_HPP diff --git a/Pods/Realm/include/core/realm/olddatetime.hpp b/Pods/Realm/include/core/realm/olddatetime.hpp deleted file mode 100644 index b662899e..00000000 --- a/Pods/Realm/include/core/realm/olddatetime.hpp +++ /dev/null @@ -1,157 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_DATETIME_HPP -#define REALM_DATETIME_HPP - -#include -#include - -namespace realm { - - -class OldDateTime { -public: - OldDateTime() noexcept - : m_time(0) - { - } - - /// Construct from the number of seconds since Jan 1 00:00:00 UTC - /// 1970. - /// FIXME: See if we can make this private again. Required by query_expression.hpp - OldDateTime(int_fast64_t d) noexcept - : m_time(d) - { - } - - /// Return the time as seconds since Jan 1 00:00:00 UTC 1970. - int_fast64_t get_olddatetime() const noexcept - { - return m_time; - } - - friend bool operator==(const OldDateTime&, const OldDateTime&) noexcept; - friend bool operator!=(const OldDateTime&, const OldDateTime&) noexcept; - friend bool operator<(const OldDateTime&, const OldDateTime&) noexcept; - friend bool operator<=(const OldDateTime&, const OldDateTime&) noexcept; - friend bool operator>(const OldDateTime&, const OldDateTime&) noexcept; - friend bool operator>=(const OldDateTime&, const OldDateTime&) noexcept; - - /// Construct from broken down local time. - /// - /// \note This constructor uses std::mktime() to convert the - /// specified local time to seconds since the Epoch, that is, the - /// result depends on the current globally specified time zone - /// setting. - /// - /// \param year The year (the minimum valid value is 1970). - /// - /// \param month The month in the range [1, 12]. - /// - /// \param day The day of the month in the range [1, 31]. - /// - /// \param hours Hours since midnight in the range [0, 23]. - /// - /// \param minutes Minutes after the hour in the range [0, 59]. - /// - /// \param seconds Seconds after the minute in the range [0, - /// 60]. Note that the range allows for leap seconds. - OldDateTime(int year, int month, int day, int hours = 0, int minutes = 0, int seconds = 0); - - template - friend std::basic_ostream& operator<<(std::basic_ostream& out, const OldDateTime&); - - // This is used by query_expression.hpp to generalize its templates and simplify the code *alot*; it is needed - // because OldDateTime is internally stored in an int64_t column. - operator int_fast64_t() noexcept; - -private: - int_fast64_t m_time; // Seconds since Jan 1 00:00:00 UTC 1970. - static std::time_t assemble(int year, int month, int day, int hours, int minutes, int seconds); - template - friend class Value; -}; - - -// Implementation: - -inline bool operator==(const OldDateTime& a, const OldDateTime& b) noexcept -{ - return a.m_time == b.m_time; -} - -inline bool operator!=(const OldDateTime& a, const OldDateTime& b) noexcept -{ - return a.m_time != b.m_time; -} - -inline bool operator<(const OldDateTime& a, const OldDateTime& b) noexcept -{ - return a.m_time < b.m_time; -} - -inline bool operator<=(const OldDateTime& a, const OldDateTime& b) noexcept -{ - return a.m_time <= b.m_time; -} - -inline bool operator>(const OldDateTime& a, const OldDateTime& b) noexcept -{ - return a.m_time > b.m_time; -} - -inline bool operator>=(const OldDateTime& a, const OldDateTime& b) noexcept -{ - return a.m_time >= b.m_time; -} - -inline OldDateTime::operator int_fast64_t() noexcept -{ - return m_time; -} - -inline OldDateTime::OldDateTime(int year, int month, int day, int hours, int minutes, int seconds) - : m_time(assemble(year, month, day, hours, minutes, seconds)) -{ -} - -template -inline std::basic_ostream& operator<<(std::basic_ostream& out, const OldDateTime& d) -{ - out << "OldDateTime(" << d.m_time << ")"; - return out; -} - -inline std::time_t OldDateTime::assemble(int year, int month, int day, int hours, int minutes, int seconds) -{ - std::tm local_time; - local_time.tm_year = year - 1900; - local_time.tm_mon = month - 1; - local_time.tm_mday = day; - local_time.tm_hour = hours; - local_time.tm_min = minutes; - local_time.tm_sec = seconds; - local_time.tm_isdst = -1; - return std::mktime(&local_time); -} - - -} // namespace realm - -#endif // REALM_DATETIME_HPP diff --git a/Pods/Realm/include/core/realm/owned_data.hpp b/Pods/Realm/include/core/realm/owned_data.hpp deleted file mode 100644 index 039ccc80..00000000 --- a/Pods/Realm/include/core/realm/owned_data.hpp +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_OWNED_DATA_HPP -#define REALM_OWNED_DATA_HPP - -#include -#include - -namespace realm { - -/// A chunk of owned data. -class OwnedData { -public: - /// Construct a null reference. - OwnedData() noexcept - { - } - - /// If \a data_to_copy is 'null', \a data_size must be zero. - OwnedData(const char* data_to_copy, size_t data_size) - : m_size(data_size) - { - REALM_ASSERT_DEBUG(data_to_copy || data_size == 0); - if (data_to_copy) { - m_data = std::unique_ptr(new char[data_size]); - memcpy(m_data.get(), data_to_copy, data_size); - } - } - - /// If \a unique_data is 'null', \a data_size must be zero. - OwnedData(std::unique_ptr unique_data, size_t data_size) noexcept - : m_data(std::move(unique_data)) - , m_size(data_size) - { - REALM_ASSERT_DEBUG(m_data || m_size == 0); - } - - OwnedData(const OwnedData& other) - : OwnedData(other.m_data.get(), other.m_size) - { - } - OwnedData& operator=(const OwnedData& other); - - OwnedData(OwnedData&&) = default; - OwnedData& operator=(OwnedData&&) = default; - - const char* data() const - { - return m_data.get(); - } - size_t size() const - { - return m_size; - } - -private: - std::unique_ptr m_data; - size_t m_size = 0; -}; - -inline OwnedData& OwnedData::operator=(const OwnedData& other) -{ - if (this != &other) { - if (other.m_data) { - m_data = std::unique_ptr(new char[other.m_size]); - memcpy(m_data.get(), other.m_data.get(), other.m_size); - } - else { - m_data = nullptr; - } - m_size = other.m_size; - } - return *this; -} - -} // namespace realm - -#endif // REALM_OWNED_DATA_HPP diff --git a/Pods/Realm/include/core/realm/query.hpp b/Pods/Realm/include/core/realm/query.hpp deleted file mode 100644 index f166cd99..00000000 --- a/Pods/Realm/include/core/realm/query.hpp +++ /dev/null @@ -1,458 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_QUERY_HPP -#define REALM_QUERY_HPP - -#include -#include -#include -#include -#include -#include - -#define REALM_MULTITHREAD_QUERY 0 - -#if REALM_MULTITHREAD_QUERY -// FIXME: Use our C++ thread abstraction API since it provides a much -// higher level of encapsulation and safety. -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace realm { - - -// Pre-declarations -class ParentNode; -class Table; -class TableView; -class TableViewBase; -class ConstTableView; -class Array; -class Expression; -class SequentialGetterBase; -class Group; - -struct QueryGroup { - enum class State { - Default, - OrCondition, - OrConditionChildren, - }; - - QueryGroup() = default; - - QueryGroup(const QueryGroup&); - QueryGroup& operator=(const QueryGroup&); - - QueryGroup(QueryGroup&&) = default; - QueryGroup& operator=(QueryGroup&&) = default; - - QueryGroup(const QueryGroup&, QueryNodeHandoverPatches&); - - std::unique_ptr m_root_node; - - bool m_pending_not = false; - size_t m_subtable_column = not_found; - State m_state = State::Default; -}; - -class Query final { -public: - Query(const Table& table, TableViewBase* tv = nullptr); - Query(const Table& table, std::unique_ptr); - Query(const Table& table, const LinkViewRef& lv); - Query(); - Query(std::unique_ptr); - ~Query() noexcept; - - Query(const Query& copy); - Query& operator=(const Query& source); - - Query(Query&&); - Query& operator=(Query&&); - - // Find links that point to a specific target row - Query& links_to(size_t column_ndx, const ConstRow& target_row); - - // Conditions: null - Query& equal(size_t column_ndx, null); - Query& not_equal(size_t column_ndx, null); - - // Conditions: int64_t - Query& equal(size_t column_ndx, int64_t value); - Query& not_equal(size_t column_ndx, int64_t value); - Query& greater(size_t column_ndx, int64_t value); - Query& greater_equal(size_t column_ndx, int64_t value); - Query& less(size_t column_ndx, int64_t value); - Query& less_equal(size_t column_ndx, int64_t value); - Query& between(size_t column_ndx, int64_t from, int64_t to); - - // Conditions: int (we need those because conversion from '1234' is ambiguous with float/double) - Query& equal(size_t column_ndx, int value); - Query& not_equal(size_t column_ndx, int value); - Query& greater(size_t column_ndx, int value); - Query& greater_equal(size_t column_ndx, int value); - Query& less(size_t column_ndx, int value); - Query& less_equal(size_t column_ndx, int value); - Query& between(size_t column_ndx, int from, int to); - - // Conditions: 2 int columns - Query& equal_int(size_t column_ndx1, size_t column_ndx2); - Query& not_equal_int(size_t column_ndx1, size_t column_ndx2); - Query& greater_int(size_t column_ndx1, size_t column_ndx2); - Query& less_int(size_t column_ndx1, size_t column_ndx2); - Query& greater_equal_int(size_t column_ndx1, size_t column_ndx2); - Query& less_equal_int(size_t column_ndx1, size_t column_ndx2); - - // Conditions: float - Query& equal(size_t column_ndx, float value); - Query& not_equal(size_t column_ndx, float value); - Query& greater(size_t column_ndx, float value); - Query& greater_equal(size_t column_ndx, float value); - Query& less(size_t column_ndx, float value); - Query& less_equal(size_t column_ndx, float value); - Query& between(size_t column_ndx, float from, float to); - - // Conditions: 2 float columns - Query& equal_float(size_t column_ndx1, size_t column_ndx2); - Query& not_equal_float(size_t column_ndx1, size_t column_ndx2); - Query& greater_float(size_t column_ndx1, size_t column_ndx2); - Query& greater_equal_float(size_t column_ndx1, size_t column_ndx2); - Query& less_float(size_t column_ndx1, size_t column_ndx2); - Query& less_equal_float(size_t column_ndx1, size_t column_ndx2); - - // Conditions: double - Query& equal(size_t column_ndx, double value); - Query& not_equal(size_t column_ndx, double value); - Query& greater(size_t column_ndx, double value); - Query& greater_equal(size_t column_ndx, double value); - Query& less(size_t column_ndx, double value); - Query& less_equal(size_t column_ndx, double value); - Query& between(size_t column_ndx, double from, double to); - - // Conditions: 2 double columns - Query& equal_double(size_t column_ndx1, size_t column_ndx2); - Query& not_equal_double(size_t column_ndx1, size_t column_ndx2); - Query& greater_double(size_t column_ndx1, size_t column_ndx2); - Query& greater_equal_double(size_t column_ndx1, size_t column_ndx2); - Query& less_double(size_t column_ndx1, size_t column_ndx2); - Query& less_equal_double(size_t column_ndx1, size_t column_ndx2); - - // Conditions: timestamp - Query& equal(size_t column_ndx, Timestamp value); - Query& not_equal(size_t column_ndx, Timestamp value); - Query& greater(size_t column_ndx, Timestamp value); - Query& greater_equal(size_t column_ndx, Timestamp value); - Query& less_equal(size_t column_ndx, Timestamp value); - Query& less(size_t column_ndx, Timestamp value); - - // Conditions: bool - Query& equal(size_t column_ndx, bool value); - - // Conditions: date - Query& equal_olddatetime(size_t column_ndx, OldDateTime value) - { - return equal(column_ndx, int64_t(value.get_olddatetime())); - } - Query& not_equal_olddatetime(size_t column_ndx, OldDateTime value) - { - return not_equal(column_ndx, int64_t(value.get_olddatetime())); - } - Query& greater_olddatetime(size_t column_ndx, OldDateTime value) - { - return greater(column_ndx, int64_t(value.get_olddatetime())); - } - Query& greater_equal_olddatetime(size_t column_ndx, OldDateTime value) - { - return greater_equal(column_ndx, int64_t(value.get_olddatetime())); - } - Query& less_olddatetime(size_t column_ndx, OldDateTime value) - { - return less(column_ndx, int64_t(value.get_olddatetime())); - } - Query& less_equal_olddatetime(size_t column_ndx, OldDateTime value) - { - return less_equal(column_ndx, int64_t(value.get_olddatetime())); - } - Query& between_olddatetime(size_t column_ndx, OldDateTime from, OldDateTime to) - { - return between(column_ndx, int64_t(from.get_olddatetime()), int64_t(to.get_olddatetime())); - } - - // Conditions: strings - Query& equal(size_t column_ndx, StringData value, bool case_sensitive = true); - Query& not_equal(size_t column_ndx, StringData value, bool case_sensitive = true); - Query& begins_with(size_t column_ndx, StringData value, bool case_sensitive = true); - Query& ends_with(size_t column_ndx, StringData value, bool case_sensitive = true); - Query& contains(size_t column_ndx, StringData value, bool case_sensitive = true); - Query& like(size_t column_ndx, StringData value, bool case_sensitive = true); - - // These are shortcuts for equal(StringData(c_str)) and - // not_equal(StringData(c_str)), and are needed to avoid unwanted - // implicit conversion of char* to bool. - Query& equal(size_t column_ndx, const char* c_str, bool case_sensitive = true); - Query& not_equal(size_t column_ndx, const char* c_str, bool case_sensitive = true); - - // Conditions: binary data - Query& equal(size_t column_ndx, BinaryData value); - Query& not_equal(size_t column_ndx, BinaryData value); - Query& begins_with(size_t column_ndx, BinaryData value); - Query& ends_with(size_t column_ndx, BinaryData value); - Query& contains(size_t column_ndx, BinaryData value); - - // Negation - Query& Not(); - - // Grouping - Query& group(); - Query& end_group(); - Query& subtable(size_t column); - Query& end_subtable(); - Query& Or(); - - Query& and_query(const Query& q); - Query& and_query(Query&& q); - Query operator||(const Query& q); - Query operator&&(const Query& q); - Query operator!(); - - - // Searching - size_t find(size_t begin_at_table_row = size_t(0)); - TableView find_all(size_t start = 0, size_t end = size_t(-1), size_t limit = size_t(-1)); - ConstTableView find_all(size_t start = 0, size_t end = size_t(-1), size_t limit = size_t(-1)) const; - - // Aggregates - size_t count(size_t start = 0, size_t end = size_t(-1), size_t limit = size_t(-1)) const; - - int64_t sum_int(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1)) const; - - double average_int(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1)) const; - - int64_t maximum_int(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1), size_t* return_ndx = nullptr) const; - - int64_t minimum_int(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1), size_t* return_ndx = nullptr) const; - - double sum_float(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1)) const; - - double average_float(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1)) const; - - float maximum_float(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1), size_t* return_ndx = nullptr) const; - - float minimum_float(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1), size_t* return_ndx = nullptr) const; - - double sum_double(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1)) const; - - double average_double(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1)) const; - - double maximum_double(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1), size_t* return_ndx = nullptr) const; - - double minimum_double(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1), size_t* return_ndx = nullptr) const; - - OldDateTime maximum_olddatetime(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, - size_t end = size_t(-1), size_t limit = size_t(-1), - size_t* return_ndx = nullptr) const; - - OldDateTime minimum_olddatetime(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, - size_t end = size_t(-1), size_t limit = size_t(-1), - size_t* return_ndx = nullptr) const; - - Timestamp maximum_timestamp(size_t column_ndx, size_t* return_ndx, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1)); - - Timestamp minimum_timestamp(size_t column_ndx, size_t* return_ndx, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1)); - - // Deletion - size_t remove(); - -#if REALM_MULTITHREAD_QUERY - // Multi-threading - TableView find_all_multi(size_t start = 0, size_t end = size_t(-1)); - ConstTableView find_all_multi(size_t start = 0, size_t end = size_t(-1)) const; - int set_threads(unsigned int threadcount); -#endif - - const TableRef& get_table() - { - return m_table; - } - - // True if matching rows are guaranteed to be returned in table order. - bool produces_results_in_table_order() const - { - return !m_view; - } - - // Calls sync_if_needed on the restricting view, if present. - // Returns the current version of the table(s) this query depends on, - // or util::none if the query is not associated with a table. - util::Optional sync_view_if_needed() const; - - std::string validate(); - -private: - Query(Table& table, TableViewBase* tv = nullptr); - void create(); - - void init() const; - size_t find_internal(size_t start = 0, size_t end = size_t(-1)) const; - size_t peek_tablerow(size_t row) const; - void handle_pending_not(); - void set_table(TableRef tr); - - static bool comp(const std::pair& a, const std::pair& b); - -public: - using HandoverPatch = QueryHandoverPatch; - - std::unique_ptr clone_for_handover(std::unique_ptr& patch, ConstSourcePayload mode) const - { - patch.reset(new HandoverPatch); - return std::make_unique(*this, *patch, mode); - } - - std::unique_ptr clone_for_handover(std::unique_ptr& patch, MutableSourcePayload mode) - { - patch.reset(new HandoverPatch); - return std::make_unique(*this, *patch, mode); - } - - void apply_and_consume_patch(std::unique_ptr& patch, Group& dest_group) - { - apply_patch(*patch, dest_group); - patch.reset(); - } - - void apply_patch(HandoverPatch& patch, Group& dest_group); - Query(const Query& source, HandoverPatch& patch, ConstSourcePayload mode); - Query(Query& source, HandoverPatch& patch, MutableSourcePayload mode); - -private: - void fetch_descriptor(); - - void add_expression_node(std::unique_ptr); - - template - Query& equal(size_t column_ndx1, size_t column_ndx2); - - template - Query& less(size_t column_ndx1, size_t column_ndx2); - - template - Query& less_equal(size_t column_ndx1, size_t column_ndx2); - - template - Query& greater(size_t column_ndx1, size_t column_ndx2); - - template - Query& greater_equal(size_t column_ndx1, size_t column_ndx2); - - template - Query& not_equal(size_t column_ndx1, size_t column_ndx2); - - template - Query& add_condition(size_t column_ndx, T value); - - template - double average(size_t column_ndx, size_t* resultcount = nullptr, size_t start = 0, size_t end = size_t(-1), - size_t limit = size_t(-1)) const; - - template - R aggregate(R (ColClass::*method)(size_t, size_t, size_t, size_t*) const, size_t column_ndx, size_t* resultcount, - size_t start, size_t end, size_t limit, size_t* return_ndx = nullptr) const; - - void aggregate_internal(Action TAction, DataType TSourceColumn, bool nullable, ParentNode* pn, QueryStateBase* st, - size_t start, size_t end, SequentialGetterBase* source_column) const; - - void find_all(TableViewBase& tv, size_t start = 0, size_t end = size_t(-1), size_t limit = size_t(-1)) const; - void delete_nodes() noexcept; - - bool has_conditions() const - { - return m_groups.size() > 0 && m_groups[0].m_root_node; - } - ParentNode* root_node() const - { - REALM_ASSERT(m_groups.size()); - return m_groups[0].m_root_node.get(); - } - - void add_node(std::unique_ptr); - - friend class Table; - friend class TableViewBase; - - std::string error_code; - - std::vector m_groups; - - // Used to access schema while building query: - std::vector m_subtable_path; - - ConstDescriptorRef m_current_descriptor; - TableRef m_table; - - // points to the base class of the restricting view. If the restricting - // view is a link view, m_source_link_view is non-zero. If it is a table view, - // m_source_table_view is non-zero. - RowIndexes* m_view = nullptr; - - // At most one of these can be non-zero, and if so the non-zero one indicates the restricting view. - LinkViewRef m_source_link_view; // link views are refcounted and shared. - TableViewBase* m_source_table_view = nullptr; // table views are not refcounted, and not owned by the query. - std::unique_ptr m_owned_source_table_view; // <--- except when indicated here -}; - -// Implementation: - -inline Query& Query::equal(size_t column_ndx, const char* c_str, bool case_sensitive) -{ - return equal(column_ndx, StringData(c_str), case_sensitive); -} - -inline Query& Query::not_equal(size_t column_ndx, const char* c_str, bool case_sensitive) -{ - return not_equal(column_ndx, StringData(c_str), case_sensitive); -} - -} // namespace realm - -#endif // REALM_QUERY_HPP diff --git a/Pods/Realm/include/core/realm/query_conditions.hpp b/Pods/Realm/include/core/realm/query_conditions.hpp deleted file mode 100644 index d7d571c4..00000000 --- a/Pods/Realm/include/core/realm/query_conditions.hpp +++ /dev/null @@ -1,715 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_QUERY_CONDITIONS_HPP -#define REALM_QUERY_CONDITIONS_HPP - -#include -#include - -#include -#include -#include - -namespace realm { - -// Array::VTable only uses the first 4 conditions (enums) in an array of function pointers -enum { cond_Equal, cond_NotEqual, cond_Greater, cond_Less, cond_VTABLE_FINDER_COUNT, cond_None, cond_LeftNotNull }; - -// Quick hack to make "Queries with Integer null columns" able to compile in Visual Studio 2015 which doesn't full -// support sfinae -// (real cause hasn't been investigated yet, cannot exclude that we don't obey c++11 standard) -struct HackClass { - template - bool can_match(A, B, C) - { - REALM_ASSERT(false); - return false; - } - template - bool will_match(A, B, C) - { - REALM_ASSERT(false); - return false; - } -}; - -// Does v2 contain v1? -struct Contains : public HackClass { - bool operator()(StringData v1, const char*, const char*, StringData v2, bool = false, bool = false) const - { - return v2.contains(v1); - } - bool operator()(StringData v1, StringData v2, bool = false, bool = false) const - { - return v2.contains(v1); - } - bool operator()(BinaryData v1, BinaryData v2, bool = false, bool = false) const - { - return v2.contains(v1); - } - bool operator()(StringData v1, const std::array &charmap, StringData v2) const - { - return v2.contains(v1, charmap); - } - - template - bool operator()(A, B) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - bool operator()(int64_t, int64_t, bool, bool) const - { - REALM_ASSERT(false); - return false; - } - - static const int condition = -1; -}; - -// Does v2 contain something like v1 (wildcard matching)? -struct Like : public HackClass { - bool operator()(StringData v1, const char*, const char*, StringData v2, bool = false, bool = false) const - { - return v2.like(v1); - } - bool operator()(StringData v1, StringData v2, bool = false, bool = false) const - { - return v2.like(v1); - } - bool operator()(BinaryData, BinaryData, bool = false, bool = false) const - { - REALM_ASSERT(false); - return false; - } - - template - bool operator()(A, B) const - { - REALM_ASSERT(false); - return false; - } - - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - - bool operator()(int64_t, int64_t, bool, bool) const - { - REALM_ASSERT(false); - return false; - } - - static const int condition = -1; -}; - -// Does v2 begin with v1? -struct BeginsWith : public HackClass { - bool operator()(StringData v1, const char*, const char*, StringData v2, bool = false, bool = false) const - { - return v2.begins_with(v1); - } - bool operator()(StringData v1, StringData v2, bool = false, bool = false) const - { - return v2.begins_with(v1); - } - bool operator()(BinaryData v1, BinaryData v2, bool = false, bool = false) const - { - return v2.begins_with(v1); - } - - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator()(A, B) const - { - REALM_ASSERT(false); - return false; - } - - static const int condition = -1; -}; - -// Does v2 end with v1? -struct EndsWith : public HackClass { - bool operator()(StringData v1, const char*, const char*, StringData v2, bool = false, bool = false) const - { - return v2.ends_with(v1); - } - bool operator()(StringData v1, StringData v2, bool = false, bool = false) const - { - return v2.ends_with(v1); - } - bool operator()(BinaryData v1, BinaryData v2, bool = false, bool = false) const - { - return v2.ends_with(v1); - } - - template - bool operator()(A, B) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - - static const int condition = -1; -}; - -struct Equal { - static const int avx = 0x00; // _CMP_EQ_OQ - // bool operator()(const bool v1, const bool v2, bool v1null = false, bool v2null = false) const { return v1 == - // v2; } - bool operator()(StringData v1, const char*, const char*, StringData v2, bool = false, bool = false) const - { - return v1 == v2; - } - bool operator()(BinaryData v1, BinaryData v2, bool = false, bool = false) const - { - return v1 == v2; - } - - template - bool operator()(const T& v1, const T& v2, bool v1null = false, bool v2null = false) const - { - return (v1null && v2null) || (!v1null && !v2null && v1 == v2); - } - static const int condition = cond_Equal; - bool can_match(int64_t v, int64_t lbound, int64_t ubound) - { - return (v >= lbound && v <= ubound); - } - bool will_match(int64_t v, int64_t lbound, int64_t ubound) - { - return (v == 0 && ubound == 0 && lbound == 0); - } -}; - -struct NotEqual { - static const int avx = 0x0B; // _CMP_FALSE_OQ - bool operator()(StringData v1, const char*, const char*, StringData v2, bool = false, bool = false) const - { - return v1 != v2; - } - // bool operator()(BinaryData v1, BinaryData v2, bool = false, bool = false) const { return v1 != v2; } - - template - bool operator()(const T& v1, const T& v2, bool v1null = false, bool v2null = false) const - { - if (!v1null && !v2null) - return v1 != v2; - - if (v1null && v2null) - return false; - - return true; - } - - static const int condition = cond_NotEqual; - bool can_match(int64_t v, int64_t lbound, int64_t ubound) - { - return !(v == 0 && ubound == 0 && lbound == 0); - } - bool will_match(int64_t v, int64_t lbound, int64_t ubound) - { - return (v > ubound || v < lbound); - } - - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } -}; - -// Does v2 contain v1? -struct ContainsIns : public HackClass { - bool operator()(StringData v1, const char* v1_upper, const char* v1_lower, StringData v2, bool = false, - bool = false) const - { - if (v2.is_null() && !v1.is_null()) - return false; - - if (v1.size() == 0 && !v2.is_null()) - return true; - - return search_case_fold(v2, v1_upper, v1_lower, v1.size()) != v2.size(); - } - - // Slow version, used if caller hasn't stored an upper and lower case version - bool operator()(StringData v1, StringData v2, bool = false, bool = false) const - { - if (v2.is_null() && !v1.is_null()) - return false; - - if (v1.size() == 0 && !v2.is_null()) - return true; - - std::string v1_upper = case_map(v1, true, IgnoreErrors); - std::string v1_lower = case_map(v1, false, IgnoreErrors); - return search_case_fold(v2, v1_upper.c_str(), v1_lower.c_str(), v1.size()) != v2.size(); - } - - // Case insensitive Boyer-Moore version - bool operator()(StringData v1, const char* v1_upper, const char* v1_lower, const std::array &charmap, StringData v2) const - { - if (v2.is_null() && !v1.is_null()) - return false; - - if (v1.size() == 0 && !v2.is_null()) - return true; - - return contains_ins(v2, v1_upper, v1_lower, v1.size(), charmap); - } - - - template - bool operator()(A, B) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - bool operator()(int64_t, int64_t, bool, bool) const - { - REALM_ASSERT(false); - return false; - } - - static const int condition = -1; -}; - -// Does v2 contain something like v1 (wildcard matching)? -struct LikeIns : public HackClass { - bool operator()(StringData v1, const char* v1_upper, const char* v1_lower, StringData v2, bool = false, - bool = false) const - { - if (v2.is_null() || v1.is_null()) { - return (v2.is_null() && v1.is_null()); - } - - return string_like_ins(v2, v1_lower, v1_upper); - } - - // Slow version, used if caller hasn't stored an upper and lower case version - bool operator()(StringData v1, StringData v2, bool = false, bool = false) const - { - if (v2.is_null() || v1.is_null()) { - return (v2.is_null() && v1.is_null()); - } - - std::string v1_upper = case_map(v1, true, IgnoreErrors); - std::string v1_lower = case_map(v1, false, IgnoreErrors); - return string_like_ins(v2, v1_lower, v1_upper); - } - - template - bool operator()(A, B) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - bool operator()(int64_t, int64_t, bool, bool) const - { - REALM_ASSERT(false); - return false; - } - - static const int condition = -1; -}; - -// Does v2 begin with v1? -struct BeginsWithIns : public HackClass { - bool operator()(StringData v1, const char* v1_upper, const char* v1_lower, StringData v2, bool = false, - bool = false) const - { - if (v2.is_null() && !v1.is_null()) - return false; - return v1.size() <= v2.size() && equal_case_fold(v2.prefix(v1.size()), v1_upper, v1_lower); - } - - // Slow version, used if caller hasn't stored an upper and lower case version - bool operator()(StringData v1, StringData v2, bool = false, bool = false) const - { - if (v2.is_null() && !v1.is_null()) - return false; - - if (v1.size() > v2.size()) - return false; - std::string v1_upper = case_map(v1, true, IgnoreErrors); - std::string v1_lower = case_map(v1, false, IgnoreErrors); - return equal_case_fold(v2.prefix(v1.size()), v1_upper.c_str(), v1_lower.c_str()); - } - - template - bool operator()(A, B) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - bool operator()(int64_t, int64_t, bool, bool) const - { - REALM_ASSERT(false); - return false; - } - - static const int condition = -1; -}; - -// Does v2 end with v1? -struct EndsWithIns : public HackClass { - bool operator()(StringData v1, const char* v1_upper, const char* v1_lower, StringData v2, bool = false, - bool = false) const - { - if (v2.is_null() && !v1.is_null()) - return false; - - return v1.size() <= v2.size() && equal_case_fold(v2.suffix(v1.size()), v1_upper, v1_lower); - } - - // Slow version, used if caller hasn't stored an upper and lower case version - bool operator()(StringData v1, StringData v2, bool = false, bool = false) const - { - if (v2.is_null() && !v1.is_null()) - return false; - - if (v1.size() > v2.size()) - return false; - std::string v1_upper = case_map(v1, true, IgnoreErrors); - std::string v1_lower = case_map(v1, false, IgnoreErrors); - return equal_case_fold(v2.suffix(v1.size()), v1_upper.c_str(), v1_lower.c_str()); - } - - template - bool operator()(A, B) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - bool operator()(int64_t, int64_t, bool, bool) const - { - REALM_ASSERT(false); - return false; - } - - static const int condition = -1; -}; - -struct EqualIns : public HackClass { - bool operator()(StringData v1, const char* v1_upper, const char* v1_lower, StringData v2, bool = false, - bool = false) const - { - if (v1.is_null() != v2.is_null()) - return false; - - return v1.size() == v2.size() && equal_case_fold(v2, v1_upper, v1_lower); - } - - // Slow version, used if caller hasn't stored an upper and lower case version - bool operator()(StringData v1, StringData v2, bool = false, bool = false) const - { - if (v1.is_null() != v2.is_null()) - return false; - - if (v1.size() != v2.size()) - return false; - std::string v1_upper = case_map(v1, true, IgnoreErrors); - std::string v1_lower = case_map(v1, false, IgnoreErrors); - return equal_case_fold(v2, v1_upper.c_str(), v1_lower.c_str()); - } - - template - bool operator()(A, B) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - bool operator()(int64_t, int64_t, bool, bool) const - { - REALM_ASSERT(false); - return false; - } - - static const int condition = -1; -}; - -struct NotEqualIns : public HackClass { - bool operator()(StringData v1, const char* v1_upper, const char* v1_lower, StringData v2, bool = false, - bool = false) const - { - if (v1.is_null() != v2.is_null()) - return true; - return v1.size() != v2.size() || !equal_case_fold(v2, v1_upper, v1_lower); - } - - // Slow version, used if caller hasn't stored an upper and lower case version - bool operator()(StringData v1, StringData v2, bool = false, bool = false) const - { - if (v1.is_null() != v2.is_null()) - return true; - - if (v1.size() != v2.size()) - return true; - std::string v1_upper = case_map(v1, true, IgnoreErrors); - std::string v1_lower = case_map(v1, false, IgnoreErrors); - return !equal_case_fold(v2, v1_upper.c_str(), v1_lower.c_str()); - } - - template - bool operator()(A, B) const - { - REALM_ASSERT(false); - return false; - } - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - - static const int condition = -1; -}; - -struct Greater { - static const int avx = 0x1E; // _CMP_GT_OQ - template - bool operator()(const T& v1, const T& v2, bool v1null = false, bool v2null = false) const - { - if (v1null || v2null) - return false; - - return v1 > v2; - } - static const int condition = cond_Greater; - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - - bool can_match(int64_t v, int64_t lbound, int64_t ubound) - { - static_cast(lbound); - return ubound > v; - } - bool will_match(int64_t v, int64_t lbound, int64_t ubound) - { - static_cast(ubound); - return lbound > v; - } -}; - -struct None { - template - bool operator()(const T&, const T&, bool = false, bool = false) const - { - return true; - } - static const int condition = cond_None; - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - bool can_match(int64_t v, int64_t lbound, int64_t ubound) - { - static_cast(lbound); - static_cast(ubound); - static_cast(v); - return true; - } - bool will_match(int64_t v, int64_t lbound, int64_t ubound) - { - static_cast(lbound); - static_cast(ubound); - static_cast(v); - return true; - } -}; - -struct NotNull { - template - bool operator()(const T&, const T&, bool v = false, bool = false) const - { - return !v; - } - static const int condition = cond_LeftNotNull; - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - bool can_match(int64_t v, int64_t lbound, int64_t ubound) - { - static_cast(lbound); - static_cast(ubound); - static_cast(v); - return true; - } - bool will_match(int64_t v, int64_t lbound, int64_t ubound) - { - static_cast(lbound); - static_cast(ubound); - static_cast(v); - return true; - } -}; - - -struct Less { - static const int avx = 0x11; // _CMP_LT_OQ - template - bool operator()(const T& v1, const T& v2, bool v1null = false, bool v2null = false) const - { - if (v1null || v2null) - return false; - - return v1 < v2; - } - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - static const int condition = cond_Less; - bool can_match(int64_t v, int64_t lbound, int64_t ubound) - { - static_cast(ubound); - return lbound < v; - } - bool will_match(int64_t v, int64_t lbound, int64_t ubound) - { - static_cast(lbound); - return ubound < v; - } -}; - -struct LessEqual : public HackClass { - static const int avx = 0x12; // _CMP_LE_OQ - template - bool operator()(const T& v1, const T& v2, bool v1null = false, bool v2null = false) const - { - if (v1null && v2null) - return true; - - return (!v1null && !v2null && v1 <= v2); - } - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - static const int condition = -1; -}; - -struct GreaterEqual : public HackClass { - static const int avx = 0x1D; // _CMP_GE_OQ - template - bool operator()(const T& v1, const T& v2, bool v1null = false, bool v2null = false) const - { - if (v1null && v2null) - return true; - - return (!v1null && !v2null && v1 >= v2); - } - template - bool operator()(A, B, C, D) const - { - REALM_ASSERT(false); - return false; - } - static const int condition = -1; -}; - - -// CompareLess is a temporary hack to have a generalized way to compare any realm types. Todo, enable correct < -// operator of StringData (currently gives circular header dependency with utf8.hpp) -template -struct CompareLess { - static bool compare(T v1, T v2, bool = false, bool = false) - { - return v1 < v2; - } -}; -template <> -struct CompareLess { - static bool compare(StringData v1, StringData v2, bool = false, bool = false) - { - bool ret = utf8_compare(v1.data(), v2.data()); - return ret; - } -}; - -} // namespace realm - -#endif // REALM_QUERY_CONDITIONS_HPP diff --git a/Pods/Realm/include/core/realm/query_engine.hpp b/Pods/Realm/include/core/realm/query_engine.hpp deleted file mode 100644 index f916e807..00000000 --- a/Pods/Realm/include/core/realm/query_engine.hpp +++ /dev/null @@ -1,1990 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -/* -A query consists of node objects, one for each query condition. Each node contains pointers to all other nodes: - -node1 node2 node3 ------- ----- ----- -node2* node1* node1* -node3* node3* node2* - -The construction of all this takes part in query.cpp. Each node has two important functions: - - aggregate(start, end) - aggregate_local(start, end) - -The aggregate() function executes the aggregate of a query. You can call the method on any of the nodes -(except children nodes of OrNode and SubtableNode) - it has the same behaviour. The function contains -scheduling that calls aggregate_local(start, end) on different nodes with different start/end ranges, -depending on what it finds is most optimal. - -The aggregate_local() function contains a tight loop that tests the condition of its own node, and upon match -it tests all other conditions at that index to report a full match or not. It will remain in the tight loop -after a full match. - -So a call stack with 2 and 9 being local matches of a node could look like this: - -aggregate(0, 10) - node1->aggregate_local(0, 3) - node2->find_first_local(2, 3) - node3->find_first_local(2, 3) - node3->aggregate_local(3, 10) - node1->find_first_local(4, 5) - node2->find_first_local(4, 5) - node1->find_first_local(7, 8) - node2->find_first_local(7, 8) - -find_first_local(n, n + 1) is a function that can be used to test a single row of another condition. Note that -this is very simplified. There are other statistical arguments to the methods, and also, find_first_local() can be -called from a callback function called by an integer Array. - - -Template arguments in methods: ----------------------------------------------------------------------------------------------------- - -TConditionFunction: Each node has a condition from query_conditions.c such as Equal, GreaterEqual, etc - -TConditionValue: Type of values in condition column. That is, int64_t, float, int, bool, etc - -TAction: What to do with each search result, from the enums act_ReturnFirst, act_Count, act_Sum, etc - -TResult: Type of result of actions - float, double, int64_t, etc. Special notes: For act_Count it's - int64_t, for RLM_FIND_ALL it's int64_t which points at destination array. - -TSourceColumn: Type of source column used in actions, or *ignored* if no source column is used (like for - act_Count, act_ReturnFirst) - - -There are two important classes used in queries: ----------------------------------------------------------------------------------------------------- -SequentialGetter Column iterator used to get successive values with leaf caching. Used both for condition columns - and aggregate source column - -AggregateState State of the aggregate - contains a state variable that stores intermediate sum, max, min, - etc, etc. - -*/ - -#ifndef REALM_QUERY_ENGINE_HPP -#define REALM_QUERY_ENGINE_HPP - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 160040219 -#include -#endif - -namespace realm { - -// Number of matches to find in best condition loop before breaking out to probe other conditions. Too low value gives -// too many constant time overheads everywhere in the query engine. Too high value makes it adapt less rapidly to -// changes in match frequencies. -const size_t findlocals = 64; - -// Average match distance in linear searches where further increase in distance no longer increases query speed -// (because time spent on handling each match becomes insignificant compared to time spent on the search). -const size_t bestdist = 512; - -// Minimum number of matches required in a certain condition before it can be used to compute statistics. Too high -// value can spent too much time in a bad node (with high match frequency). Too low value gives inaccurate statistics. -const size_t probe_matches = 4; - -const size_t bitwidth_time_unit = 64; - -typedef bool (*CallbackDummy)(int64_t); - - -class ParentNode { - typedef ParentNode ThisType; - -public: - ParentNode() = default; - virtual ~ParentNode() = default; - - void gather_children(std::vector& v) - { - m_children.clear(); - size_t i = v.size(); - v.push_back(this); - - if (m_child) - m_child->gather_children(v); - - m_children = v; - m_children.erase(m_children.begin() + i); - m_children.insert(m_children.begin(), this); - } - - double cost() const - { - return 8 * bitwidth_time_unit / m_dD + - m_dT; // dt = 1/64 to 1. Match dist is 8 times more important than bitwidth - } - - size_t find_first(size_t start, size_t end); - - virtual void init() - { - if (m_child) - m_child->init(); - m_column_action_specializer = nullptr; - } - - void set_table(const Table& table) - { - if (&table == m_table) - return; - - m_table.reset(&table); - if (m_child) - m_child->set_table(table); - table_changed(); - } - - virtual size_t find_first_local(size_t start, size_t end) = 0; - - virtual void aggregate_local_prepare(Action TAction, DataType col_id, bool nullable); - - template - bool column_action_specialization(QueryStateBase* st, SequentialGetterBase* source_column, size_t r) - { - // TResult: type of query result - // TSourceValue: type of aggregate source - using TSourceValue = typename TSourceColumn::value_type; - using TResult = typename ColumnTypeTraitsSum::sum_type; - - // Sum of float column must accumulate in double - static_assert(!(TAction == act_Sum && - (std::is_same::value && !std::is_same::value)), - ""); - - TSourceValue av{}; - // uses_val test because compiler cannot see that IntegerColumn::get has no side effect and result is - // discarded - if (static_cast*>(st)->template uses_val() && source_column != nullptr) { - REALM_ASSERT_DEBUG(dynamic_cast*>(source_column) != nullptr); - av = static_cast*>(source_column)->get_next(r); - } - REALM_ASSERT_DEBUG(dynamic_cast*>(st) != nullptr); - bool cont = static_cast*>(st)->template match(r, 0, av); - return cont; - } - - virtual size_t aggregate_local(QueryStateBase* st, size_t start, size_t end, size_t local_limit, - SequentialGetterBase* source_column); - - - virtual std::string validate() - { - if (error_code != "") - return error_code; - if (m_child == nullptr) - return ""; - else - return m_child->validate(); - } - - ParentNode(const ParentNode& from) - : ParentNode(from, nullptr) - { - } - - ParentNode(const ParentNode& from, QueryNodeHandoverPatches* patches) - : m_child(from.m_child ? from.m_child->clone(patches) : nullptr) - , m_condition_column_idx(from.m_condition_column_idx) - , m_dD(from.m_dD) - , m_dT(from.m_dT) - , m_probes(from.m_probes) - , m_matches(from.m_matches) - , m_table(patches ? ConstTableRef{} : from.m_table) - { - } - - void add_child(std::unique_ptr child) - { - if (m_child) - m_child->add_child(std::move(child)); - else - m_child = std::move(child); - } - - virtual std::unique_ptr clone(QueryNodeHandoverPatches* = nullptr) const = 0; - - virtual void apply_handover_patch(QueryNodeHandoverPatches& patches, Group& group) - { - if (m_child) - m_child->apply_handover_patch(patches, group); - } - - std::unique_ptr m_child; - std::vector m_children; - size_t m_condition_column_idx = npos; // Column of search criteria - - double m_dD; // Average row distance between each local match at current position - double m_dT = 0.0; // Time overhead of testing index i + 1 if we have just tested index i. > 1 for linear scans, 0 - // for index/tableview - - size_t m_probes = 0; - size_t m_matches = 0; - -protected: - typedef bool (ParentNode::*Column_action_specialized)(QueryStateBase*, SequentialGetterBase*, size_t); - Column_action_specialized m_column_action_specializer; - ConstTableRef m_table; - std::string error_code; - - const ColumnBase& get_column_base(size_t ndx) - { - return m_table->get_column_base(ndx); - } - - template - const ColType& get_column(size_t ndx) - { - auto& col = m_table->get_column_base(ndx); - REALM_ASSERT_DEBUG(dynamic_cast(&col)); - return static_cast(col); - } - - ColumnType get_real_column_type(size_t ndx) - { - return m_table->get_real_column_type(ndx); - } - - template - void copy_getter(SequentialGetter& dst, size_t& dst_idx, const SequentialGetter& src, - const QueryNodeHandoverPatches* patches) - { - if (src.m_column) { - if (patches) - dst_idx = src.m_column->get_column_index(); - else - dst.init(src.m_column); - } - } - -private: - virtual void table_changed() = 0; -}; - -// For conditions on a subtable (encapsulated in subtable()...end_subtable()). These return the parent row as match if -// and -// only if one or more subtable rows match the condition. -class SubtableNode : public ParentNode { -public: - SubtableNode(size_t column, std::unique_ptr condition) - : m_condition(std::move(condition)) - { - m_dT = 100.0; - m_condition_column_idx = column; - } - - void init() override - { - m_dD = 10.0; - - // m_condition is first node in condition of subtable query. - if (m_condition) { - // Can't call init() here as usual since the subtable can be degenerate - // m_condition->init(table); - std::vector v; - m_condition->gather_children(v); - } - - // m_child is next node of parent query - if (m_child) - m_child->init(); - } - - void table_changed() override - { - m_col_type = m_table->get_real_column_type(m_condition_column_idx); - REALM_ASSERT(m_col_type == col_type_Table || m_col_type == col_type_Mixed); - if (m_col_type == col_type_Table) - m_column = &m_table->get_column_table(m_condition_column_idx); - else // Mixed - m_column = &m_table->get_column_mixed(m_condition_column_idx); - } - - std::string validate() override - { - if (error_code != "") - return error_code; - if (m_condition == nullptr) - return "Unbalanced subtable/end_subtable block"; - else - return m_condition->validate(); - } - - size_t find_first_local(size_t start, size_t end) override - { - REALM_ASSERT(m_table); - REALM_ASSERT(m_condition); - - for (size_t s = start; s < end; ++s) { - const Table* subtable; - if (m_col_type == col_type_Table) - subtable = static_cast(m_column)->get_subtable_ptr(s); - else { - subtable = static_cast(m_column)->get_subtable_ptr(s); - if (!subtable) - continue; - } - - if (subtable->is_degenerate()) - return not_found; - - m_condition->set_table(*subtable); - m_condition->init(); - const size_t subsize = subtable->size(); - const size_t sub = m_condition->find_first(0, subsize); - - if (sub != not_found) - return s; - } - return not_found; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new SubtableNode(*this, patches)); - } - - SubtableNode(const SubtableNode& from, QueryNodeHandoverPatches* patches) - : ParentNode(from, patches) - , m_condition(from.m_condition ? from.m_condition->clone(patches) : nullptr) - , m_column(from.m_column) - , m_col_type(from.m_col_type) - { - if (m_column && patches) - m_condition_column_idx = m_column->get_column_index(); - } - - void apply_handover_patch(QueryNodeHandoverPatches& patches, Group& group) override - { - m_condition->apply_handover_patch(patches, group); - ParentNode::apply_handover_patch(patches, group); - } - - std::unique_ptr m_condition; - const ColumnBase* m_column = nullptr; - ColumnType m_col_type; -}; - -namespace _impl { - -template -struct CostHeuristic; - -template <> -struct CostHeuristic { - static constexpr double dD() - { - return 100.0; - } - static constexpr double dT() - { - return 1.0 / 4.0; - } -}; - -template <> -struct CostHeuristic { - static constexpr double dD() - { - return 100.0; - } - static constexpr double dT() - { - return 1.0 / 4.0; - } -}; - -// FIXME: Add AdaptiveStringColumn, BasicColumn, etc. -} - -class ColumnNodeBase : public ParentNode { -protected: - ColumnNodeBase(size_t column_idx) - { - m_condition_column_idx = column_idx; - } - - ColumnNodeBase(const ColumnNodeBase& from, QueryNodeHandoverPatches* patches) - : ParentNode(from, patches) - , m_last_local_match(from.m_last_local_match) - , m_local_matches(from.m_local_matches) - , m_local_limit(from.m_local_limit) - , m_fastmode_disabled(from.m_fastmode_disabled) - , m_action(from.m_action) - , m_state(from.m_state) - , m_source_column(from.m_source_column) - { - } - - template - bool match_callback(int64_t v) - { - using TSourceValue = typename ColType::value_type; - using QueryStateType = typename ColumnTypeTraitsSum::sum_type; - - size_t i = to_size_t(v); - m_last_local_match = i; - m_local_matches++; - - auto state = static_cast*>(m_state); - auto source_column = static_cast*>(m_source_column); - - // Test remaining sub conditions of this node. m_children[0] is the node that called match_callback(), so skip - // it - for (size_t c = 1; c < m_children.size(); c++) { - m_children[c]->m_probes++; - size_t m = m_children[c]->find_first_local(i, i + 1); - if (m != i) - return true; - } - - bool b; - if (state->template uses_val()) { // Compiler cannot see that IntegerColumn::Get has no side effect - // and result is discarded - TSourceValue av = source_column->get_next(i); - b = state->template match(i, 0, av); - } - else { - b = state->template match(i, 0, TSourceValue{}); - } - - return b; - } - - // Aggregate bookkeeping - size_t m_last_local_match = npos; - size_t m_local_matches = 0; - size_t m_local_limit = 0; - bool m_fastmode_disabled = false; - Action m_action; - QueryStateBase* m_state = nullptr; - SequentialGetterBase* m_source_column = - nullptr; // Column of values used in aggregate (act_FindAll, actReturnFirst, act_Sum, etc) -}; - -template -class IntegerNodeBase : public ColumnNodeBase { - using ThisType = IntegerNodeBase; - -public: - using TConditionValue = typename ColType::value_type; - static const bool nullable = ColType::nullable; - - template - bool find_callback_specialization(size_t s, size_t end_in_leaf) - { - using AggregateColumnType = typename GetColumnType::type; - bool cont; - size_t start_in_leaf = s - this->m_leaf_start; - cont = this->m_leaf_ptr->template find( - m_value, start_in_leaf, end_in_leaf, this->m_leaf_start, nullptr, - std::bind(std::mem_fn(&ThisType::template match_callback), this, - std::placeholders::_1)); - return cont; - } - -protected: - using LeafType = typename ColType::LeafType; - using LeafInfo = typename ColType::LeafInfo; - - size_t aggregate_local_impl(QueryStateBase* st, size_t start, size_t end, size_t local_limit, - SequentialGetterBase* source_column, int c) - { - REALM_ASSERT(m_children.size() > 0); - m_local_matches = 0; - m_local_limit = local_limit; - m_last_local_match = start - 1; - m_state = st; - - // If there are no other nodes than us (m_children.size() == 1) AND the column used for our condition is - // the same as the column used for the aggregate action, then the entire query can run within scope of that - // column only, with no references to other columns: - bool fastmode = should_run_in_fastmode(source_column); - for (size_t s = start; s < end;) { - cache_leaf(s); - - size_t end_in_leaf; - if (end > m_leaf_end) - end_in_leaf = m_leaf_end - m_leaf_start; - else - end_in_leaf = end - m_leaf_start; - - if (fastmode) { - bool cont; - size_t start_in_leaf = s - m_leaf_start; - cont = m_leaf_ptr->find(c, m_action, m_value, start_in_leaf, end_in_leaf, m_leaf_start, - static_cast*>(st)); - if (!cont) - return not_found; - } - // Else, for each match in this node, call our IntegerNodeBase::match_callback to test remaining nodes - // and/or extract - // aggregate payload from aggregate column: - else { - m_source_column = source_column; - bool cont = (this->*m_find_callback_specialized)(s, end_in_leaf); - if (!cont) - return not_found; - } - - if (m_local_matches == m_local_limit) - break; - - s = end_in_leaf + m_leaf_start; - } - - if (m_local_matches == m_local_limit) { - m_dD = (m_last_local_match + 1 - start) / (m_local_matches + 1.0); - return m_last_local_match + 1; - } - else { - m_dD = (end - start) / (m_local_matches + 1.0); - return end; - } - } - - IntegerNodeBase(TConditionValue value, size_t column_idx) - : ColumnNodeBase(column_idx) - , m_value(std::move(value)) - { - } - - IntegerNodeBase(const ThisType& from, QueryNodeHandoverPatches* patches) - : ColumnNodeBase(from, patches) - , m_value(from.m_value) - , m_condition_column(from.m_condition_column) - , m_find_callback_specialized(from.m_find_callback_specialized) - { - if (m_condition_column && patches) - m_condition_column_idx = m_condition_column->get_column_index(); - } - - void table_changed() override - { - m_condition_column = &get_column(m_condition_column_idx); - } - - void init() override - { - ColumnNodeBase::init(); - - m_dT = _impl::CostHeuristic::dT(); - m_dD = _impl::CostHeuristic::dD(); - - // Clear leaf cache - m_leaf_end = 0; - m_array_ptr.reset(); // Explicitly destroy the old one first, because we're reusing the memory. - m_array_ptr.reset(new (&m_leaf_cache_storage) LeafType(m_table->get_alloc())); - - if (m_child) - m_child->init(); - } - - void get_leaf(const ColType& col, size_t ndx) - { - size_t ndx_in_leaf; - LeafInfo leaf_info{&m_leaf_ptr, m_array_ptr.get()}; - col.get_leaf(ndx, ndx_in_leaf, leaf_info); - m_leaf_start = ndx - ndx_in_leaf; - m_leaf_end = m_leaf_start + m_leaf_ptr->size(); - } - - void cache_leaf(size_t s) - { - if (s >= m_leaf_end || s < m_leaf_start) { - get_leaf(*m_condition_column, s); - size_t w = m_leaf_ptr->get_width(); - m_dT = (w == 0 ? 1.0 / REALM_MAX_BPNODE_SIZE : w / float(bitwidth_time_unit)); - } - } - - bool should_run_in_fastmode(SequentialGetterBase* source_column) const - { - return (m_children.size() == 1 && - (source_column == nullptr || - (!m_fastmode_disabled && - static_cast*>(source_column)->m_column == m_condition_column))); - } - - // Search value: - TConditionValue m_value; - - // Column on which search criteria are applied - const ColType* m_condition_column = nullptr; - - // Leaf cache - using LeafCacheStorage = typename std::aligned_storage::type; - LeafCacheStorage m_leaf_cache_storage; - std::unique_ptr m_array_ptr; - const LeafType* m_leaf_ptr = nullptr; - size_t m_leaf_start = npos; - size_t m_leaf_end = 0; - size_t m_local_end; - - // Aggregate optimization - using TFind_callback_specialized = bool (ThisType::*)(size_t, size_t); - TFind_callback_specialized m_find_callback_specialized = nullptr; -}; - -// FIXME: Add specialization that uses index for TConditionFunction = Equal -template -class IntegerNode : public IntegerNodeBase { - using BaseType = IntegerNodeBase; - using ThisType = IntegerNode; - -public: - static const bool special_null_node = false; - using TConditionValue = typename BaseType::TConditionValue; - - IntegerNode(TConditionValue value, size_t column_ndx) - : BaseType(value, column_ndx) - { - } - IntegerNode(const IntegerNode& from, QueryNodeHandoverPatches* patches) - : BaseType(from, patches) - { - } - - void aggregate_local_prepare(Action action, DataType col_id, bool nullable) override - { - this->m_fastmode_disabled = (col_id == type_Float || col_id == type_Double); - this->m_action = action; - this->m_find_callback_specialized = get_specialized_callback(action, col_id, nullable); - } - - size_t aggregate_local(QueryStateBase* st, size_t start, size_t end, size_t local_limit, - SequentialGetterBase* source_column) override - { - constexpr int cond = TConditionFunction::condition; - return this->aggregate_local_impl(st, start, end, local_limit, source_column, cond); - } - - size_t find_first_local(size_t start, size_t end) override - { - REALM_ASSERT(this->m_table); - - while (start < end) { - - // Cache internal leaves - if (start >= this->m_leaf_end || start < this->m_leaf_start) { - this->get_leaf(*this->m_condition_column, start); - } - - // FIXME: Create a fast bypass when you just need to check 1 row, which is used alot from within core. - // It should just call array::get and save the initial overhead of find_first() which has become quite - // big. Do this when we have cleaned up core a bit more. - - size_t end2; - if (end > this->m_leaf_end) - end2 = this->m_leaf_end - this->m_leaf_start; - else - end2 = end - this->m_leaf_start; - - size_t s; - s = this->m_leaf_ptr->template find_first(this->m_value, start - this->m_leaf_start, - end2); - - if (s == not_found) { - start = this->m_leaf_end; - continue; - } - else - return s + this->m_leaf_start; - } - - return not_found; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new IntegerNode(*this, patches)); - } - -protected: - using TFind_callback_specialized = typename BaseType::TFind_callback_specialized; - - static TFind_callback_specialized get_specialized_callback(Action action, DataType col_id, bool nullable) - { - switch (action) { - case act_Count: - return get_specialized_callback_2_int(col_id, nullable); - case act_Sum: - return get_specialized_callback_2(col_id, nullable); - case act_Max: - return get_specialized_callback_2(col_id, nullable); - case act_Min: - return get_specialized_callback_2(col_id, nullable); - case act_FindAll: - return get_specialized_callback_2_int(col_id, nullable); - case act_CallbackIdx: - return get_specialized_callback_2_int(col_id, nullable); - default: - break; - } - REALM_ASSERT(false); // Invalid aggregate function - return nullptr; - } - - template - static TFind_callback_specialized get_specialized_callback_2(DataType col_id, bool nullable) - { - switch (col_id) { - case type_Int: - return get_specialized_callback_3(nullable); - case type_Float: - return get_specialized_callback_3(nullable); - case type_Double: - return get_specialized_callback_3(nullable); - default: - break; - } - REALM_ASSERT(false); // Invalid aggregate source column - return nullptr; - } - - template - static TFind_callback_specialized get_specialized_callback_2_int(DataType col_id, bool nullable) - { - if (col_id == type_Int) { - return get_specialized_callback_3(nullable); - } - REALM_ASSERT(false); // Invalid aggregate source column - return nullptr; - } - - template - static TFind_callback_specialized get_specialized_callback_3(bool nullable) - { - if (nullable) { - return &BaseType::template find_callback_specialization; - } - else { - return &BaseType::template find_callback_specialization; - } - } -}; - -// This node is currently used for floats and doubles only -template -class FloatDoubleNode : public ParentNode { -public: - using TConditionValue = typename ColType::value_type; - static const bool special_null_node = false; - - FloatDoubleNode(TConditionValue v, size_t column_ndx) - : m_value(v) - { - m_condition_column_idx = column_ndx; - m_dT = 1.0; - } - FloatDoubleNode(null, size_t column_ndx) - : m_value(null::get_null_float()) - { - m_condition_column_idx = column_ndx; - m_dT = 1.0; - } - - void table_changed() override - { - m_condition_column.init(&get_column(m_condition_column_idx)); - } - - void init() override - { - ParentNode::init(); - m_dD = 100.0; - } - - size_t find_first_local(size_t start, size_t end) override - { - TConditionFunction cond; - - auto find = [&](bool nullability) { - bool m_value_nan = nullability ? null::is_null_float(m_value) : false; - for (size_t s = start; s < end; ++s) { - TConditionValue v = m_condition_column.get_next(s); - REALM_ASSERT(!(null::is_null_float(v) && !nullability)); - if (cond(v, m_value, nullability ? null::is_null_float(v) : false, m_value_nan)) - return s; - } - return not_found; - }; - - // This will inline the second case but no the first. Todo, use templated lambda when switching to c++14 - if (m_table->is_nullable(m_condition_column_idx)) - return find(true); - else - return find(false); - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new FloatDoubleNode(*this, patches)); - } - - FloatDoubleNode(const FloatDoubleNode& from, QueryNodeHandoverPatches* patches) - : ParentNode(from, patches) - , m_value(from.m_value) - { - copy_getter(m_condition_column, m_condition_column_idx, from.m_condition_column, patches); - } - -protected: - TConditionValue m_value; - SequentialGetter m_condition_column; -}; - - -template -class BinaryNode : public ParentNode { -public: - using TConditionValue = BinaryData; - static const bool special_null_node = false; - - BinaryNode(BinaryData v, size_t column) - : m_value(v) - { - m_dT = 100.0; - m_condition_column_idx = column; - } - - BinaryNode(null, size_t column) - : BinaryNode(BinaryData{}, column) - { - } - - void table_changed() override - { - m_condition_column = &get_column(m_condition_column_idx); - } - - void init() override - { - m_dD = 100.0; - - if (m_child) - m_child->init(); - } - - size_t find_first_local(size_t start, size_t end) override - { - TConditionFunction condition; - for (size_t s = start; s < end; ++s) { - BinaryData value = m_condition_column->get(s); - if (condition(m_value.get(), value)) - return s; - } - return not_found; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new BinaryNode(*this, patches)); - } - - BinaryNode(const BinaryNode& from, QueryNodeHandoverPatches* patches) - : ParentNode(from, patches) - , m_value(from.m_value) - , m_condition_column(from.m_condition_column) - { - if (m_condition_column && patches) - m_condition_column_idx = m_condition_column->get_column_index(); - } - -private: - OwnedBinaryData m_value; - const BinaryColumn* m_condition_column; -}; - - -template -class TimestampNode : public ParentNode { -public: - using TConditionValue = Timestamp; - static const bool special_null_node = false; - - TimestampNode(Timestamp v, size_t column) - : m_value(v) - { - m_condition_column_idx = column; - } - - TimestampNode(null, size_t column) - : TimestampNode(Timestamp{}, column) - { - } - - void table_changed() override - { - m_condition_column = &get_column(m_condition_column_idx); - } - - void init() override - { - m_dD = 100.0; - - if (m_child) - m_child->init(); - } - - size_t find_first_local(size_t start, size_t end) override - { - size_t ret = m_condition_column->find(m_value, start, end); - return ret; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new TimestampNode(*this, patches)); - } - - TimestampNode(const TimestampNode& from, QueryNodeHandoverPatches* patches) - : ParentNode(from, patches) - , m_value(from.m_value) - , m_condition_column(from.m_condition_column) - { - if (m_condition_column && patches) - m_condition_column_idx = m_condition_column->get_column_index(); - } - -private: - Timestamp m_value; - const TimestampColumn* m_condition_column; -}; - -class StringNodeBase : public ParentNode { -public: - using TConditionValue = StringData; - static const bool special_null_node = true; - - StringNodeBase(StringData v, size_t column) - : m_value(v.is_null() ? util::none : util::make_optional(std::string(v))) - { - m_condition_column_idx = column; - } - - void table_changed() override - { - m_condition_column = &get_column_base(m_condition_column_idx); - m_column_type = get_real_column_type(m_condition_column_idx); - } - - void init() override - { - m_dT = 10.0; - m_probes = 0; - m_matches = 0; - m_end_s = 0; - m_leaf_start = 0; - m_leaf_end = 0; - } - - void clear_leaf_state() - { - m_leaf.reset(nullptr); - } - - StringNodeBase(const StringNodeBase& from, QueryNodeHandoverPatches* patches) - : ParentNode(from, patches) - , m_value(from.m_value) - , m_condition_column(from.m_condition_column) - , m_column_type(from.m_column_type) - , m_leaf_type(from.m_leaf_type) - { - if (m_condition_column && patches) - m_condition_column_idx = m_condition_column->get_column_index(); - } - -protected: - util::Optional m_value; - - const ColumnBase* m_condition_column = nullptr; - ColumnType m_column_type; - - // Used for linear scan through short/long-string - std::unique_ptr m_leaf; - StringColumn::LeafType m_leaf_type; - size_t m_end_s = 0; - size_t m_leaf_start = 0; - size_t m_leaf_end = 0; - - inline StringData get_string(size_t s) - { - StringData t; - - if (m_column_type == col_type_StringEnum) { - // enum - t = static_cast(m_condition_column)->get(s); - } - else { - // short or long - const StringColumn* asc = static_cast(m_condition_column); - REALM_ASSERT_3(s, <, asc->size()); - if (s >= m_end_s || s < m_leaf_start) { - // we exceeded current leaf's range - clear_leaf_state(); - size_t ndx_in_leaf; - m_leaf = asc->get_leaf(s, ndx_in_leaf, m_leaf_type); - m_leaf_start = s - ndx_in_leaf; - - if (m_leaf_type == StringColumn::leaf_type_Small) - m_end_s = m_leaf_start + static_cast(*m_leaf).size(); - else if (m_leaf_type == StringColumn::leaf_type_Medium) - m_end_s = m_leaf_start + static_cast(*m_leaf).size(); - else - m_end_s = m_leaf_start + static_cast(*m_leaf).size(); - } - - if (m_leaf_type == StringColumn::leaf_type_Small) - t = static_cast(*m_leaf).get(s - m_leaf_start); - else if (m_leaf_type == StringColumn::leaf_type_Medium) - t = static_cast(*m_leaf).get(s - m_leaf_start); - else - t = static_cast(*m_leaf).get_string(s - m_leaf_start); - } - return t; - } -}; - -// Conditions for strings. Note that Equal is specialized later in this file! -template -class StringNode : public StringNodeBase { -public: - StringNode(StringData v, size_t column) - : StringNodeBase(v, column) - { - auto upper = case_map(v, true); - auto lower = case_map(v, false); - if (!upper || !lower) { - error_code = "Malformed UTF-8: " + std::string(v); - } - else { - m_ucase = std::move(*upper); - m_lcase = std::move(*lower); - } - } - - void init() override - { - clear_leaf_state(); - - m_dD = 100.0; - - StringNodeBase::init(); - - if (m_child) - m_child->init(); - } - - - size_t find_first_local(size_t start, size_t end) override - { - TConditionFunction cond; - - for (size_t s = start; s < end; ++s) { - StringData t = get_string(s); - - if (cond(StringData(m_value), m_ucase.data(), m_lcase.data(), t)) - return s; - } - return not_found; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new StringNode(*this, patches)); - } - - StringNode(const StringNode& from, QueryNodeHandoverPatches* patches) - : StringNodeBase(from, patches) - , m_ucase(from.m_ucase) - , m_lcase(from.m_lcase) - { - } - -protected: - std::string m_ucase; - std::string m_lcase; -}; - -// Specialization for Contains condition on Strings - we specialize because we can utilize Boyer-Moore -template <> -class StringNode : public StringNodeBase { -public: - StringNode(StringData v, size_t column) - : StringNodeBase(v, column), m_charmap() - { - if (v.size() == 0) - return; - - // Build a dictionary of char-to-last distances in the search string - // (zero indicates that the char is not in needle) - size_t last_char_pos = v.size()-1; - for (size_t i = 0; i < last_char_pos; ++i) { - // we never jump longer increments than 255 chars, even if needle is longer (to fit in one byte) - uint8_t jump = last_char_pos-i < 255 ? static_cast(last_char_pos-i) : 255; - - unsigned char c = v[i]; - m_charmap[c] = jump; - } - } - - void init() override - { - clear_leaf_state(); - - m_dD = 100.0; - - StringNodeBase::init(); - - if (m_child) - m_child->init(); - } - - - size_t find_first_local(size_t start, size_t end) override - { - Contains cond; - - for (size_t s = start; s < end; ++s) { - StringData t = get_string(s); - - if (cond(StringData(m_value), m_charmap, t)) - return s; - } - return not_found; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new StringNode(*this, patches)); - } - - StringNode(const StringNode& from, QueryNodeHandoverPatches* patches) - : StringNodeBase(from, patches) - , m_charmap(from.m_charmap) - { - } - -protected: - std::array m_charmap; -}; - -// Specialization for ContainsIns condition on Strings - we specialize because we can utilize Boyer-Moore -template <> -class StringNode : public StringNodeBase { -public: - StringNode(StringData v, size_t column) - : StringNodeBase(v, column), m_charmap() - { - auto upper = case_map(v, true); - auto lower = case_map(v, false); - if (!upper || !lower) { - error_code = "Malformed UTF-8: " + std::string(v); - } - else { - m_ucase = std::move(*upper); - m_lcase = std::move(*lower); - } - - if (v.size() == 0) - return; - - // Build a dictionary of char-to-last distances in the search string - // (zero indicates that the char is not in needle) - size_t last_char_pos = m_ucase.size()-1; - for (size_t i = 0; i < last_char_pos; ++i) { - // we never jump longer increments than 255 chars, even if needle is longer (to fit in one byte) - uint8_t jump = last_char_pos-i < 255 ? static_cast(last_char_pos-i) : 255; - - unsigned char uc = m_ucase[i]; - unsigned char lc = m_lcase[i]; - m_charmap[uc] = jump; - m_charmap[lc] = jump; - } - - } - - void init() override - { - clear_leaf_state(); - - m_dD = 100.0; - - StringNodeBase::init(); - - if (m_child) - m_child->init(); - } - - - size_t find_first_local(size_t start, size_t end) override - { - ContainsIns cond; - - for (size_t s = start; s < end; ++s) { - StringData t = get_string(s); - - if (cond(StringData(m_value), m_ucase.data(), m_lcase.data(), m_charmap, t)) - return s; - } - return not_found; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new StringNode(*this, patches)); - } - - StringNode(const StringNode& from, QueryNodeHandoverPatches* patches) - : StringNodeBase(from, patches) - , m_charmap(from.m_charmap) - , m_ucase(from.m_ucase) - , m_lcase(from.m_lcase) - { - } - -protected: - std::array m_charmap; - std::string m_ucase; - std::string m_lcase; -}; - -// Specialization for Equal condition on Strings - we specialize because we can utilize indexes (if they exist) for -// Equal. -// Future optimization: make specialization for greater, notequal, etc -template <> -class StringNode : public StringNodeBase { -public: - StringNode(StringData v, size_t column) - : StringNodeBase(v, column) - { - } - ~StringNode() noexcept override - { - deallocate(); - } - - void deallocate() noexcept - { - // Must be called after each query execution too free temporary resources used by the execution. Run in - // destructor, but also in Init because a user could define a query once and execute it multiple times. - clear_leaf_state(); - - if (m_index_matches_destroy) - m_index_matches->destroy(); - - m_index_matches_destroy = false; - m_index_matches.reset(); - m_index_getter.reset(); - } - - void init() override - { - deallocate(); - m_dD = 10.0; - StringNodeBase::init(); - - if (m_column_type == col_type_StringEnum) { - m_dT = 1.0; - m_key_ndx = static_cast(m_condition_column)->get_key_ndx(m_value); - } - else if (m_condition_column->has_search_index()) { - m_dT = 0.0; - } - else { - m_dT = 10.0; - } - - if (m_condition_column->has_search_index()) { - FindRes fr; - InternalFindResult res; - - if (m_column_type == col_type_StringEnum) { - fr = static_cast(m_condition_column)->find_all_no_copy(m_value, res); - } - else { - fr = static_cast(m_condition_column)->find_all_no_copy(m_value, res); - } - - m_index_matches_destroy = false; - m_last_start = size_t(-1); - - switch (fr) { - case FindRes_single: - m_index_matches.reset( - new IntegerColumn(IntegerColumn::unattached_root_tag(), Allocator::get_default())); // Throws - m_index_matches->get_root_array()->create(Array::type_Normal); // Throws - m_index_matches->add(res.payload); - m_index_matches_destroy = true; // we own m_index_matches, so we must destroy it - m_results_start = 0; - m_results_end = 1; - break; - case FindRes_column: - // todo: Apparently we can't use m_index.get_alloc() because it uses default allocator which - // simply makes - // translate(x) = x. Shouldn't it inherit owner column's allocator?! - m_index_matches.reset(new IntegerColumn(m_condition_column->get_alloc(), res.payload)); // Throws - m_results_start = res.start_ndx; - m_results_end = res.end_ndx; - - // FIXME: handle start and end of find_result! - break; - case FindRes_not_found: - m_index_matches.reset(); - m_index_getter.reset(); - break; - } - - if (m_index_matches) { - m_index_getter.reset(new SequentialGetter(m_index_matches.get())); - } - } - else if (m_column_type != col_type_String) { - REALM_ASSERT_DEBUG(dynamic_cast(m_condition_column)); - m_cse.init(static_cast(m_condition_column)); - } - - if (m_child) - m_child->init(); - } - - size_t find_first_local(size_t start, size_t end) override - { - REALM_ASSERT(m_table); - - if (m_condition_column->has_search_index()) { - // Indexed string column - if (!m_index_getter) - return not_found; // no matches in the index - - if (m_last_start > start) - m_last_indexed = m_results_start; - m_last_start = start; - - while (m_last_indexed < m_results_end) { - m_index_getter->cache_next(m_last_indexed); - size_t f = m_index_getter->m_leaf_ptr->find_gte(start, m_last_indexed - m_index_getter->m_leaf_start, - m_results_end - m_index_getter->m_leaf_start); - - if (f == not_found) { - // Not found in this leaf - move on to next - m_last_indexed = m_index_getter->m_leaf_end; - } - else if (f >= (m_results_end - m_index_getter->m_leaf_start)) { - // Found outside valid range - return not_found; - } - else { - size_t found_index = to_size_t(m_index_getter->m_leaf_ptr->get(f)); - if (found_index >= end) - return not_found; - else { - m_last_indexed = f + m_index_getter->m_leaf_start; - return found_index; - } - } - } - return not_found; - } - - if (m_column_type != col_type_String) { - // Enum string column - if (m_key_ndx == not_found) - return not_found; // not in key set - - for (size_t s = start; s < end; ++s) { - m_cse.cache_next(s); - s = m_cse.m_leaf_ptr->find_first(m_key_ndx, s - m_cse.m_leaf_start, m_cse.local_end(end)); - if (s == not_found) - s = m_cse.m_leaf_end - 1; - else - return s + m_cse.m_leaf_start; - } - - return not_found; - } - - // Normal string column, with long or short leaf - for (size_t s = start; s < end; ++s) { - const StringColumn* asc = static_cast(m_condition_column); - if (s >= m_leaf_end || s < m_leaf_start) { - clear_leaf_state(); - size_t ndx_in_leaf; - m_leaf = asc->get_leaf(s, ndx_in_leaf, m_leaf_type); - m_leaf_start = s - ndx_in_leaf; - if (m_leaf_type == StringColumn::leaf_type_Small) - m_leaf_end = m_leaf_start + static_cast(*m_leaf).size(); - else if (m_leaf_type == StringColumn::leaf_type_Medium) - m_leaf_end = m_leaf_start + static_cast(*m_leaf).size(); - else - m_leaf_end = m_leaf_start + static_cast(*m_leaf).size(); - REALM_ASSERT(m_leaf); - } - size_t end2 = (end > m_leaf_end ? m_leaf_end - m_leaf_start : end - m_leaf_start); - - if (m_leaf_type == StringColumn::leaf_type_Small) - s = static_cast(*m_leaf).find_first(m_value, s - m_leaf_start, end2); - else if (m_leaf_type == StringColumn::leaf_type_Medium) - s = static_cast(*m_leaf).find_first(m_value, s - m_leaf_start, end2); - else - s = static_cast(*m_leaf).find_first(str_to_bin(m_value), true, s - m_leaf_start, - end2); - - if (s == not_found) - s = m_leaf_end - 1; - else - return s + m_leaf_start; - } - - return not_found; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new StringNode(*this, patches)); - } - - StringNode(const StringNode& from, QueryNodeHandoverPatches* patches) - : StringNodeBase(from, patches) - { - } - -private: - inline BinaryData str_to_bin(const StringData& s) noexcept - { - return BinaryData(s.data(), s.size()); - } - - size_t m_key_ndx = not_found; - size_t m_last_indexed; - - // Used for linear scan through enum-string - SequentialGetter m_cse; - - // Used for index lookup - std::unique_ptr m_index_matches; - bool m_index_matches_destroy = false; - std::unique_ptr> m_index_getter; - size_t m_results_start; - size_t m_results_end; - size_t m_last_start; -}; - -// OR node contains at least two node pointers: Two or more conditions to OR -// together in m_conditions, and the next AND condition (if any) in m_child. -// -// For 'second.equal(23).begin_group().first.equal(111).Or().first.equal(222).end_group().third().equal(555)', this -// will first set m_conditions[0] = left-hand-side through constructor, and then later, when .first.equal(222) is -// invoked, -// invocation will set m_conditions[1] = right-hand-side through Query& Query::Or() (see query.cpp). In there, m_child -// is -// also set to next AND condition (if any exists) following the OR. -class OrNode : public ParentNode { -public: - OrNode(std::unique_ptr condition) - { - m_dT = 50.0; - if (condition) - m_conditions.emplace_back(std::move(condition)); - } - - OrNode(const OrNode& other, QueryNodeHandoverPatches* patches) - : ParentNode(other, patches) - { - for (const auto& condition : other.m_conditions) { - m_conditions.emplace_back(condition->clone(patches)); - } - } - - void table_changed() override - { - for (auto& condition : m_conditions) { - condition->set_table(*m_table); - } - } - - void init() override - { - m_dD = 10.0; - - m_start.clear(); - m_start.resize(m_conditions.size(), 0); - - m_last.clear(); - m_last.resize(m_conditions.size(), 0); - - m_was_match.clear(); - m_was_match.resize(m_conditions.size(), false); - - std::vector v; - for (auto& condition : m_conditions) { - condition->init(); - v.clear(); - condition->gather_children(v); - } - - if (m_child) - m_child->init(); - } - - size_t find_first_local(size_t start, size_t end) override - { - if (start >= end) - return not_found; - - size_t index = not_found; - - for (size_t c = 0; c < m_conditions.size(); ++c) { - // out of order search; have to discard cached results - if (start < m_start[c]) { - m_last[c] = 0; - m_was_match[c] = false; - } - // already searched this range and didn't match - else if (m_last[c] >= end) - continue; - // already search this range and *did* match - else if (m_was_match[c] && m_last[c] >= start) { - if (index > m_last[c]) - index = m_last[c]; - continue; - } - - m_start[c] = start; - size_t fmax = std::max(m_last[c], start); - size_t f = m_conditions[c]->find_first(fmax, end); - m_was_match[c] = f != not_found; - m_last[c] = f == not_found ? end : f; - if (f != not_found && index > m_last[c]) - index = m_last[c]; - } - - return index; - } - - std::string validate() override - { - if (error_code != "") - return error_code; - if (m_conditions.size() == 0) - return "Missing left-hand side of OR"; - if (m_conditions.size() == 1) - return "Missing right-hand side of OR"; - std::string s; - if (m_child != 0) - s = m_child->validate(); - if (s != "") - return s; - for (size_t i = 0; i < m_conditions.size(); ++i) { - s = m_conditions[i]->validate(); - if (s != "") - return s; - } - return ""; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new OrNode(*this, patches)); - } - - void apply_handover_patch(QueryNodeHandoverPatches& patches, Group& group) override - { - for (auto it = m_conditions.rbegin(); it != m_conditions.rend(); ++it) - (*it)->apply_handover_patch(patches, group); - - ParentNode::apply_handover_patch(patches, group); - } - - std::vector> m_conditions; - -private: - // start index of the last find for each cond - std::vector m_start; - // last looked at index of the lasft find for each cond - // is a matching index if m_was_match is true - std::vector m_last; - std::vector m_was_match; -}; - - -class NotNode : public ParentNode { -public: - NotNode(std::unique_ptr condition) - : m_condition(std::move(condition)) - { - m_dT = 50.0; - } - - void table_changed() override - { - m_condition->set_table(*m_table); - } - - void init() override - { - m_dD = 10.0; - - std::vector v; - - m_condition->init(); - v.clear(); - m_condition->gather_children(v); - - // Heuristics bookkeeping: - m_known_range_start = 0; - m_known_range_end = 0; - m_first_in_known_range = not_found; - - if (m_child) - m_child->init(); - } - - size_t find_first_local(size_t start, size_t end) override; - - std::string validate() override - { - if (error_code != "") - return error_code; - if (m_condition == 0) - return "Missing argument to Not"; - std::string s; - if (m_child != 0) - s = m_child->validate(); - if (s != "") - return s; - s = m_condition->validate(); - if (s != "") - return s; - return ""; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new NotNode(*this, patches)); - } - - NotNode(const NotNode& from, QueryNodeHandoverPatches* patches) - : ParentNode(from, patches) - , m_condition(from.m_condition ? from.m_condition->clone(patches) : nullptr) - , m_known_range_start(from.m_known_range_start) - , m_known_range_end(from.m_known_range_end) - , m_first_in_known_range(from.m_first_in_known_range) - { - } - - void apply_handover_patch(QueryNodeHandoverPatches& patches, Group& group) override - { - m_condition->apply_handover_patch(patches, group); - ParentNode::apply_handover_patch(patches, group); - } - - std::unique_ptr m_condition; - -private: - // FIXME This heuristic might as well be reused for all condition nodes. - size_t m_known_range_start; - size_t m_known_range_end; - size_t m_first_in_known_range; - - bool evaluate_at(size_t rowndx); - void update_known(size_t start, size_t end, size_t first); - size_t find_first_loop(size_t start, size_t end); - size_t find_first_covers_known(size_t start, size_t end); - size_t find_first_covered_by_known(size_t start, size_t end); - size_t find_first_overlap_lower(size_t start, size_t end); - size_t find_first_overlap_upper(size_t start, size_t end); - size_t find_first_no_overlap(size_t start, size_t end); -}; - - -// Compare two columns with eachother row-by-row -template -class TwoColumnsNode : public ParentNode { -public: - using TConditionValue = typename ColType::value_type; - - TwoColumnsNode(size_t column1, size_t column2) - { - m_dT = 100.0; - m_condition_column_idx1 = column1; - m_condition_column_idx2 = column2; - } - - ~TwoColumnsNode() noexcept override - { - delete[] m_value.data(); - } - - void table_changed() override - { - m_getter1.init(&get_column(m_condition_column_idx1)); - m_getter2.init(&get_column(m_condition_column_idx2)); - } - - void init() override - { - m_dD = 100.0; - - if (m_child) - m_child->init(); - } - - size_t find_first_local(size_t start, size_t end) override - { - size_t s = start; - - while (s < end) { - if (std::is_same::value) { - // For int64_t we've created an array intrinsics named compare_leafs which template expands bitwidths - // of boths arrays to make Get faster. - m_getter1.cache_next(s); - m_getter2.cache_next(s); - - QueryState qs; - bool resume = m_getter1.m_leaf_ptr->template compare_leafs( - m_getter2.m_leaf_ptr, s - m_getter1.m_leaf_start, m_getter1.local_end(end), 0, &qs, - CallbackDummy()); - - if (resume) - s = m_getter1.m_leaf_end; - else - return to_size_t(qs.m_state) + m_getter1.m_leaf_start; - } - else { -// This is for float and double. - -#if 0 && defined(REALM_COMPILER_AVX) -// AVX has been disabled because of array alignment (see https://app.asana.com/0/search/8836174089724/5763107052506) -// -// For AVX you can call things like if (sseavx<1>()) to test for AVX, and then utilize _mm256_movemask_ps (VC) -// or movemask_cmp_ps (gcc/clang) -// -// See https://github.com/rrrlasse/realm/tree/AVX for an example of utilizing AVX for a two-column search which has -// been benchmarked to: floats: 288 ms vs 552 by using AVX compared to 2-level-unrolled FPU loop. doubles: 415 ms vs -// 475 (more bandwidth bound). Tests against SSE have not been performed; AVX may not pay off. Please benchmark -#endif - - TConditionValue v1 = m_getter1.get_next(s); - TConditionValue v2 = m_getter2.get_next(s); - TConditionFunction C; - - if (C(v1, v2)) - return s; - else - s++; - } - } - return not_found; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new TwoColumnsNode(*this, patches)); - } - - TwoColumnsNode(const TwoColumnsNode& from, QueryNodeHandoverPatches* patches) - : ParentNode(from, patches) - , m_value(from.m_value) - , m_condition_column(from.m_condition_column) - , m_column_type(from.m_column_type) - { - if (m_condition_column) - m_condition_column_idx = m_condition_column->get_column_index(); - copy_getter(m_getter1, m_condition_column_idx1, from.m_getter1, patches); - copy_getter(m_getter2, m_condition_column_idx2, from.m_getter2, patches); - } - -private: - BinaryData m_value; - const BinaryColumn* m_condition_column = nullptr; - ColumnType m_column_type; - - size_t m_condition_column_idx1 = not_found; - size_t m_condition_column_idx2 = not_found; - - SequentialGetter m_getter1; - SequentialGetter m_getter2; -}; - - -// For Next-Generation expressions like col1 / col2 + 123 > col4 * 100. -class ExpressionNode : public ParentNode { - -public: - ExpressionNode(std::unique_ptr expression) - : m_expression(std::move(expression)) - { - m_dD = 10.0; - m_dT = 50.0; - } - - void table_changed() override - { - m_expression->set_base_table(m_table.get()); - } - - size_t find_first_local(size_t start, size_t end) override - { - return m_expression->find_first(start, end); - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new ExpressionNode(*this, patches)); - } - - void apply_handover_patch(QueryNodeHandoverPatches& patches, Group& group) override - { - m_expression->apply_handover_patch(patches, group); - ParentNode::apply_handover_patch(patches, group); - } - -private: - ExpressionNode(const ExpressionNode& from, QueryNodeHandoverPatches* patches) - : ParentNode(from, patches) - , m_expression(from.m_expression->clone(patches)) - { - } - - std::unique_ptr m_expression; -}; - - -struct LinksToNodeHandoverPatch : public QueryNodeHandoverPatch { - std::unique_ptr m_target_row; - size_t m_origin_column; -}; - -class LinksToNode : public ParentNode { -public: - LinksToNode(size_t origin_column_index, const ConstRow& target_row) - : m_origin_column(origin_column_index) - , m_target_row(target_row) - { - m_dD = 10.0; - m_dT = 50.0; - } - - void table_changed() override - { - m_column_type = m_table->get_column_type(m_origin_column); - m_column = &const_cast(m_table.get())->get_column_link_base(m_origin_column); - REALM_ASSERT(m_column_type == type_Link || m_column_type == type_LinkList); - } - - size_t find_first_local(size_t start, size_t end) override - { - REALM_ASSERT(m_column); - if (!m_target_row.is_attached()) - return not_found; - - if (m_column_type == type_Link) { - LinkColumn& cl = static_cast(*m_column); - return cl.find_first(m_target_row.get_index() + 1, start, - end); // LinkColumn stores link to row N as the integer N + 1 - } - else if (m_column_type == type_LinkList) { - LinkListColumn& cll = static_cast(*m_column); - - for (size_t i = start; i < end; i++) { - LinkViewRef lv = cll.get(i); - if (lv->find(m_target_row.get_index()) != not_found) - return i; - } - } - - return not_found; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(patches ? new LinksToNode(*this, patches) : new LinksToNode(*this)); - } - - void apply_handover_patch(QueryNodeHandoverPatches& patches, Group& group) override - { - REALM_ASSERT(patches.size()); - std::unique_ptr abstract_patch = std::move(patches.back()); - patches.pop_back(); - - auto patch = dynamic_cast(abstract_patch.get()); - REALM_ASSERT(patch); - - m_origin_column = patch->m_origin_column; - m_target_row.apply_and_consume_patch(patch->m_target_row, group); - - ParentNode::apply_handover_patch(patches, group); - } - -private: - size_t m_origin_column = npos; - ConstRow m_target_row; - LinkColumnBase* m_column = nullptr; - DataType m_column_type; - - LinksToNode(const LinksToNode& source, QueryNodeHandoverPatches* patches) - : ParentNode(source, patches) - { - auto patch = std::make_unique(); - patch->m_origin_column = source.m_column->get_column_index(); - ConstRow::generate_patch(source.m_target_row, patch->m_target_row); - patches->push_back(std::move(patch)); - } -}; - -} // namespace realm - -#endif // REALM_QUERY_ENGINE_HPP diff --git a/Pods/Realm/include/core/realm/query_expression.hpp b/Pods/Realm/include/core/realm/query_expression.hpp deleted file mode 100644 index 51baacb1..00000000 --- a/Pods/Realm/include/core/realm/query_expression.hpp +++ /dev/null @@ -1,3109 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -/* -This file lets you write queries in C++ syntax like: Expression* e = (first + 1 / second >= third + 12.3); - -Type conversion/promotion semantics is the same as in the C++ expressions, e.g float + int > double == float + -(float)int > double. - - -Grammar: ------------------------------------------------------------------------------------------------------------------------ - Expression: Subexpr2 Compare Subexpr2 - operator! Expression - - Subexpr2: Value - Columns - Subexpr2 Operator Subexpr2 - power(Subexpr2) // power(x) = x * x, as example of unary operator - - Value: T - - Operator>: +, -, *, / - - Compare: ==, !=, >=, <=, >, < - - T: bool, int, int64_t, float, double, StringData - - -Class diagram ------------------------------------------------------------------------------------------------------------------------ -Subexpr2 - void evaluate(size_t i, ValueBase* destination) - -Compare: public Subexpr2 - size_t find_first(size_t start, size_t end) // main method that executes query - - unique_ptr m_left; // left expression subtree - unique_ptr m_right; // right expression subtree - -Operator: public Subexpr2 - void evaluate(size_t i, ValueBase* destination) - unique_ptr m_left; // left expression subtree - unique_ptr m_right; // right expression subtree - -Value: public Subexpr2 - void evaluate(size_t i, ValueBase* destination) - T m_v[8]; - -Columns: public Subexpr2 - void evaluate(size_t i, ValueBase* destination) - SequentialGetter sg; // class bound to a column, lets you read values in a fast way - Table* m_table; - -class ColumnAccessor<>: public Columns - - -Call diagram: ------------------------------------------------------------------------------------------------------------------------ -Example of 'table.first > 34.6 + table.second': - -size_t Compare::find_first()-------------+ - | | - | | - | | - +--> Columns::evaluate() +--------> Operator::evaluate() - | | - Value::evaluate() Columns::evaluate() - -Operator, Value and Columns have an evaluate(size_t i, ValueBase* destination) method which returns a Value -containing 8 values representing table rows i...i + 7. - -So Value contains 8 concecutive values and all operations are based on these chunks. This is -to save overhead by virtual calls needed for evaluating a query that has been dynamically constructed at runtime. - - -Memory allocation: ------------------------------------------------------------------------------------------------------------------------ -Subexpressions created by the end-user are stack allocated. They are cloned to the heap when passed to UnaryOperator, -Operator, and Compare. Those types own the clones and deallocate them when destroyed. - - -Caveats, notes and todos ------------------------------------------------------------------------------------------------------------------------ - * Perhaps disallow columns from two different tables in same expression - * The name Columns (with s) an be confusing because we also have Column (without s) - * We have Columns::m_table, Query::m_table and ColumnAccessorBase::m_table that point at the same thing, even with - ColumnAccessor<> extending Columns. So m_table is redundant, but this is in order to keep class dependencies and - entanglement low so that the design is flexible (if you perhaps later want a Columns class that is not dependent - on ColumnAccessor) - -Nulls ------------------------------------------------------------------------------------------------------------------------ -First note that at array level, nulls are distinguished between non-null in different ways: -String: - m_data == 0 && m_size == 0 - -Integer, Bool, OldDateTime stored in ArrayIntNull: - value == get(0) (entry 0 determins a magic value that represents nulls) - -Float/double: - null::is_null(value) which tests if value bit-matches one specific bit pattern reserved for null - -The Columns class encapsulates all this into a simple class that, for any type T has - evaluate(size_t index) that reads values from a column, taking nulls in count - get(index) - set(index) - is_null(index) - set_null(index) -*/ - -#ifndef REALM_QUERY_EXPRESSION_HPP -#define REALM_QUERY_EXPRESSION_HPP - -#include -#include -#include - -#include - -// Normally, if a next-generation-syntax condition is supported by the old query_engine.hpp, a query_engine node is -// created because it's faster (by a factor of 5 - 10). Because many of our existing next-generation-syntax unit -// unit tests are indeed simple enough to fallback to old query_engine, query_expression gets low test coverage. Undef -// flag to get higher query_expression test coverage. This is a good idea to try out each time you develop on/modify -// query_expression. - -#define REALM_OLDQUERY_FALLBACK - -namespace realm { - -template -T minimum(T a, T b) -{ - return a < b ? a : b; -} - -// FIXME, this needs to exist elsewhere -typedef int64_t Int; -typedef bool Bool; -typedef realm::OldDateTime OldDateTime; -typedef float Float; -typedef double Double; -typedef realm::StringData String; -typedef realm::BinaryData Binary; - -#ifdef REALM_OLDQUERY_FALLBACK -// Hack to avoid template instantiation errors. See create(). Todo, see if we can simplify only_numeric somehow -namespace { -template -T only_numeric(U in) -{ - return static_cast(util::unwrap(in)); -} - -template -int only_numeric(const StringData&) -{ - REALM_ASSERT(false); - return 0; -} - -template -int only_numeric(const BinaryData&) -{ - REALM_ASSERT(false); - return 0; -} - -template -StringData only_string(T in) -{ - REALM_ASSERT(false); - static_cast(in); - return StringData(); -} - -StringData only_string(StringData in) -{ - return in; -} - -template -T no_timestamp(U in) -{ - return static_cast(util::unwrap(in)); -} - -template -int no_timestamp(const Timestamp&) -{ - REALM_ASSERT(false); - return 0; -} -#endif // REALM_OLDQUERY_FALLBACK - -} // anonymous namespace - -template -struct Plus { - T operator()(T v1, T v2) const - { - return v1 + v2; - } - typedef T type; -}; - -template -struct Minus { - T operator()(T v1, T v2) const - { - return v1 - v2; - } - typedef T type; -}; - -template -struct Div { - T operator()(T v1, T v2) const - { - return v1 / v2; - } - typedef T type; -}; - -template -struct Mul { - T operator()(T v1, T v2) const - { - return v1 * v2; - } - typedef T type; -}; - -// Unary operator -template -struct Pow { - T operator()(T v) const - { - return v * v; - } - typedef T type; -}; - -// Finds a common type for T1 and T2 according to C++ conversion/promotion in arithmetic (float + int => float, etc) -template ::is_integer || std::is_same::value, - bool T2_is_int = std::numeric_limits::is_integer || std::is_same::value, - bool T1_is_widest = (sizeof(T1) > sizeof(T2) || std::is_same::value)> -struct Common; -template -struct Common { - typedef T1 type; -}; -template -struct Common { - typedef T2 type; -}; -template -struct Common { - typedef T1 type; -}; -template -struct Common { - typedef T2 type; -}; - - -struct RowIndex { - enum DetachedTag { - Detached, - }; - - explicit RowIndex() - : m_row_index(npos) - { - } - explicit RowIndex(size_t row_index) - : m_row_index(row_index) - { - } - RowIndex(DetachedTag) - : m_row_index() - { - } - - bool is_attached() const - { - return bool(m_row_index); - } - bool is_null() const - { - return is_attached() && *m_row_index == npos; - } - - bool operator==(const RowIndex& other) const - { - // Row indexes that are detached are never equal to any other row index. - if (!is_attached() || !other.is_attached()) - return false; - return m_row_index == other.m_row_index; - } - bool operator!=(const RowIndex& other) const - { - return !(*this == other); - } - -private: - util::Optional m_row_index; -}; - - -struct ValueBase { - static const size_t default_size = 8; - virtual void export_bool(ValueBase& destination) const = 0; - virtual void export_Timestamp(ValueBase& destination) const = 0; - virtual void export_int(ValueBase& destination) const = 0; - virtual void export_float(ValueBase& destination) const = 0; - virtual void export_int64_t(ValueBase& destination) const = 0; - virtual void export_double(ValueBase& destination) const = 0; - virtual void export_StringData(ValueBase& destination) const = 0; - virtual void export_BinaryData(ValueBase& destination) const = 0; - virtual void export_RowIndex(ValueBase& destination) const = 0; - virtual void export_null(ValueBase& destination) const = 0; - virtual void import(const ValueBase& destination) = 0; - - // If true, all values in the class come from a link list of a single field in the parent table (m_table). If - // false, then values come from successive rows of m_table (query operations are operated on in bulks for speed) - bool m_from_link_list; - - // Number of values stored in the class. - size_t m_values; -}; - -class Expression { -public: - Expression() - { - } - virtual ~Expression() - { - } - - virtual size_t find_first(size_t start, size_t end) const = 0; - virtual void set_base_table(const Table* table) = 0; - virtual const Table* get_base_table() const = 0; - - virtual std::unique_ptr clone(QueryNodeHandoverPatches*) const = 0; - virtual void apply_handover_patch(QueryNodeHandoverPatches&, Group&) - { - } -}; - -template -std::unique_ptr make_expression(Args&&... args) -{ - return std::unique_ptr(new T(std::forward(args)...)); -} - -class Subexpr { -public: - virtual ~Subexpr() - { - } - - virtual std::unique_ptr clone(QueryNodeHandoverPatches* = nullptr) const = 0; - virtual void apply_handover_patch(QueryNodeHandoverPatches&, Group&) - { - } - - // When the user constructs a query, it always "belongs" to one single base/parent table (regardless of - // any links or not and regardless of any queries assembled with || or &&). When you do a Query::find(), - // then Query::m_table is set to this table, and set_base_table() is called on all Columns and LinkMaps in - // the query expression tree so that they can set/update their internals as required. - // - // During thread-handover of a Query, set_base_table() is also called to make objects point at the new table - // instead of the old one from the old thread. - virtual void set_base_table(const Table*) - { - } - - // Recursively fetch tables of columns in expression tree. Used when user first builds a stand-alone expression - // and - // binds it to a Query at a later time - virtual const Table* get_base_table() const - { - return nullptr; - } - - virtual void evaluate(size_t index, ValueBase& destination) = 0; -}; - -template -std::unique_ptr make_subexpr(Args&&... args) -{ - return std::unique_ptr(new T(std::forward(args)...)); -} - -template -class Columns; -template -class Value; -class ConstantStringValue; -template -class Subexpr2; -template -class Operator; -template -class UnaryOperator; -template -class Compare; -template -class UnaryLinkCompare; -class ColumnAccessorBase; - - -// Handle cases where left side is a constant (int, float, int64_t, double, StringData) -template -Query create(L left, const Subexpr2& right) -{ -// Purpose of below code is to intercept the creation of a condition and test if it's supported by the old -// query_engine.hpp which is faster. If it's supported, create a query_engine.hpp node, otherwise create a -// query_expression.hpp node. -// -// This method intercepts only Value Subexpr2. Interception of Subexpr2 Subexpr is elsewhere. - -#ifdef REALM_OLDQUERY_FALLBACK // if not defined, then never fallback to query_engine.hpp; always use query_expression - const Columns* column = dynamic_cast*>(&right); - - if (column && ((std::numeric_limits::is_integer && std::numeric_limits::is_integer) || - (std::is_same::value && std::is_same::value) || - (std::is_same::value && std::is_same::value) || - (std::is_same::value && std::is_same::value) || - (std::is_same::value && std::is_same::value) || - (std::is_same::value && std::is_same::value)) && - !column->links_exist()) { - const Table* t = column->get_base_table(); - Query q = Query(*t); - - if (std::is_same::value) - q.greater(column->column_ndx(), only_numeric(left)); - else if (std::is_same::value) - q.less(column->column_ndx(), only_numeric(left)); - else if (std::is_same::value) - q.equal(column->column_ndx(), left); - else if (std::is_same::value) - q.not_equal(column->column_ndx(), left); - else if (std::is_same::value) - q.greater_equal(column->column_ndx(), only_numeric(left)); - else if (std::is_same::value) - q.less_equal(column->column_ndx(), only_numeric(left)); - else if (std::is_same::value) - q.equal(column->column_ndx(), only_string(left), false); - else if (std::is_same::value) - q.not_equal(column->column_ndx(), only_string(left), false); - else if (std::is_same::value) - q.begins_with(column->column_ndx(), only_string(left)); - else if (std::is_same::value) - q.begins_with(column->column_ndx(), only_string(left), false); - else if (std::is_same::value) - q.ends_with(column->column_ndx(), only_string(left)); - else if (std::is_same::value) - q.ends_with(column->column_ndx(), only_string(left), false); - else if (std::is_same::value) - q.contains(column->column_ndx(), only_string(left)); - else if (std::is_same::value) - q.contains(column->column_ndx(), only_string(left), false); - else if (std::is_same::value) - q.like(column->column_ndx(), only_string(left)); - else if (std::is_same::value) - q.like(column->column_ndx(), only_string(left), false); - else { - // query_engine.hpp does not support this Cond. Please either add support for it in query_engine.hpp or - // fallback to using use 'return new Compare<>' instead. - REALM_ASSERT(false); - } - // Return query_engine.hpp node - return q; - } - else -#endif - { - // Return query_expression.hpp node - using CommonType = typename Common::type; - using ValueType = - typename std::conditional::value, ConstantStringValue, Value>::type; - return make_expression>(make_subexpr(left), right.clone()); - } -} - - -// All overloads where left-hand-side is Subexpr2: -// -// left-hand-side operator right-hand-side -// Subexpr2 +, -, *, /, <, >, ==, !=, <=, >= R, Subexpr2 -// -// For L = R = {int, int64_t, float, double, StringData, Timestamp}: -template -class Overloads { - typedef typename Common::type CommonType; - - std::unique_ptr clone_subexpr() const - { - return static_cast&>(*this).clone(); - } - -public: - // Arithmetic, right side constant - Operator> operator+(R right) const - { - return {clone_subexpr(), make_subexpr>(right)}; - } - Operator> operator-(R right) const - { - return {clone_subexpr(), make_subexpr>(right)}; - } - Operator> operator*(R right) const - { - return {clone_subexpr(), make_subexpr>(right)}; - } - Operator> operator/(R right) const - { - return {clone_subexpr(), make_subexpr>(right)}; - } - - // Arithmetic, right side subexpression - Operator> operator+(const Subexpr2& right) const - { - return {clone_subexpr(), right.clone()}; - } - Operator> operator-(const Subexpr2& right) const - { - return {clone_subexpr(), right.clone()}; - } - Operator> operator*(const Subexpr2& right) const - { - return {clone_subexpr(), right.clone()}; - } - Operator> operator/(const Subexpr2& right) const - { - return {clone_subexpr(), right.clone()}; - } - - // Compare, right side constant - Query operator>(R right) - { - return create(right, static_cast&>(*this)); - } - Query operator<(R right) - { - return create(right, static_cast&>(*this)); - } - Query operator>=(R right) - { - return create(right, static_cast&>(*this)); - } - Query operator<=(R right) - { - return create(right, static_cast&>(*this)); - } - Query operator==(R right) - { - return create(right, static_cast&>(*this)); - } - Query operator!=(R right) - { - return create(right, static_cast&>(*this)); - } - - // Purpose of this method is to intercept the creation of a condition and test if it's supported by the old - // query_engine.hpp which is faster. If it's supported, create a query_engine.hpp node, otherwise create a - // query_expression.hpp node. - // - // This method intercepts Subexpr2 Subexpr2 only. Value Subexpr2 is intercepted elsewhere. - template - Query create2(const Subexpr2& right) - { -#ifdef REALM_OLDQUERY_FALLBACK // if not defined, never fallback query_engine; always use query_expression - // Test if expressions are of type Columns. Other possibilities are Value and Operator. - const Columns* left_col = dynamic_cast*>(static_cast*>(this)); - const Columns* right_col = dynamic_cast*>(&right); - - // query_engine supports 'T-column ' for T = {int64_t, float, double}, op = {<, >, ==, !=, <=, - // >=}, - // but only if both columns are non-nullable, and aren't in linked tables. - if (left_col && right_col && std::is_same::value && !left_col->is_nullable() && - !right_col->is_nullable() && !left_col->links_exist() && !right_col->links_exist() && - !std::is_same::value) { - const Table* t = left_col->get_base_table(); - Query q = Query(*t); - - if (std::numeric_limits::is_integer || std::is_same::value) { - if (std::is_same::value) - q.less_int(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.greater_int(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.equal_int(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.not_equal_int(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.less_equal_int(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.greater_equal_int(left_col->column_ndx(), right_col->column_ndx()); - else { - REALM_ASSERT(false); - } - } - else if (std::is_same::value) { - if (std::is_same::value) - q.less_float(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.greater_float(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.equal_float(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.not_equal_float(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.less_equal_float(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.greater_equal_float(left_col->column_ndx(), right_col->column_ndx()); - else { - REALM_ASSERT(false); - } - } - else if (std::is_same::value) { - if (std::is_same::value) - q.less_double(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.greater_double(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.equal_double(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.not_equal_double(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.less_equal_double(left_col->column_ndx(), right_col->column_ndx()); - else if (std::is_same::value) - q.greater_equal_double(left_col->column_ndx(), right_col->column_ndx()); - else { - REALM_ASSERT(false); - } - } - else { - REALM_ASSERT(false); - } - // Return query_engine.hpp node - return q; - } - else -#endif - { - // Return query_expression.hpp node - return make_expression::type>>(clone_subexpr(), right.clone()); - } - } - - // Compare, right side subexpression - Query operator==(const Subexpr2& right) - { - return create2(right); - } - Query operator!=(const Subexpr2& right) - { - return create2(right); - } - Query operator>(const Subexpr2& right) - { - return create2(right); - } - Query operator<(const Subexpr2& right) - { - return create2(right); - } - Query operator>=(const Subexpr2& right) - { - return create2(right); - } - Query operator<=(const Subexpr2& right) - { - return create2(right); - } -}; - -// With this wrapper class we can define just 20 overloads inside Overloads instead of 5 * 20 = 100. Todo: We -// can -// consider if it's simpler/better to remove this class completely and just list all 100 overloads manually anyway. -template -class Subexpr2 : public Subexpr, - public Overloads, - public Overloads, - public Overloads, - public Overloads, - public Overloads, - public Overloads, - public Overloads, - public Overloads, - public Overloads, - public Overloads { -public: - virtual ~Subexpr2() - { - } - -#define RLM_U2(t, o) using Overloads::operator o; -#define RLM_U(o) \ - RLM_U2(int, o) \ - RLM_U2(float, o) \ - RLM_U2(double, o) \ - RLM_U2(int64_t, o) \ - RLM_U2(StringData, o) RLM_U2(bool, o) RLM_U2(OldDateTime, o) RLM_U2(Timestamp, o) RLM_U2(null, o) - RLM_U(+) RLM_U(-) RLM_U(*) RLM_U(/) RLM_U(>) RLM_U(<) RLM_U(==) RLM_U(!=) RLM_U(>=) RLM_U(<=) -}; - -// Subexpr2 only provides equality comparisons. Their implementations can be found later in this file. -template <> -class Subexpr2 : public Subexpr { -}; - - -/* -This class is used to store N values of type T = {int64_t, bool, OldDateTime or StringData}, and allows an entry -to be null too. It's used by the Value class for internal storage. - -To indicate nulls, we could have chosen a separate bool vector or some other bitmask construction. But for -performance, we customize indication of nulls to match the same indication that is used in the persisted database -file - -Queries in query_expression.hpp execute by processing chunks of 8 rows at a time. Assume you have a column: - - price (int) = {1, 2, 3, null, 1, 6, 6, 9, 5, 2, null} - -And perform a query: - - Query q = (price + 2 == 5); - -query_expression.hpp will then create a NullableVector = {5, 5, 5, 5, 5, 5, 5, 5} and then read values -NullableVector = {1, 2, 3, null, 1, 6, 6, 9} from the column, and then perform `+` and `==` on these chunks. - -See the top of this file for more information on all this. - -Assume the user specifies the null constant in a query: - -Query q = (price == null) - -The query system will then construct a NullableVector of type `null` (NullableVector). This allows compile -time optimizations for these cases. -*/ - -template -struct NullableVector { - using Underlying = typename util::RemoveOptional::type; - using t_storage = - typename std::conditional::value || std::is_same::value, - int64_t, Underlying>::type; - - NullableVector() - { - } - - NullableVector& operator=(const NullableVector& other) - { - if (this != &other) { - init(other.m_size); - std::copy_n(other.m_first, other.m_size, m_first); - m_null = other.m_null; - } - return *this; - } - - NullableVector(const NullableVector& other) - { - init(other.m_size); - std::copy_n(other.m_first, other.m_size, m_first); - m_null = other.m_null; - } - - ~NullableVector() - { - dealloc(); - } - - T operator[](size_t index) const - { - REALM_ASSERT_3(index, <, m_size); - return static_cast(m_first[index]); - } - - inline bool is_null(size_t index) const - { - REALM_ASSERT((std::is_same::value)); - return m_first[index] == m_null; - } - - inline void set_null(size_t index) - { - REALM_ASSERT((std::is_same::value)); - m_first[index] = m_null; - } - - template - typename std::enable_if::value, void>::type set(size_t index, t_storage value) - { - REALM_ASSERT((std::is_same::value)); - - // If value collides with magic null value, then switch to a new unique representation for null - if (REALM_UNLIKELY(value == m_null)) { - // adding a prime will generate 2^64 unique values. Todo: Only works on 2's complement architecture - uint64_t candidate = static_cast(m_null) + 0xfffffffbULL; - while (std::find(m_first, m_first + m_size, static_cast(candidate)) != m_first + m_size) - candidate += 0xfffffffbULL; - std::replace(m_first, m_first + m_size, m_null, static_cast(candidate)); - } - m_first[index] = value; - } - - template - typename std::enable_if< - realm::is_any::value, - void>::type - set(size_t index, t_storage value) - { - m_first[index] = value; - } - - - inline util::Optional get(size_t index) const - { - if (is_null(index)) - return util::none; - - return util::make_optional((*this)[index]); - } - - inline void set(size_t index, util::Optional value) - { - if (value) { - Underlying v = *value; - set(index, v); - } - else { - set_null(index); - } - } - - void fill(T value) - { - for (size_t t = 0; t < m_size; t++) { - if (std::is_same::value) - set_null(t); - else - set(t, value); - } - } - - void init(size_t size) - { - if (size == m_size) - return; - - dealloc(); - m_size = size; - if (m_size > 0) { - if (m_size > prealloc) - m_first = reinterpret_cast(new t_storage[m_size]); - else - m_first = m_cache; - } - } - - void init(size_t size, T values) - { - init(size); - fill(values); - } - - void dealloc() - { - if (m_first) { - if (m_size > prealloc) - delete[] m_first; - m_first = nullptr; - } - } - - t_storage m_cache[prealloc]; - t_storage* m_first = &m_cache[0]; - size_t m_size = 0; - - int64_t m_null = reinterpret_cast(&m_null); // choose magic value to represent nulls -}; - -// Double -// NOTE: fails in gcc 4.8 without `inline`. Do not remove. Same applies for all methods below. -template <> -inline bool NullableVector::is_null(size_t index) const -{ - return null::is_null_float(m_first[index]); -} - -template <> -inline void NullableVector::set_null(size_t index) -{ - m_first[index] = null::get_null_float(); -} - -// Float -template <> -inline bool NullableVector::is_null(size_t index) const -{ - return null::is_null_float(m_first[index]); -} - -template <> -inline void NullableVector::set_null(size_t index) -{ - m_first[index] = null::get_null_float(); -} - - -// Null -template <> -inline void NullableVector::set_null(size_t) -{ - return; -} -template <> -inline bool NullableVector::is_null(size_t) const -{ - return true; -} - - -// OldDateTime -template <> -inline bool NullableVector::is_null(size_t index) const -{ - return m_first[index].get_olddatetime() == m_null; -} - - -template <> -inline void NullableVector::set_null(size_t index) -{ - m_first[index] = m_null; -} - -// StringData - -template <> -inline bool NullableVector::is_null(size_t index) const -{ - return m_first[index].is_null(); -} - -template <> -inline void NullableVector::set_null(size_t index) -{ - m_first[index] = StringData(); -} - -// BinaryData - -template <> -inline bool NullableVector::is_null(size_t index) const -{ - return m_first[index].is_null(); -} - -template <> -inline void NullableVector::set_null(size_t index) -{ - m_first[index] = BinaryData(); -} - -// RowIndex -template <> -inline bool NullableVector::is_null(size_t index) const -{ - return m_first[index].is_null(); -} -template <> -inline void NullableVector::set_null(size_t index) -{ - m_first[index] = RowIndex(); -} - - -// Timestamp - -template <> -inline bool NullableVector::is_null(size_t index) const -{ - return m_first[index].is_null(); -} - -template <> -inline void NullableVector::set_null(size_t index) -{ - m_first[index] = Timestamp{}; -} - - -template -struct OperatorOptionalAdapter { - template - util::Optional operator()(const util::Optional& left, const util::Optional& right) - { - if (!left || !right) - return util::none; - return Operator()(*left, *right); - } - - template - util::Optional operator()(const util::Optional& arg) - { - if (!arg) - return util::none; - return Operator()(*arg); - } -}; - -// Stores N values of type T. Can also exchange data with other ValueBase of different types -template -class Value : public ValueBase, public Subexpr2 { -public: - Value() - { - init(false, ValueBase::default_size, T()); - } - Value(T v) - { - init(false, ValueBase::default_size, v); - } - - Value(bool from_link_list, size_t values) - { - init(from_link_list, values, T()); - } - - Value(bool from_link_list, size_t values, T v) - { - init(from_link_list, values, v); - } - - Value(const Value&) = default; - Value& operator=(const Value&) = default; - - void init(bool from_link_list, size_t values, T v) - { - m_storage.init(values, v); - ValueBase::m_from_link_list = from_link_list; - ValueBase::m_values = values; - } - - void init(bool from_link_list, size_t values) - { - m_storage.init(values); - ValueBase::m_from_link_list = from_link_list; - ValueBase::m_values = values; - } - - void evaluate(size_t, ValueBase& destination) override - { - destination.import(*this); - } - - - template - REALM_FORCEINLINE void fun(const Value* left, const Value* right) - { - OperatorOptionalAdapter o; - - if (!left->m_from_link_list && !right->m_from_link_list) { - // Operate on values one-by-one (one value is one row; no links) - size_t min = std::min(left->m_values, right->m_values); - init(false, min); - - for (size_t i = 0; i < min; i++) { - m_storage.set(i, o(left->m_storage.get(i), right->m_storage.get(i))); - } - } - else if (left->m_from_link_list && right->m_from_link_list) { - // FIXME: Many-to-many links not supported yet. Need to specify behaviour - REALM_ASSERT_DEBUG(false); - } - else if (!left->m_from_link_list && right->m_from_link_list) { - // Right values come from link. Left must come from single row. - REALM_ASSERT_DEBUG(left->m_values > 0); - init(true, right->m_values); - - auto left_value = left->m_storage.get(0); - for (size_t i = 0; i < right->m_values; i++) { - m_storage.set(i, o(left_value, right->m_storage.get(i))); - } - } - else if (left->m_from_link_list && !right->m_from_link_list) { - // Same as above, but with left values coming from links - REALM_ASSERT_DEBUG(right->m_values > 0); - init(true, left->m_values); - - auto right_value = right->m_storage.get(0); - for (size_t i = 0; i < left->m_values; i++) { - m_storage.set(i, o(left->m_storage.get(i), right_value)); - } - } - } - - template - REALM_FORCEINLINE void fun(const Value* value) - { - init(value->m_from_link_list, value->m_values); - - OperatorOptionalAdapter o; - for (size_t i = 0; i < value->m_values; i++) { - m_storage.set(i, o(value->m_storage.get(i))); - } - } - - - // Below import and export methods are for type conversion between float, double, int64_t, etc. - template - typename std::enable_if::value>::type REALM_FORCEINLINE - export2(ValueBase& destination) const - { - Value& d = static_cast&>(destination); - d.init(ValueBase::m_from_link_list, ValueBase::m_values, D()); - for (size_t t = 0; t < ValueBase::m_values; t++) { - if (m_storage.is_null(t)) - d.m_storage.set_null(t); - else { - d.m_storage.set(t, static_cast(m_storage[t])); - } - } - } - - template - typename std::enable_if::value>::type REALM_FORCEINLINE export2(ValueBase&) const - { - // export2 is instantiated for impossible conversions like T=StringData, D=int64_t. These are never - // performed at runtime but would result in a compiler error if we did not provide this implementation. - REALM_ASSERT_DEBUG(false); - } - - REALM_FORCEINLINE void export_Timestamp(ValueBase& destination) const override - { - export2(destination); - } - - REALM_FORCEINLINE void export_bool(ValueBase& destination) const override - { - export2(destination); - } - - REALM_FORCEINLINE void export_int64_t(ValueBase& destination) const override - { - export2(destination); - } - - REALM_FORCEINLINE void export_float(ValueBase& destination) const override - { - export2(destination); - } - - REALM_FORCEINLINE void export_int(ValueBase& destination) const override - { - export2(destination); - } - - REALM_FORCEINLINE void export_double(ValueBase& destination) const override - { - export2(destination); - } - REALM_FORCEINLINE void export_StringData(ValueBase& destination) const override - { - export2(destination); - } - REALM_FORCEINLINE void export_BinaryData(ValueBase& destination) const override - { - export2(destination); - } - REALM_FORCEINLINE void export_RowIndex(ValueBase& destination) const override - { - export2(destination); - } - REALM_FORCEINLINE void export_null(ValueBase& destination) const override - { - Value& d = static_cast&>(destination); - d.init(m_from_link_list, m_values); - } - - REALM_FORCEINLINE void import(const ValueBase& source) override - { - if (std::is_same::value) - source.export_int(*this); - else if (std::is_same::value) - source.export_Timestamp(*this); - else if (std::is_same::value) - source.export_bool(*this); - else if (std::is_same::value) - source.export_float(*this); - else if (std::is_same::value) - source.export_double(*this); - else if (std::is_same::value || std::is_same::value || - std::is_same::value) - source.export_int64_t(*this); - else if (std::is_same::value) - source.export_StringData(*this); - else if (std::is_same::value) - source.export_BinaryData(*this); - else if (std::is_same::value) - source.export_RowIndex(*this); - else if (std::is_same::value) - source.export_null(*this); - else - REALM_ASSERT_DEBUG(false); - } - - // Given a TCond (==, !=, >, <, >=, <=) and two Value, return index of first match - template - REALM_FORCEINLINE static size_t compare(Value* left, Value* right) - { - TCond c; - - if (!left->m_from_link_list && !right->m_from_link_list) { - // Compare values one-by-one (one value is one row; no link lists) - size_t min = minimum(left->ValueBase::m_values, right->ValueBase::m_values); - for (size_t m = 0; m < min; m++) { - - if (c(left->m_storage[m], right->m_storage[m], left->m_storage.is_null(m), - right->m_storage.is_null(m))) - return m; - } - } - else if (left->m_from_link_list && right->m_from_link_list) { - // FIXME: Many-to-many links not supported yet. Need to specify behaviour - REALM_ASSERT_DEBUG(false); - } - else if (!left->m_from_link_list && right->m_from_link_list) { - // Right values come from link list. Left must come from single row. Semantics: Match if at least 1 - // linked-to-value fulfills the condition - REALM_ASSERT_DEBUG(left->m_values > 0); - for (size_t r = 0; r < right->m_values; r++) { - if (c(left->m_storage[0], right->m_storage[r], left->m_storage.is_null(0), - right->m_storage.is_null(r))) - return 0; - } - } - else if (left->m_from_link_list && !right->m_from_link_list) { - // Same as above, but with left values coming from link list. - REALM_ASSERT_DEBUG(right->m_values > 0); - for (size_t l = 0; l < left->m_values; l++) { - if (c(left->m_storage[l], right->m_storage[0], left->m_storage.is_null(l), - right->m_storage.is_null(0))) - return 0; - } - } - - return not_found; // no match - } - - std::unique_ptr clone(QueryNodeHandoverPatches*) const override - { - return make_subexpr>(*this); - } - - NullableVector m_storage; -}; - -class ConstantStringValue : public Value { -public: - ConstantStringValue(const StringData& string) - : Value() - , m_string(string.is_null() ? util::none : util::make_optional(std::string(string))) - { - init(false, ValueBase::default_size, m_string); - } - - std::unique_ptr clone(QueryNodeHandoverPatches*) const override - { - return std::unique_ptr(new ConstantStringValue(*this)); - } - -private: - ConstantStringValue(const ConstantStringValue& other) - : Value() - , m_string(other.m_string) - { - init(other.m_from_link_list, other.m_values, m_string); - } - - util::Optional m_string; -}; - -// All overloads where left-hand-side is L: -// -// left-hand-side operator right-hand-side -// L +, -, *, /, <, >, ==, !=, <=, >= Subexpr2 -// -// For L = R = {int, int64_t, float, double, Timestamp}: -// Compare numeric values -template -Query operator>(double left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator>(float left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator>(int left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator>(int64_t left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator>(Timestamp left, const Subexpr2& right) -{ - return create(left, right); -} - -template -Query operator<(double left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator<(float left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator<(int left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator<(int64_t left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator<(Timestamp left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator==(double left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator==(float left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator==(int left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator==(int64_t left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator==(Timestamp left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator>=(double left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator>=(float left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator>=(int left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator>=(int64_t left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator>=(Timestamp left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator<=(double left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator<=(float left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator<=(int left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator<=(int64_t left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator<=(Timestamp left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator!=(double left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator!=(float left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator!=(int left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator!=(int64_t left, const Subexpr2& right) -{ - return create(left, right); -} -template -Query operator!=(Timestamp left, const Subexpr2& right) -{ - return create(left, right); -} - -// Arithmetic -template -Operator::type>> operator+(double left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator+(float left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator+(int left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator+(int64_t left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator-(double left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator-(float left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator-(int left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator-(int64_t left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator*(double left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator*(float left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator*(int left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator*(int64_t left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator/(double left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator/(float left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator/(int left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} -template -Operator::type>> operator/(int64_t left, const Subexpr2& right) -{ - return {make_subexpr>(left), right.clone()}; -} - -// Unary operators -template -UnaryOperator> power(const Subexpr2& left) -{ - return {left.clone()}; -} - - -// Classes used for LinkMap (see below). -struct LinkMapFunction { - // Your consume() method is given row index of the linked-to table as argument, and you must return whether or - // not you want the LinkMapFunction to exit (return false) or continue (return true) harvesting the link tree - // for the current main table row index (it will be a link tree if you have multiple type_LinkList columns - // in a link()->link() query. - virtual bool consume(size_t row_index) = 0; -}; - -struct FindNullLinks : public LinkMapFunction { - bool consume(size_t row_index) override - { - static_cast(row_index); - m_has_link = true; - return false; // we've found a row index, so this can't be a null-link, so exit link harvesting - } - - bool m_has_link = false; -}; - -struct MakeLinkVector : public LinkMapFunction { - MakeLinkVector(std::vector& result) - : m_links(result) - { - } - - bool consume(size_t row_index) override - { - m_links.push_back(row_index); - return true; // continue evaluation - } - std::vector& m_links; -}; - -struct CountLinks : public LinkMapFunction { - bool consume(size_t) override - { - m_link_count++; - return true; - } - - size_t result() const - { - return m_link_count; - } - - size_t m_link_count = 0; -}; - - -/* -The LinkMap and LinkMapFunction classes are used for query conditions on links themselves (contrary to conditions on -the value payload they point at). - -MapLink::map_links() takes a row index of the link column as argument and follows any link chain stated in the query -(through the link()->link() methods) until the final payload table is reached, and then applies LinkMapFunction on -the linked-to row index(es). - -If all link columns are type_Link, then LinkMapFunction is only invoked for a single row index. If one or more -columns are type_LinkList, then it may result in multiple row indexes. - -The reason we use this map pattern is that we can exit the link-tree-traversal as early as possible, e.g. when we've -found the first link that points to row '5'. Other solutions could be a std::vector harvest_all_links(), or an -iterator pattern. First solution can't exit, second solution requires internal state. -*/ -class LinkMap { -public: - LinkMap() = default; - LinkMap(const Table* table, std::vector columns) - : m_link_column_indexes(std::move(columns)) - { - set_base_table(table); - } - - LinkMap(LinkMap const& other, QueryNodeHandoverPatches* patches) - : LinkMap(other) - { - if (!patches) - return; - - m_link_column_indexes.clear(); - const Table* table = m_base_table; - m_base_table = nullptr; - for (auto column : m_link_columns) { - m_link_column_indexes.push_back(column->get_column_index()); - if (table->get_real_column_type(m_link_column_indexes.back()) == col_type_BackLink) - table = &static_cast(column)->get_origin_table(); - else - table = &static_cast(column)->get_target_table(); - } - } - - void set_base_table(const Table* table) - { - if (table == m_base_table) - return; - - m_base_table = table; - m_link_columns.clear(); - m_link_types.clear(); - m_only_unary_links = true; - - for (size_t link_column_index : m_link_column_indexes) { - // Link column can be either LinkList or single Link - ColumnType type = table->get_real_column_type(link_column_index); - REALM_ASSERT(Table::is_link_type(type) || type == col_type_BackLink); - m_link_types.push_back(type); - - if (type == col_type_LinkList) { - const LinkListColumn& cll = table->get_column_link_list(link_column_index); - m_link_columns.push_back(&cll); - m_only_unary_links = false; - table = &cll.get_target_table(); - } - else if (type == col_type_Link) { - const LinkColumn& cl = table->get_column_link(link_column_index); - m_link_columns.push_back(&cl); - table = &cl.get_target_table(); - } - else if (type == col_type_BackLink) { - const BacklinkColumn& bl = table->get_column_backlink(link_column_index); - m_link_columns.push_back(&bl); - m_only_unary_links = false; - table = &bl.get_origin_table(); - } - } - - m_target_table = table; - } - - std::vector get_links(size_t index) - { - std::vector res; - get_links(index, res); - return res; - } - - size_t count_links(size_t row) - { - CountLinks counter; - map_links(row, counter); - return counter.result(); - } - - void map_links(size_t row, LinkMapFunction& lm) - { - map_links(0, row, lm); - } - - bool only_unary_links() const - { - return m_only_unary_links; - } - - const Table* base_table() const - { - return m_base_table; - } - - const Table* target_table() const - { - return m_target_table; - } - - std::vector m_link_columns; - -private: - void map_links(size_t column, size_t row, LinkMapFunction& lm) - { - bool last = (column + 1 == m_link_columns.size()); - ColumnType type = m_link_types[column]; - if (type == col_type_Link) { - const LinkColumn& cl = *static_cast(m_link_columns[column]); - size_t r = to_size_t(cl.get(row)); - if (r == 0) - return; - r--; // LinkColumn stores link to row N as N + 1 - if (last) { - bool continue2 = lm.consume(r); - if (!continue2) - return; - } - else - map_links(column + 1, r, lm); - } - else if (type == col_type_LinkList) { - const LinkListColumn& cll = *static_cast(m_link_columns[column]); - ConstLinkViewRef lvr = cll.get(row); - for (size_t t = 0; t < lvr->size(); t++) { - size_t r = lvr->get(t).get_index(); - if (last) { - bool continue2 = lm.consume(r); - if (!continue2) - return; - } - else - map_links(column + 1, r, lm); - } - } - else if (type == col_type_BackLink) { - const BacklinkColumn& bl = *static_cast(m_link_columns[column]); - size_t count = bl.get_backlink_count(row); - for (size_t i = 0; i < count; ++i) { - size_t r = bl.get_backlink(row, i); - if (last) { - bool continue2 = lm.consume(r); - if (!continue2) - return; - } - else - map_links(column + 1, r, lm); - } - } - } - - - void get_links(size_t row, std::vector& result) - { - MakeLinkVector mlv = MakeLinkVector(result); - map_links(row, mlv); - } - - std::vector m_link_column_indexes; - std::vector m_link_types; - const Table* m_base_table = nullptr; - const Table* m_target_table = nullptr; - bool m_only_unary_links = true; - - template - friend Query compare(const Subexpr2&, const ConstRow&); -}; - -template -Query string_compare(const Columns& left, T right, bool case_insensitive); -template -Query string_compare(const Columns& left, const Columns& right, bool case_insensitive); - -template -Value make_value_for_link(bool only_unary_links, size_t size) -{ - Value value; - if (only_unary_links) { - REALM_ASSERT(size <= 1); - value.init(false, 1); - value.m_storage.set_null(0); - } - else { - value.init(true, size); - } - return value; -} - - -// If we add a new Realm type T and quickly want Query support for it, then simply inherit from it like -// `template <> class Columns : public SimpleQuerySupport` and you're done. Any operators of the set -// { ==, >=, <=, !=, >, < } that are supported by T will be supported by the "query expression syntax" -// automatically. NOTE: This method of Query support will be slow because it goes through Table::get. -// To get faster Query support, either add SequentialGetter support (faster) or create a query_engine.hpp -// node for it (super fast). - -template -class SimpleQuerySupport : public Subexpr2 { -public: - SimpleQuerySupport(size_t column, const Table* table, std::vector links = {}) - : m_column_ndx(column) - , m_link_map(table, std::move(links)) - { - m_column = &m_link_map.target_table()->get_column_base(m_column_ndx); - } - - bool is_nullable() const noexcept - { - return m_link_map.base_table()->is_nullable(m_column->get_column_index()); - } - - const Table* get_base_table() const override - { - return m_link_map.base_table(); - } - - void set_base_table(const Table* table) override - { - if (table != get_base_table()) { - m_link_map.set_base_table(table); - m_column = &m_link_map.target_table()->get_column_base(m_column_ndx); - } - } - - void evaluate(size_t index, ValueBase& destination) override - { - Value& d = static_cast&>(destination); - size_t col = column_ndx(); - - if (links_exist()) { - std::vector links = m_link_map.get_links(index); - Value v = make_value_for_link(m_link_map.only_unary_links(), links.size()); - - for (size_t t = 0; t < links.size(); t++) { - size_t link_to = links[t]; - v.m_storage.set(t, m_link_map.target_table()->template get(col, link_to)); - } - destination.import(v); - } - else { - // Not a link column - const Table* target_table = m_link_map.target_table(); - for (size_t t = 0; t < destination.m_values && index + t < target_table->size(); t++) { - d.m_storage.set(t, target_table->get(col, index + t)); - } - } - } - - bool links_exist() const - { - return m_link_map.m_link_columns.size() > 0; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches = nullptr) const override - { - return make_subexpr>(static_cast&>(*this), patches); - } - - SimpleQuerySupport(SimpleQuerySupport const& other, QueryNodeHandoverPatches* patches) - : Subexpr2(other) - , m_column_ndx(other.m_column_ndx) - , m_column(other.m_column) - , m_link_map(other.m_link_map, patches) - { - if (patches && m_column) { - m_column_ndx = column_ndx(); - m_column = nullptr; - } - } - - size_t column_ndx() const - { - return m_column->get_column_index(); - } - -private: - // Column index of payload column of m_table - mutable size_t m_column_ndx; - const ColumnBase* m_column; - LinkMap m_link_map; -}; - - -template <> -class Columns : public SimpleQuerySupport { - using SimpleQuerySupport::SimpleQuerySupport; -}; - -template <> -class Columns : public SimpleQuerySupport { - using SimpleQuerySupport::SimpleQuerySupport; -}; - - -template <> -class Columns : public SimpleQuerySupport { -public: - using SimpleQuerySupport::SimpleQuerySupport; - - Query equal(StringData sd, bool case_sensitive = true) - { - return string_compare(*this, sd, case_sensitive); - } - - Query equal(const Columns& col, bool case_sensitive = true) - { - return string_compare(*this, col, case_sensitive); - } - - Query not_equal(StringData sd, bool case_sensitive = true) - { - return string_compare(*this, sd, case_sensitive); - } - - Query not_equal(const Columns& col, bool case_sensitive = true) - { - return string_compare(*this, col, case_sensitive); - } - - Query begins_with(StringData sd, bool case_sensitive = true) - { - return string_compare(*this, sd, case_sensitive); - } - - Query begins_with(const Columns& col, bool case_sensitive = true) - { - return string_compare(*this, col, case_sensitive); - } - - Query ends_with(StringData sd, bool case_sensitive = true) - { - return string_compare(*this, sd, case_sensitive); - } - - Query ends_with(const Columns& col, bool case_sensitive = true) - { - return string_compare(*this, col, case_sensitive); - } - - Query contains(StringData sd, bool case_sensitive = true) - { - return string_compare(*this, sd, case_sensitive); - } - - Query contains(const Columns& col, bool case_sensitive = true) - { - return string_compare(*this, col, case_sensitive); - } - - Query like(StringData sd, bool case_sensitive = true) - { - return string_compare(*this, sd, case_sensitive); - } - - Query like(const Columns& col, bool case_sensitive = true) - { - return string_compare(*this, col, case_sensitive); - } -}; - - -template -Query string_compare(const Columns& left, T right, bool case_sensitive) -{ - StringData sd(right); - if (case_sensitive) - return create(sd, left); - else - return create(sd, left); -} - -template -Query string_compare(const Columns& left, const Columns& right, bool case_sensitive) -{ - if (case_sensitive) - return make_expression>(right.clone(), left.clone()); - else - return make_expression>(right.clone(), left.clone()); -} - -// Columns == Columns -inline Query operator==(const Columns& left, const Columns& right) -{ - return string_compare(left, right, true); -} - -// Columns != Columns -inline Query operator!=(const Columns& left, const Columns& right) -{ - return string_compare(left, right, true); -} - -// String == Columns -template -Query operator==(T left, const Columns& right) -{ - return operator==(right, left); -} - -// String != Columns -template -Query operator!=(T left, const Columns& right) -{ - return operator!=(right, left); -} - -// Columns == String -template -Query operator==(const Columns& left, T right) -{ - return string_compare(left, right, true); -} - -// Columns != String -template -Query operator!=(const Columns& left, T right) -{ - return string_compare(left, right, true); -} - - -inline Query operator==(const Columns& left, BinaryData right) -{ - return create(right, left); -} - -inline Query operator==(BinaryData left, const Columns& right) -{ - return create(left, right); -} - -inline Query operator!=(const Columns& left, BinaryData right) -{ - return create(right, left); -} - -inline Query operator!=(BinaryData left, const Columns& right) -{ - return create(left, right); -} - - -// This class is intended to perform queries on the *pointers* of links, contrary to performing queries on *payload* -// in linked-to tables. Queries can be "find first link that points at row X" or "find first null-link". Currently -// only "find first null link" and "find first non-null link" is supported. More will be added later. When we add -// more, I propose to remove the template argument from this class and instead template it by -// a criteria-class (like the FindNullLinks class below in find_first()) in some generalized fashion. -template -class UnaryLinkCompare : public Expression { -public: - UnaryLinkCompare(LinkMap lm) - : m_link_map(std::move(lm)) - { - } - - void set_base_table(const Table* table) override - { - m_link_map.set_base_table(table); - } - - // Return main table of query (table on which table->where()... is invoked). Note that this is not the same as - // any linked-to payload tables - const Table* get_base_table() const override - { - return m_link_map.base_table(); - } - - size_t find_first(size_t start, size_t end) const override - { - for (; start < end;) { - std::vector l = m_link_map.get_links(start); - // We have found a Link which is NULL, or LinkList with 0 entries. Return it as match. - - FindNullLinks fnl; - m_link_map.map_links(start, fnl); - if (fnl.m_has_link == has_links) - return start; - - start++; - } - - return not_found; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new UnaryLinkCompare(*this, patches)); - } - -private: - UnaryLinkCompare(const UnaryLinkCompare& other, QueryNodeHandoverPatches* patches = nullptr) - : Expression(other) - , m_link_map(other.m_link_map, patches) - { - } - - mutable LinkMap m_link_map; -}; - -class LinkCount : public Subexpr2 { -public: - LinkCount(LinkMap link_map) - : m_link_map(std::move(link_map)) - { - } - LinkCount(LinkCount const& other, QueryNodeHandoverPatches* patches) - : Subexpr2(other) - , m_link_map(other.m_link_map, patches) - { - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return make_subexpr(*this, patches); - } - - const Table* get_base_table() const override - { - return m_link_map.base_table(); - } - - void set_base_table(const Table* table) override - { - m_link_map.set_base_table(table); - } - - void evaluate(size_t index, ValueBase& destination) override - { - size_t count = m_link_map.count_links(index); - destination.import(Value(false, 1, count)); - } - -private: - LinkMap m_link_map; -}; - -struct ConstantRowValueHandoverPatch : public QueryNodeHandoverPatch { - std::unique_ptr row_patch; -}; - -class ConstantRowValue : public Subexpr2 { -public: - ConstantRowValue(const ConstRow& row) - : m_row(row) - { - } - - void set_base_table(const Table*) override - { - } - const Table* get_base_table() const override - { - return nullptr; - } - - void evaluate(size_t, ValueBase& destination) override - { - if (m_row.is_attached()) { - Value v(RowIndex(m_row.get_index())); - destination.import(v); - } - else { - Value v(RowIndex::Detached); - destination.import(v); - } - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new ConstantRowValue(*this, patches)); - } - - void apply_handover_patch(QueryNodeHandoverPatches& patches, Group& group) override - { - REALM_ASSERT(patches.size()); - std::unique_ptr abstract_patch = std::move(patches.back()); - patches.pop_back(); - - auto patch = dynamic_cast(abstract_patch.get()); - REALM_ASSERT(patch); - - m_row.apply_and_consume_patch(patch->row_patch, group); - } - -private: - ConstantRowValue(const ConstantRowValue& source, QueryNodeHandoverPatches* patches) - : m_row(patches ? ConstRow() : source.m_row) - { - if (!patches) - return; - - std::unique_ptr patch(new ConstantRowValueHandoverPatch); - ConstRow::generate_patch(source.m_row, patch->row_patch); - patches->emplace_back(patch.release()); - } - - ConstRow m_row; -}; - -template -class SubColumns; - -// This is for LinkList and BackLink too since they're declared as typedefs of Link. -template <> -class Columns : public Subexpr2 { -public: - Query is_null() - { - if (m_link_map.m_link_columns.size() > 1) - throw std::runtime_error("Combining link() and is_null() is currently not supported"); - // Todo, it may be useful to support the above, but we would need to figure out an intuitive behaviour - return make_expression>(m_link_map); - } - - Query is_not_null() - { - if (m_link_map.m_link_columns.size() > 1) - throw std::runtime_error("Combining link() and is_not_null() is currently not supported"); - // Todo, it may be useful to support the above, but we would need to figure out an intuitive behaviour - return make_expression>(m_link_map); - } - - LinkCount count() const - { - return LinkCount(m_link_map); - } - - template - SubColumns column(size_t column_ndx) const - { - return SubColumns(Columns(column_ndx, m_link_map.target_table()), m_link_map); - } - - const LinkMap& link_map() const - { - return m_link_map; - } - - const Table* get_base_table() const override - { - return m_link_map.base_table(); - } - void set_base_table(const Table* table) override - { - m_link_map.set_base_table(table); - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return make_subexpr>(*this, patches); - } - - void evaluate(size_t index, ValueBase& destination) override - { - std::vector links = m_link_map.get_links(index); - Value v = make_value_for_link(m_link_map.only_unary_links(), links.size()); - - for (size_t t = 0; t < links.size(); t++) { - v.m_storage.set(t, RowIndex(links[t])); - } - destination.import(v); - } - - Columns(const Columns& other, QueryNodeHandoverPatches* patches) - : Subexpr2(other) - , m_link_map(other.m_link_map, patches) - { - } - -private: - Columns(size_t column_ndx, const Table* table, const std::vector& links = {}) - : m_link_map(table, links) - { - static_cast(column_ndx); - } - - LinkMap m_link_map; - friend class Table; -}; - - -template -Query compare(const Subexpr2& left, const ConstRow& row) -{ - static_assert(std::is_same::value || std::is_same::value, - "Links can only be compared for equality."); - const Columns* column = dynamic_cast*>(&left); - if (column) { - const LinkMap& link_map = column->link_map(); - REALM_ASSERT(link_map.target_table() == row.get_table() || !row.is_attached()); -#ifdef REALM_OLDQUERY_FALLBACK - if (link_map.m_link_columns.size() == 1) { - // We can fall back to Query::links_to for != and == operations on links, but only - // for == on link lists. This is because negating query.links_to() is equivalent to - // to "ALL linklist != row" rather than the "ANY linklist != row" semantics we're after. - if (link_map.m_link_types[0] == col_type_Link || - (link_map.m_link_types[0] == col_type_LinkList && std::is_same::value)) { - const Table* t = column->get_base_table(); - Query query(*t); - - if (std::is_same::value) { - // Negate the following `links_to`. - query.Not(); - } - query.links_to(link_map.m_link_column_indexes[0], row); - return query; - } - } -#endif - } - return make_expression>(left.clone(), make_subexpr(row)); -} - -inline Query operator==(const Subexpr2& left, const ConstRow& row) -{ - return compare(left, row); -} -inline Query operator!=(const Subexpr2& left, const ConstRow& row) -{ - return compare(left, row); -} -inline Query operator==(const ConstRow& row, const Subexpr2& right) -{ - return compare(right, row); -} -inline Query operator!=(const ConstRow& row, const Subexpr2& right) -{ - return compare(right, row); -} - -template -Query compare(const Subexpr2& left, null) -{ - static_assert(std::is_same::value || std::is_same::value, - "Links can only be compared for equality."); - return make_expression>(left.clone(), make_subexpr>()); -} - -inline Query operator==(const Subexpr2& left, null) -{ - return compare(left, null()); -} -inline Query operator!=(const Subexpr2& left, null) -{ - return compare(left, null()); -} -inline Query operator==(null, const Subexpr2& right) -{ - return compare(right, null()); -} -inline Query operator!=(null, const Subexpr2& right) -{ - return compare(right, null()); -} - - -template -class Columns : public Subexpr2 { -public: - using ColType = typename ColumnTypeTraits::column_type; - - Columns(size_t column, const Table* table, std::vector links = {}) - : m_link_map(table, std::move(links)) - , m_column(column) - , m_nullable(m_link_map.target_table()->is_nullable(m_column)) - { - } - - Columns(const Columns& other, QueryNodeHandoverPatches* patches = nullptr) - : m_link_map(other.m_link_map, patches) - , m_column(other.m_column) - , m_nullable(other.m_nullable) - { - if (!other.m_sg) - return; - - if (patches) { - m_column = other.get_column_base().get_column_index(); - } - else { - if (m_nullable && std::is_same::value) { - init(&other.get_column_base()); - } - else { - init(&other.get_column_base()); - } - } - } - - Columns& operator=(const Columns& other) - { - if (this != &other) { - m_link_map = other.m_link_map; - m_sg.reset(); - m_column = other.m_column; - m_nullable = other.m_nullable; - } - return *this; - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return make_subexpr>(*this, patches); - } - - // See comment in base class - void set_base_table(const Table* table) override - { - if (m_sg && table == get_base_table()) - return; - - m_link_map.set_base_table(table); - m_nullable = m_link_map.target_table()->is_nullable(m_column); - - const ColumnBase* c = &m_link_map.target_table()->get_column_base(m_column); - if (m_nullable && std::is_same::value) { - init(c); - } - else { - init(c); - } - } - - template - void init(const ColumnBase* c) - { - REALM_ASSERT_DEBUG(dynamic_cast(c)); - if (m_sg == nullptr) { - m_sg.reset(new SequentialGetter()); - } - static_cast&>(*m_sg).init(static_cast(c)); - } - - // Recursively fetch tables of columns in expression tree. Used when user first builds a stand-alone expression - // and binds it to a Query at a later time - const Table* get_base_table() const override - { - return m_link_map.base_table(); - } - - template - void evaluate_internal(size_t index, ValueBase& destination) - { - REALM_ASSERT_DEBUG(m_sg.get()); - REALM_ASSERT_DEBUG(dynamic_cast*>(m_sg.get())); - - using U = typename ColType2::value_type; - auto sgc = static_cast*>(m_sg.get()); - REALM_ASSERT_DEBUG(sgc->m_column); - - if (links_exist()) { - // LinkList with more than 0 values. Create Value with payload for all fields - - std::vector links = m_link_map.get_links(index); - auto v = make_value_for_link::type>(m_link_map.only_unary_links(), - links.size()); - - for (size_t t = 0; t < links.size(); t++) { - size_t link_to = links[t]; - sgc->cache_next(link_to); - - if (sgc->m_column->is_null(link_to)) - v.m_storage.set_null(t); - else - v.m_storage.set(t, sgc->get_next(link_to)); - } - destination.import(v); - } - else { - // Not a Link column - // make sequential getter load the respective leaf to access data at column row 'index' - sgc->cache_next(index); - size_t colsize = sgc->m_column->size(); - - // Now load `ValueBase::default_size` rows from from the leaf into m_storage. If it's an integer - // leaf, then it contains the method get_chunk() which copies these values in a super fast way (first - // case of the `if` below. Otherwise, copy the values one by one in a for-loop (the `else` case). - if (std::is_same::value && index + ValueBase::default_size <= sgc->m_leaf_end) { - Value v; - - // If you want to modify 'default_size' then update Array::get_chunk() - REALM_ASSERT_3(ValueBase::default_size, ==, 8); - - auto sgc_2 = static_cast*>(m_sg.get()); - sgc_2->m_leaf_ptr->get_chunk( - index - sgc->m_leaf_start, - static_cast*>(static_cast(&v))->m_storage.m_first); - - destination.import(v); - } - else { - size_t rows = colsize - index; - if (rows > ValueBase::default_size) - rows = ValueBase::default_size; - Value::type> v(false, rows); - - for (size_t t = 0; t < rows; t++) - v.m_storage.set(t, sgc->get_next(index + t)); - - destination.import(v); - } - } - } - - // Load values from Column into destination - void evaluate(size_t index, ValueBase& destination) override - { - if (m_nullable && std::is_same::value) { - evaluate_internal(index, destination); - } - else { - evaluate_internal(index, destination); - } - } - - bool links_exist() const - { - return m_link_map.m_link_columns.size() > 0; - } - - bool is_nullable() const - { - return m_nullable; - } - - size_t column_ndx() const noexcept - { - return m_sg ? get_column_base().get_column_index() : m_column; - } - -private: - LinkMap m_link_map; - - // Fast (leaf caching) value getter for payload column (column in table on which query condition is executed) - std::unique_ptr m_sg; - - // Column index of payload column of m_table - size_t m_column; - - // set to false by default for stand-alone Columns declaration that are not yet associated with any table - // or oclumn. Call init() to update it or use a constructor that takes table + column index as argument. - bool m_nullable = false; - - const ColumnBase& get_column_base() const noexcept - { - if (m_nullable && std::is_same::value) - return *static_cast&>(*m_sg).m_column; - else - return *static_cast&>(*m_sg).m_column; - } -}; - -template -class SubColumnAggregate; -namespace aggregate_operations { -template -class Minimum; -template -class Maximum; -template -class Sum; -template -class Average; -} - -template -class SubColumns : public Subexpr { -public: - SubColumns(Columns column, LinkMap link_map) - : m_column(std::move(column)) - , m_link_map(std::move(link_map)) - { - } - - std::unique_ptr clone(QueryNodeHandoverPatches*) const override - { - return make_subexpr>(*this); - } - - const Table* get_base_table() const override - { - return m_link_map.base_table(); - } - - void set_base_table(const Table* table) override - { - m_link_map.set_base_table(table); - m_column.set_base_table(m_link_map.target_table()); - } - - void evaluate(size_t, ValueBase&) override - { - // SubColumns can only be used in an expression in conjunction with its aggregate methods. - REALM_ASSERT(false); - } - - SubColumnAggregate> min() const - { - return {m_column, m_link_map}; - } - - SubColumnAggregate> max() const - { - return {m_column, m_link_map}; - } - - SubColumnAggregate> sum() const - { - return {m_column, m_link_map}; - } - - SubColumnAggregate> average() const - { - return {m_column, m_link_map}; - } - -private: - Columns m_column; - LinkMap m_link_map; -}; - -template -class SubColumnAggregate : public Subexpr2 { -public: - SubColumnAggregate(Columns column, LinkMap link_map) - : m_column(std::move(column)) - , m_link_map(std::move(link_map)) - { - } - SubColumnAggregate(SubColumnAggregate const& other, QueryNodeHandoverPatches* patches) - : m_column(other.m_column, patches) - , m_link_map(other.m_link_map, patches) - { - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return make_subexpr(*this, patches); - } - - const Table* get_base_table() const override - { - return m_link_map.base_table(); - } - - void set_base_table(const Table* table) override - { - m_link_map.set_base_table(table); - m_column.set_base_table(m_link_map.target_table()); - } - - void evaluate(size_t index, ValueBase& destination) override - { - std::vector links = m_link_map.get_links(index); - std::sort(links.begin(), links.end()); - - Operation op; - for (size_t link_index = 0; link_index < links.size();) { - Value value; - size_t link = links[link_index]; - m_column.evaluate(link, value); - - // Columns::evaluate fetches values in chunks of ValueBase::default_size. Process all values - // within the chunk that came from rows that we link to. - const auto& value_storage = value.m_storage; - for (size_t value_index = 0; value_index < value.m_values;) { - if (!value_storage.is_null(value_index)) { - op.accumulate(value_storage[value_index]); - } - if (++link_index >= links.size()) { - break; - } - - size_t previous_link = link; - link = links[link_index]; - value_index += link - previous_link; - } - } - if (op.is_null()) { - destination.import(Value(false, 1, null())); - } - else { - destination.import(Value(false, 1, op.result())); - } - } - -private: - Columns m_column; - LinkMap m_link_map; -}; - -struct SubQueryCountHandoverPatch : QueryNodeHandoverPatch { - QueryHandoverPatch m_query; -}; - -class SubQueryCount : public Subexpr2 { -public: - SubQueryCount(Query q, LinkMap link_map) - : m_query(std::move(q)) - , m_link_map(std::move(link_map)) - { - } - - const Table* get_base_table() const override - { - return m_link_map.base_table(); - } - - void set_base_table(const Table* table) override - { - m_link_map.set_base_table(table); - } - - void evaluate(size_t index, ValueBase& destination) override - { - std::vector links = m_link_map.get_links(index); - std::sort(links.begin(), links.end()); - - size_t count = std::accumulate(links.begin(), links.end(), size_t(0), [this](size_t running_count, size_t link) { - return running_count + m_query.count(link, link + 1, 1); - }); - - destination.import(Value(false, 1, size_t(count))); - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - if (patches) - return std::unique_ptr(new SubQueryCount(*this, patches)); - - return make_subexpr(*this); - } - - void apply_handover_patch(QueryNodeHandoverPatches& patches, Group& group) override - { - REALM_ASSERT(patches.size()); - std::unique_ptr abstract_patch = std::move(patches.back()); - patches.pop_back(); - - auto patch = dynamic_cast(abstract_patch.get()); - REALM_ASSERT(patch); - - m_query.apply_patch(patch->m_query, group); - } - -private: - SubQueryCount(const SubQueryCount& other, QueryNodeHandoverPatches* patches) - : m_link_map(other.m_link_map, patches) - { - std::unique_ptr patch(new SubQueryCountHandoverPatch); - m_query = Query(other.m_query, patch->m_query, ConstSourcePayload::Copy); - patches->emplace_back(patch.release()); - } - - Query m_query; - LinkMap m_link_map; -}; - -// The unused template parameter is a hack to avoid a circular dependency between table.hpp and query_expression.hpp. -template -class SubQuery { -public: - SubQuery(Columns link_column, Query query) - : m_query(std::move(query)) - , m_link_map(link_column.link_map()) - { - REALM_ASSERT(m_link_map.target_table() == m_query.get_table()); - } - - SubQueryCount count() const - { - return SubQueryCount(m_query, m_link_map); - } - -private: - Query m_query; - LinkMap m_link_map; -}; - -namespace aggregate_operations { -template -class BaseAggregateOperation { - static_assert(std::is_same::value || std::is_same::value || std::is_same::value, - "Numeric aggregates can only be used with subcolumns of numeric types"); - -public: - using ResultType = R; - - void accumulate(T value) - { - m_count++; - m_result = Derived::apply(m_result, value); - } - - bool is_null() const - { - return m_count == 0; - } - ResultType result() const - { - return m_result; - } - -protected: - size_t m_count = 0; - ResultType m_result = Derived::initial_value(); -}; - -template -class Minimum : public BaseAggregateOperation> { -public: - static T initial_value() - { - return std::numeric_limits::max(); - } - static T apply(T a, T b) - { - return std::min(a, b); - } -}; - -template -class Maximum : public BaseAggregateOperation> { -public: - static T initial_value() - { - return std::numeric_limits::min(); - } - static T apply(T a, T b) - { - return std::max(a, b); - } -}; - -template -class Sum : public BaseAggregateOperation> { -public: - static T initial_value() - { - return T(); - } - static T apply(T a, T b) - { - return a + b; - } - bool is_null() const - { - return false; - } -}; - -template -class Average : public BaseAggregateOperation, double> { - using Base = BaseAggregateOperation, double>; - -public: - static double initial_value() - { - return 0; - } - static double apply(double a, T b) - { - return a + b; - } - double result() const - { - return Base::m_result / Base::m_count; - } -}; -} - -template -class UnaryOperator : public Subexpr2 { -public: - UnaryOperator(std::unique_ptr left) - : m_left(std::move(left)) - { - } - - UnaryOperator(const UnaryOperator& other, QueryNodeHandoverPatches* patches) - : m_left(other.m_left->clone(patches)) - { - } - - UnaryOperator& operator=(const UnaryOperator& other) - { - if (this != &other) { - m_left = other.m_left->clone(); - } - return *this; - } - - UnaryOperator(UnaryOperator&&) = default; - UnaryOperator& operator=(UnaryOperator&&) = default; - - // See comment in base class - void set_base_table(const Table* table) override - { - m_left->set_base_table(table); - } - - // Recursively fetch tables of columns in expression tree. Used when user first builds a stand-alone expression - // and - // binds it to a Query at a later time - const Table* get_base_table() const override - { - return m_left->get_base_table(); - } - - // destination = operator(left) - void evaluate(size_t index, ValueBase& destination) override - { - Value result; - Value left; - m_left->evaluate(index, left); - result.template fun(&left); - destination.import(result); - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return make_subexpr(*this, patches); - } - - void apply_handover_patch(QueryNodeHandoverPatches& patches, Group& group) override - { - m_left->apply_handover_patch(patches, group); - } - -private: - typedef typename oper::type T; - std::unique_ptr m_left; -}; - - -template -class Operator : public Subexpr2 { -public: - Operator(std::unique_ptr left, std::unique_ptr right) - : m_left(std::move(left)) - , m_right(std::move(right)) - { - } - - Operator(const Operator& other, QueryNodeHandoverPatches* patches) - : m_left(other.m_left->clone(patches)) - , m_right(other.m_right->clone(patches)) - { - } - - Operator& operator=(const Operator& other) - { - if (this != &other) { - m_left = other.m_left->clone(); - m_right = other.m_right->clone(); - } - return *this; - } - - Operator(Operator&&) = default; - Operator& operator=(Operator&&) = default; - - // See comment in base class - void set_base_table(const Table* table) override - { - m_left->set_base_table(table); - m_right->set_base_table(table); - } - - // Recursively fetch tables of columns in expression tree. Used when user first builds a stand-alone expression - // and - // binds it to a Query at a later time - const Table* get_base_table() const override - { - const Table* l = m_left->get_base_table(); - const Table* r = m_right->get_base_table(); - - // Queries do not support multiple different tables; all tables must be the same. - REALM_ASSERT(l == nullptr || r == nullptr || l == r); - - // nullptr pointer means expression which isn't yet associated with any table, or is a Value - return l ? l : r; - } - - // destination = operator(left, right) - void evaluate(size_t index, ValueBase& destination) override - { - Value result; - Value left; - Value right; - m_left->evaluate(index, left); - m_right->evaluate(index, right); - result.template fun(&left, &right); - destination.import(result); - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return make_subexpr(*this, patches); - } - - void apply_handover_patch(QueryNodeHandoverPatches& patches, Group& group) override - { - m_right->apply_handover_patch(patches, group); - m_left->apply_handover_patch(patches, group); - } - -private: - typedef typename oper::type T; - std::unique_ptr m_left; - std::unique_ptr m_right; -}; - - -template -class Compare : public Expression { -public: - Compare(std::unique_ptr left, std::unique_ptr right) - : m_left(std::move(left)) - , m_right(std::move(right)) - { - } - - // See comment in base class - void set_base_table(const Table* table) override - { - m_left->set_base_table(table); - m_right->set_base_table(table); - } - - // Recursively fetch tables of columns in expression tree. Used when user first builds a stand-alone expression - // and - // binds it to a Query at a later time - const Table* get_base_table() const override - { - const Table* l = m_left->get_base_table(); - const Table* r = m_right->get_base_table(); - - // All main tables in each subexpression of a query (table.columns() or table.link()) must be the same. - REALM_ASSERT(l == nullptr || r == nullptr || l == r); - - // nullptr pointer means expression which isn't yet associated with any table, or is a Value - return l ? l : r; - } - - size_t find_first(size_t start, size_t end) const override - { - size_t match; - Value right; - Value left; - - for (; start < end;) { - m_left->evaluate(start, left); - m_right->evaluate(start, right); - match = Value::template compare(&left, &right); - - if (match != not_found && match + start < end) - return start + match; - - size_t rows = - (left.m_from_link_list || right.m_from_link_list) ? 1 : minimum(right.m_values, left.m_values); - start += rows; - } - - return not_found; // no match - } - - std::unique_ptr clone(QueryNodeHandoverPatches* patches) const override - { - return std::unique_ptr(new Compare(*this, patches)); - } - - void apply_handover_patch(QueryNodeHandoverPatches& patches, Group& group) override - { - m_right->apply_handover_patch(patches, group); - m_left->apply_handover_patch(patches, group); - } - -private: - Compare(const Compare& other, QueryNodeHandoverPatches* patches) - : m_left(other.m_left->clone(patches)) - , m_right(other.m_right->clone(patches)) - { - } - - std::unique_ptr m_left; - std::unique_ptr m_right; -}; -} -#endif // REALM_QUERY_EXPRESSION_HPP diff --git a/Pods/Realm/include/core/realm/realm_nmmintrin.h b/Pods/Realm/include/core/realm/realm_nmmintrin.h deleted file mode 100644 index 8144da61..00000000 --- a/Pods/Realm/include/core/realm/realm_nmmintrin.h +++ /dev/null @@ -1,182 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_NMMINTRIN_H -#define REALM_NMMINTRIN_H - -/* - We must support runtime detection of CPU support of SSE when distributing Realm as a closed source library. - - This is a problem on gcc and llvm: To use SSE intrinsics we need to pass -msse on the command line (to get offered - __builtin_ accessors used by intrinsics functions). However, the -msse flag allows gcc to emit SSE instructions - in its code generation/optimization. This is unwanted because the binary would crash on non-SSE CPUs. - - Since there exists no flag in gcc that enables intrinsics but probits SSE in code generation, we define our - own intrinsics to be assembled by the back end assembler and omit passing -msse to gcc. -*/ - -#ifndef _MSC_VER - -#ifdef REALM_COMPILER_SSE -#include // SSE2 (using __m128i) -#endif - -namespace realm { - -#if 0 -#ifdef REALM_COMPILER_AVX -typedef float __m256 __attribute__((__vector_size__(32), __may_alias__)); -typedef double __m256d __attribute__((__vector_size__(32), __may_alias__)); - -const int _CMP_EQ_OQ = 0x00; // Equal (ordered, non-signaling) -const int _CMP_NEQ_OQ = 0x0c; // Not-equal (ordered, non-signaling) -const int _CMP_LT_OQ = 0x11; // Less-than (ordered, non-signaling) -const int _CMP_LE_OQ = 0x12; // Less-than-or-equal (ordered, non-signaling) -const int _CMP_GE_OQ = 0x1d; // Greater-than-or-equal (ordered, non-signaling) -const int _CMP_GT_OQ = 0x1e; // Greater-than (ordered, non-signaling) - - -template -static int movemask_cmp_ps(__m256* y1, __m256* y2) -{ - int ret; - __asm__("vmovaps %0, %%ymm0" : : "m"(*y1) : "%xmm0" ); - __asm__("vmovaps %0, %%ymm1" : : "m"(*y2) : "%xmm1" ); - __asm__("vcmpps %0, %%ymm0, %%ymm1, %%ymm0" : : "I"(op) : "%xmm0" ); - __asm__("vmovmskps %%ymm0, %0" : "=r"(ret) : : ); - return ret; -} - -template -static inline int movemask_cmp_pd(__m256d* y1, __m256d* y2) -{ - int ret; - __asm__("vmovapd %0, %%ymm0" : : "m"(*y1) : "%xmm0" ); - __asm__("vmovapd %0, %%ymm1" : : "m"(*y2) : "%xmm1" ); - __asm__("vcmppd %0, %%ymm0, %%ymm1, %%ymm0" : : "I"(op) : "%xmm0" ); - __asm__("vmovmskpd %%ymm0, %0" : "=r"(ret) : : ); - return ret; -} - - - -static inline int movemask_cmp_ps(__m256* y1, __m256* y2, int op) -{ - // todo, use constexpr; - if (op == _CMP_EQ_OQ) - return movemask_cmp_ps<_CMP_NEQ_OQ>(y1, y2); - else if (op == _CMP_NEQ_OQ) - return movemask_cmp_ps<_CMP_NEQ_OQ>(y1, y2); - else if (op == _CMP_LT_OQ) - return movemask_cmp_ps<_CMP_LT_OQ>(y1, y2); - else if (op == _CMP_LE_OQ) - return movemask_cmp_ps<_CMP_LE_OQ>(y1, y2); - else if (op == _CMP_GE_OQ) - return movemask_cmp_ps<_CMP_GE_OQ>(y1, y2); - else if (op == _CMP_GT_OQ) - return movemask_cmp_ps<_CMP_GT_OQ>(y1, y2); - - REALM_ASSERT(false); - return 0; -} - -static inline int movemask_cmp_pd(__m256d* y1, __m256d* y2, int op) -{ - // todo, use constexpr; - if (op == _CMP_EQ_OQ) - return movemask_cmp_pd<_CMP_NEQ_OQ>(y1, y2); - else if (op == _CMP_NEQ_OQ) - return movemask_cmp_pd<_CMP_NEQ_OQ>(y1, y2); - else if (op == _CMP_LT_OQ) - return movemask_cmp_pd<_CMP_LT_OQ>(y1, y2); - else if (op == _CMP_LE_OQ) - return movemask_cmp_pd<_CMP_LE_OQ>(y1, y2); - else if (op == _CMP_GE_OQ) - return movemask_cmp_pd<_CMP_GE_OQ>(y1, y2); - else if (op == _CMP_GT_OQ) - return movemask_cmp_pd<_CMP_GT_OQ>(y1, y2); - - REALM_ASSERT(false); - return 0; -} - - -#endif -#endif - -// Instructions introduced by SSE 3 and 4.2 -static inline __m128i _mm_cmpgt_epi64(__m128i xmm1, __m128i xmm2) -{ - __asm__("pcmpgtq %1, %0" : "+x" (xmm1) : "xm" (xmm2)); - return xmm1; -} - -static inline __m128i _mm_cmpeq_epi64(__m128i xmm1, __m128i xmm2) -{ - __asm__("pcmpeqq %1, %0" : "+x" (xmm1) : "xm" (xmm2)); - return xmm1; -} - -static inline __m128i __attribute__((always_inline)) _mm_min_epi8(__m128i xmm1, __m128i xmm2) -{ - __asm__("pminsb %1, %0" : "+x" (xmm1) : "xm" (xmm2)); - return xmm1; -} - -static inline __m128i __attribute__((always_inline)) _mm_max_epi8(__m128i xmm1, __m128i xmm2) -{ - __asm__("pmaxsb %1, %0" : "+x" (xmm1) : "xm" (xmm2)); - return xmm1; -} - -static inline __m128i __attribute__((always_inline)) _mm_max_epi32(__m128i xmm1, __m128i xmm2) -{ - __asm__("pmaxsd %1, %0" : "+x" (xmm1) : "xm" (xmm2)); - return xmm1; -} - -static inline __m128i __attribute__((always_inline)) _mm_min_epi32(__m128i xmm1, __m128i xmm2) -{ - __asm__("pminsd %1, %0" : "+x" (xmm1) : "xm" (xmm2)); - return xmm1; -} - -static inline __m128i __attribute__((always_inline)) _mm_cvtepi8_epi16(__m128i xmm2) -{ - __m128i xmm1; - __asm__("pmovsxbw %1, %0" : "=x" (xmm1) : "xm" (xmm2) : "xmm1"); - return xmm1; -} -static inline __m128i __attribute__((always_inline)) _mm_cvtepi16_epi32(__m128i xmm2) -{ - __m128i xmm1; - asm("pmovsxwd %1, %0" : "=x" (xmm1) : "xm" (xmm2)); - return xmm1; -} - -static inline __m128i __attribute__((always_inline)) _mm_cvtepi32_epi64(__m128i xmm2) -{ - __m128i xmm1; - __asm__("pmovsxdq %1, %0" : "=x" (xmm1) : "xm" (xmm2)); - return xmm1; -} - -} // namespace realm - -#endif -#endif diff --git a/Pods/Realm/include/core/realm/replication.hpp b/Pods/Realm/include/core/realm/replication.hpp deleted file mode 100644 index 857ab2a4..00000000 --- a/Pods/Realm/include/core/realm/replication.hpp +++ /dev/null @@ -1,540 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_REPLICATION_HPP -#define REALM_REPLICATION_HPP - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace realm { -namespace util { -class Logger; -} - -// FIXME: Be careful about the possibility of one modification function being called by another where both do -// transaction logging. - -// FIXME: The current table/subtable selection scheme assumes that a TableRef of a subtable is not accessed after any -// modification of one of its ancestor tables. - -// FIXME: Checking on same Table* requires that ~Table checks and nullifies on match. Another option would be to store -// m_selected_table as a TableRef. Yet another option would be to assign unique identifiers to each Table instance via -// Allocator. Yet another option would be to explicitely invalidate subtables recursively when parent is modified. - -/// Replication is enabled by passing an instance of an implementation of this -/// class to the SharedGroup constructor. -class Replication : public _impl::TransactLogConvenientEncoder, protected _impl::TransactLogStream { -public: - // Be sure to keep this type aligned with what is actually used in - // SharedGroup. - using version_type = _impl::History::version_type; - using InputStream = _impl::NoCopyInputStream; - class TransactLogApplier; - class Interrupted; // Exception - class SimpleIndexTranslator; - - virtual std::string get_database_path() = 0; - - /// Called during construction of the associated SharedGroup object. - /// - /// \param shared_group The assocoated SharedGroup object. - virtual void initialize(SharedGroup& shared_group) = 0; - - /// Called by the associated SharedGroup object when a session is - /// initiated. A *session* is a sequence of of temporally overlapping - /// accesses to a specific Realm file, where each access consists of a - /// SharedGroup object through which the Realm file is open. Session - /// initiation occurs during the first opening of the Realm file within such - /// a session. - /// - /// Session initiation fails if this function throws. - /// - /// \param version The current version of the associated Realm. Out-of-Realm - /// history implementation can use this to trim off history entries that - /// were successfully added to the history, but for which the corresponding - /// subsequent commits on the Realm file failed. - /// - /// The default implementation does nothing. - virtual void initiate_session(version_type version) = 0; - - /// Called by the associated SharedGroup object when a session is - /// terminated. See initiate_session() for the definition of a - /// session. Session termination occurs upon closing the Realm through the - /// last SharedGroup object within the session. - /// - /// The default implementation does nothing. - virtual void terminate_session() noexcept = 0; - - /// \defgroup replication_transactions - //@{ - - /// From the point of view of the Replication class, a transaction is - /// initiated when, and only when the associated SharedGroup object calls - /// initiate_transact() and the call is successful. The associated - /// SharedGroup object must terminate every initiated transaction either by - /// calling finalize_commit() or by calling abort_transact(). It may only - /// call finalize_commit(), however, after calling prepare_commit(), and - /// only when prepare_commit() succeeds. If prepare_commit() fails (i.e., - /// throws) abort_transact() must still be called. - /// - /// The associated SharedGroup object is supposed to terminate a transaction - /// as soon as possible, and is required to terminate it before attempting - /// to initiate a new one. - /// - /// initiate_transact() is called by the associated SharedGroup object as - /// part of the initiation of a transaction, and at a time where the caller - /// has acquired exclusive write access to the local Realm. The Replication - /// implementation is allowed to perform "precursor transactions" on the - /// local Realm at this time. During the initiated transaction, the - /// associated SharedGroup object must inform the Replication object of all - /// modifying operations by calling set_value() and friends. - /// - /// FIXME: There is currently no way for implementations to perform - /// precursor transactions, since a regular transaction would cause a dead - /// lock when it tries to acquire a write lock. Consider giving access to - /// special non-locking precursor transactions via an extra argument to this - /// function. - /// - /// prepare_commit() serves as the first phase of a two-phase commit. This - /// function is called by the associated SharedGroup object immediately - /// before the commit operation on the local Realm. The associated - /// SharedGroup object will then, as the second phase, either call - /// finalize_commit() or abort_transact() depending on whether the commit - /// operation succeeded or not. The Replication implementation is allowed to - /// modify the Realm via the associated SharedGroup object at this time - /// (important to in-Realm histories). - /// - /// initiate_transact() and prepare_commit() are allowed to block the - /// calling thread if, for example, they need to communicate over the - /// network. If a calling thread is blocked in one of these functions, it - /// must be possible to interrupt the blocking operation by having another - /// thread call interrupt(). The contract is as follows: When interrupt() is - /// called, then any execution of initiate_transact() or prepare_commit(), - /// initiated before the interruption, must complete without blocking, or - /// the execution must be aborted by throwing an Interrupted exception. If - /// initiate_transact() or prepare_commit() throws Interrupted, it counts as - /// a failed operation. - /// - /// finalize_commit() is called by the associated SharedGroup object - /// immediately after a successful commit operation on the local Realm. This - /// happens at a time where modification of the Realm is no longer possible - /// via the associated SharedGroup object. In the case of in-Realm - /// histories, the changes are automatically finalized as part of the commit - /// operation performed by the caller prior to the invocation of - /// finalize_commit(), so in that case, finalize_commit() might not need to - /// do anything. - /// - /// abort_transact() is called by the associated SharedGroup object to - /// terminate a transaction without committing. That is, any transaction - /// that is not terminated by finalize_commit() is terminated by - /// abort_transact(). This could be due to an explicit rollback, or due to a - /// failed commit attempt. - /// - /// Note that finalize_commit() and abort_transact() are not allowed to - /// throw. - /// - /// \param current_version The version of the snapshot that the current - /// transaction is based on. - /// - /// \param history_updated Pass true only when the history has already been - /// updated to reflect the currently bound snapshot, such as when - /// _impl::History::update_early_from_top_ref() was called during the - /// transition from a read transaction to the current write transaction. - /// - /// \return prepare_commit() returns the version of the new snapshot - /// produced by the transaction. - /// - /// \throw Interrupted Thrown by initiate_transact() and prepare_commit() if - /// a blocking operation was interrupted. - - void initiate_transact(version_type current_version, bool history_updated); - version_type prepare_commit(version_type current_version); - void finalize_commit() noexcept; - void abort_transact() noexcept; - - //@} - - - /// Interrupt any blocking call to a function in this class. This function - /// may be called asyncronously from any thread, but it may not be called - /// from a system signal handler. - /// - /// Some of the public function members of this class may block, but only - /// when it it is explicitely stated in the documention for those functions. - /// - /// FIXME: Currently we do not state blocking behaviour for all the - /// functions that can block. - /// - /// After any function has returned with an interruption indication, the - /// only functions that may safely be called are abort_transact() and the - /// destructor. If a client, after having received an interruption - /// indication, calls abort_transact() and then clear_interrupt(), it may - /// resume normal operation through this Replication object. - void interrupt() noexcept; - - /// May be called by a client to reset this Replication object after an - /// interrupted transaction. It is not an error to call this function in a - /// situation where no interruption has occured. - void clear_interrupt() noexcept; - - /// Apply a changeset to the specified group. - /// - /// \param changeset The changes to be applied. - /// - /// \param group The destination group to apply the changeset to. - /// - /// \param logger If specified, and the library was compiled in debug mode, - /// then a line describing each individual operation is writted to the - /// specified logger. - /// - /// \throw BadTransactLog If the changeset could not be successfully parsed, - /// or ended prematurely. - static void apply_changeset(InputStream& changeset, Group& group, util::Logger* logger = nullptr); - - enum HistoryType { - /// No history available. No support for either continuous transactions - /// or inter-client synchronization. - hist_None = 0, - - /// Out-of-Realm history supporting continuous transactions. - hist_OutOfRealm = 1, - - /// In-Realm history supporting continuous transactions - /// (_impl::InRealmHistory). - hist_InRealm = 2, - - /// In-Realm history supporting continuous transactions and inter-client - /// synchronization (_impl::SyncHistory). - hist_Sync = 3 - }; - - /// Returns the type of history maintained by this Replication - /// implementation, or \ref hist_None if no history is maintained by it. - /// - /// This type is used to ensure that all session participants agree on - /// history type, and that the Realm file contains a compatible type of - /// history, at the beginning of a new session. - /// - /// As a special case, if there is no top array (Group::m_top) at the - /// beginning of a new session, then all history types (as returned by - /// get_history_type()) are allowed during that session. Note that this is - /// only possible if there was no preceding session, or if no transaction - /// was sucessfully comitted during any of the preceding sessions. As soon - /// as a transaction is successfully committed, the Realm contains at least - /// a top array, and from that point on, the history type is generally - /// fixed, although still subject to certain allowed changes (as mentioned - /// below). - /// - /// For the sake of backwards compatibility with older Realm files that does - /// not store any history type, the following rule shall apply: - /// - /// - If the top array of a Realm file (Group::m_top) does not contain a - /// history type, because it is too short, it shall be understood as - /// implicitely storing the type \ref hist_None. - /// - /// Note: In what follows, the meaning of *preceding session* is: The last - /// preceding session that modified the Realm by sucessfully committing a - /// new snapshot. - /// - /// Older Realm files do not store any history type, even when they were - /// last used with a history of type \ref hist_OutOfRealm. Howewver, since - /// such histories (\ref hist_OutOfRealm) are placed outside the Realm file, - /// and are transient (recreated at the beginning of each new session), a - /// new session is not obliged to use the same type of history (\ref - /// hist_OutOfRealm). For this reason, and to achieve further backwards - /// compatibility, the following rules are adopted: - /// - /// - At the beginning of a new session, if there is no stored history - /// type (no top array), or if the stored history type is \ref - /// hist_None, assume that the history type used during the preceding - /// session was \ref hist_None or \ref hist_OutOfRealm, or that there - /// was no preceding session. In all other cases, assume that the stored - /// history type is the type used during the preceding session. - /// - /// - When storing the history type, store \ref hist_None if the history - /// type used in the current session is \ref hist_None or \ref - /// hist_OutOfRealm. In all other cases, store the actual history type - /// used. - /// - /// It shall be allowed to switch to a \ref hist_InRealm history if the - /// stored history type is either \ref hist_None or \ref - /// hist_OutOfRealm. Fortunately, this can be done simply by adding a - /// history to the Realm file (of type \ref hist_InRealm), and that is - /// possible because a \ref hist_InRealm history is independent of any - /// history used in a previous session (as long as it was session-confined), - /// or whether any history was used at all. Conversely, if a \ref - /// hist_OutOfRealm history was used in the previous session, then the - /// contents of that history becomes obsolete at the end of the previous - /// session. - /// - /// On the other hand, as soon as a history of type \ref hist_InRealm is - /// added to a Realm file, that history type is binding for all subsequent - /// sessions. In theory, this constraint is not necessary, and a later - /// switch to \ref hist_None or \ref hist_OutOfRealm would be possible - /// because of the fact that the contents of the history becomes obsolete at - /// the end of the session, however, because the \ref hist_InRealm history - /// remains in the Realm file, there are practical complications, and for - /// that reason, such switching shall not be supported. - /// - /// The \ref hist_Sync history type can only be used if the stored history - /// type is also \ref hist_Sync, or when there is no top array - /// yet. Additionally, when the stored history type is \ref hist_Sync, then - /// all subsequent sesssions must have the same type. These restrictions - /// apply because such a history needs to be maintained persistently across - /// sessions. That is, the contents of such a history is not obsolete at the - /// end of the session, and is in general needed during subsequent sessions. - /// - /// In general, if there is no stored history type (no top array) at the - /// beginning of a new session, or if the stored type disagrees with what is - /// returned by get_history_type() (which is possible due to particular - /// allowed changes of history type), the actual history type (as returned - /// by get_history_type()) used during that session, must be stored in the - /// Realm during the first successfully committed transaction of that - /// session, if any are sucessfully committed. But note that there is still - /// no need to expand the top array to store the history type \ref - /// hist_None, due to the rule mentioned above. - /// - /// Due to the rules listed above, a new history type only actually needs to - /// be stored when the history type of the session (get_history_type()) is - /// neither \ref hist_None nor \ref hist_OutOfRealm, and only when that - /// differs from the stored history type, or if there is no top array at the - /// beginning of the session. - /// - /// Summary of session-to-session history type change constraints: - /// - /// If there is no top array at the beginning of a new session, then all - /// history types (as returned by get_history_type()) are possible during - /// that session. Otherwise there must have been a preceding session (at - /// least one that adds the top array), and the following rules then apply: - /// - ///
-    ///
-    ///                      Type stored in
-    ///   Type used during   Realm file at
-    ///   preceding          beginning of     Possible history types (as returned by
-    ///   session            new session      get_history_type()) during new session
-    ///   ----------------------------------------------------------------------------
-    ///   hist_None          hist_None        hist_None, hist_OutOfRealm, hist_InRealm
-    ///   hist_OutOfRealm    hist_None        hist_None, hist_OutOfRealm, hist_InRealm
-    ///   hist_InRealm       hist_InRealm     hist_InRealm
-    ///   hist_Sync          hist_Sync        hist_Sync
-    ///
-    /// 
- /// - /// This function must return \ref hist_None when, and only when - /// get_history() returns null. - virtual HistoryType get_history_type() const noexcept = 0; - - /// Returns an object that gives access to the history of changesets in a - /// way that allows for continuous transactions to work - /// (Group::advance_transact() in particular). - /// - /// This function must return null when, and only when get_history_type() - /// returns \ref hist_None. - virtual _impl::History* get_history() = 0; - - /// Returns false by default, but must return true if, and only if this - /// history object represents a session participant that is a sync - /// agent. This is used to enforce the "maximum one sync agent per session" - /// constraint. - virtual bool is_sync_agent() const noexcept; - - virtual ~Replication() noexcept - { - } - -protected: - Replication(); - - - //@{ - - /// do_initiate_transact() is called by initiate_transact(), and likewise - /// for do_prepare_commit), do_finalize_commit(), and do_abort_transact(). - /// - /// With respect to exception safety, the Replication implementation has two - /// options: It can prepare to accept the accumulated changeset in - /// do_prepapre_commit() by allocating all required resources, and delay the - /// actual acceptance to do_finalize_commit(), which requires that the final - /// acceptance can be done without any risk of failure. Alternatively, the - /// Replication implementation can fully accept the changeset in - /// do_prepapre_commit() (allowing for failure), and then discard that - /// changeset during the next invocation of do_initiate_transact() if - /// `current_version` indicates that the previous transaction failed. - - virtual void do_initiate_transact(version_type current_version, bool history_updated) = 0; - virtual version_type do_prepare_commit(version_type orig_version) = 0; - virtual void do_finalize_commit() noexcept = 0; - virtual void do_abort_transact() noexcept = 0; - - //@} - - - virtual void do_interrupt() noexcept = 0; - - virtual void do_clear_interrupt() noexcept = 0; - - friend class _impl::TransactReverser; -}; - - -class Replication::Interrupted : public std::exception { -public: - const char* what() const noexcept override - { - return "Interrupted"; - } -}; - - -class TrivialReplication : public Replication { -public: - ~TrivialReplication() noexcept - { - } - -protected: - typedef Replication::version_type version_type; - - TrivialReplication(const std::string& database_file); - - virtual version_type prepare_changeset(const char* data, size_t size, version_type orig_version) = 0; - virtual void finalize_changeset() noexcept = 0; - - static void apply_changeset(const char* data, size_t size, SharedGroup& target, util::Logger* logger = nullptr); - - bool is_history_updated() const noexcept; - - BinaryData get_uncommitted_changes() const noexcept; - - std::string get_database_path() override; - void initialize(SharedGroup&) override; - void do_initiate_transact(version_type, bool) override; - version_type do_prepare_commit(version_type orig_version) override; - void do_finalize_commit() noexcept override; - void do_abort_transact() noexcept override; - void do_interrupt() noexcept override; - void do_clear_interrupt() noexcept override; - void transact_log_reserve(size_t n, char** new_begin, char** new_end) override; - void transact_log_append(const char* data, size_t size, char** new_begin, char** new_end) override; - -private: - const std::string m_database_file; - util::Buffer m_transact_log_buffer; - bool m_history_updated; - void internal_transact_log_reserve(size_t, char** new_begin, char** new_end); - - size_t transact_log_size(); -}; - - -// Implementation: - -inline Replication::Replication() - : _impl::TransactLogConvenientEncoder(static_cast<_impl::TransactLogStream&>(*this)) -{ -} - -inline void Replication::initiate_transact(version_type current_version, bool history_updated) -{ - do_initiate_transact(current_version, history_updated); - reset_selection_caches(); -} - -inline Replication::version_type Replication::prepare_commit(version_type orig_version) -{ - return do_prepare_commit(orig_version); -} - -inline void Replication::finalize_commit() noexcept -{ - do_finalize_commit(); -} - -inline void Replication::abort_transact() noexcept -{ - do_abort_transact(); -} - -inline void Replication::interrupt() noexcept -{ - do_interrupt(); -} - -inline void Replication::clear_interrupt() noexcept -{ - do_clear_interrupt(); -} - -inline bool Replication::is_sync_agent() const noexcept -{ - return false; -} - -inline TrivialReplication::TrivialReplication(const std::string& database_file) - : m_database_file(database_file) -{ -} - -inline bool TrivialReplication::is_history_updated() const noexcept -{ - return m_history_updated; -} - -inline BinaryData TrivialReplication::get_uncommitted_changes() const noexcept -{ - const char* data = m_transact_log_buffer.data(); - size_t size = write_position() - data; - return BinaryData(data, size); -} - -inline size_t TrivialReplication::transact_log_size() -{ - return write_position() - m_transact_log_buffer.data(); -} - -inline void TrivialReplication::transact_log_reserve(size_t n, char** new_begin, char** new_end) -{ - internal_transact_log_reserve(n, new_begin, new_end); -} - -inline void TrivialReplication::internal_transact_log_reserve(size_t n, char** new_begin, char** new_end) -{ - char* data = m_transact_log_buffer.data(); - size_t size = write_position() - data; - m_transact_log_buffer.reserve_extra(size, n); - data = m_transact_log_buffer.data(); // May have changed - *new_begin = data + size; - *new_end = data + m_transact_log_buffer.size(); -} - -} // namespace realm - -#endif // REALM_REPLICATION_HPP diff --git a/Pods/Realm/include/core/realm/row.hpp b/Pods/Realm/include/core/realm/row.hpp deleted file mode 100644 index f79794bb..00000000 --- a/Pods/Realm/include/core/realm/row.hpp +++ /dev/null @@ -1,818 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_ROW_HPP -#define REALM_ROW_HPP - -#include - -#include -#include -#include -#include -#include - -namespace realm { - -template -class BasicRow; - - -/// This class is a "mixin" and contains the common set of functions for several -/// distinct row-like classes. -/// -/// There is a direct and natural correspondance between the functions in this -/// class and functions in Table of the same name. For example: -/// -/// table[i].get_int(j) == table.get_int(i,j) -/// -/// The effect of calling most of the row accessor functions on a detached -/// accessor is unspecified and may lead to general corruption, and/or a -/// crash. The exceptions are is_attached(), detach(), get_table(), get_index(), -/// and the destructor. Note however, that get_index() will still return an -/// unspecified value for a deatched accessor. -/// -/// When a row accessor is evaluated in a boolean context, it evaluates to true -/// if, and only if it is attached. -/// -/// \tparam T A const or non-const table type (currently either `Table` or -/// `const Table`). -/// -/// \tparam R A specific row accessor class (BasicRow or BasicRowExpr) providing -/// members `T* impl_get_table() const`, `size_t impl_get_row_ndx() -/// const`, and `void impl_detach()`. Neither are allowed to throw. -/// -/// \sa Table -/// \sa BasicRow -template -class RowFuncs { -public: - typedef T table_type; - - typedef BasicTableRef ConstTableRef; - typedef BasicTableRef TableRef; // Same as ConstTableRef if `T` is 'const' - - typedef typename util::CopyConst::type L; - using ConstLinkViewRef = std::shared_ptr; - using LinkViewRef = std::shared_ptr; // Same as ConstLinkViewRef if `T` is 'const' - - int_fast64_t get_int(size_t col_ndx) const noexcept; - bool get_bool(size_t col_ndx) const noexcept; - float get_float(size_t col_ndx) const noexcept; - double get_double(size_t col_ndx) const noexcept; - StringData get_string(size_t col_ndx) const noexcept; - BinaryData get_binary(size_t col_ndx) const noexcept; - OldDateTime get_olddatetime(size_t col_ndx) const noexcept; - Timestamp get_timestamp(size_t col_ndx) const noexcept; - ConstTableRef get_subtable(size_t col_ndx) const; - TableRef get_subtable(size_t col_ndx); - size_t get_subtable_size(size_t col_ndx) const noexcept; - size_t get_link(size_t col_ndx) const noexcept; - bool is_null_link(size_t col_ndx) const noexcept; - bool is_null(size_t col_ndx) const noexcept; - ConstLinkViewRef get_linklist(size_t col_ndx) const; - LinkViewRef get_linklist(size_t col_ndx); - bool linklist_is_empty(size_t col_ndx) const noexcept; - size_t get_link_count(size_t col_ndx) const noexcept; - Mixed get_mixed(size_t col_ndx) const noexcept; - DataType get_mixed_type(size_t col_ndx) const noexcept; - template - U get(size_t col_ndx) const noexcept; - - void set_int(size_t col_ndx, int_fast64_t value); - void set_int_unique(size_t col_ndx, int_fast64_t value); - void set_bool(size_t col_ndx, bool value); - void set_float(size_t col_ndx, float value); - void set_double(size_t col_ndx, double value); - void set_string(size_t col_ndx, StringData value); - void set_string_unique(size_t col_ndx, StringData value); - void set_binary(size_t col_ndx, BinaryData value); - void set_olddatetime(size_t col_ndx, OldDateTime value); - void set_timestamp(size_t col_ndx, Timestamp value); - void set_subtable(size_t col_ndx, const Table* value); - void set_link(size_t col_ndx, size_t value); - void nullify_link(size_t col_ndx); - void set_mixed(size_t col_ndx, Mixed value); - void set_mixed_subtable(size_t col_ndx, const Table* value); - void set_null(size_t col_ndx); - void set_null_unique(size_t col_ndx); - - void insert_substring(size_t col_ndx, size_t pos, StringData); - void remove_substring(size_t col_ndx, size_t pos, size_t size); - - //@{ - /// Note that these operations will cause the row accessor to be detached. - void remove(); - void move_last_over(); - //@} - - size_t get_backlink_count(const Table& src_table, size_t src_col_ndx) const noexcept; - size_t get_backlink(const Table& src_table, size_t src_col_ndx, size_t backlink_ndx) const noexcept; - - size_t get_column_count() const noexcept; - DataType get_column_type(size_t col_ndx) const noexcept; - StringData get_column_name(size_t col_ndx) const noexcept; - size_t get_column_index(StringData name) const noexcept; - - /// Returns true if, and only if this accessor is currently attached to a - /// row. - /// - /// A row accesor may get detached from the underlying row for various - /// reasons (see below). When it does, it no longer refers to anything, and - /// can no longer be used, except for calling is_attached(), detach(), - /// get_table(), get_index(), and the destructor. The consequences of - /// calling other methods on a detached row accessor are unspecified. There - /// are a few Realm functions (Table::find_pkey_int()) that return a - /// detached row accessor to indicate a 'null' result. In all other cases, - /// however, row accessors obtained by calling functions in the Realm API - /// are always in the 'attached' state immediately upon return from those - /// functions. - /// - /// A row accessor becomes detached if the underlying row is removed, if the - /// associated table accessor becomes detached, or if the detach() method is - /// called. A row accessor does not become detached for any other reason. - bool is_attached() const noexcept; - - /// Detach this accessor from the row it was attached to. This function has - /// no effect if the accessor was already detached (idempotency). - void detach() noexcept; - - /// The table containing the row to which this accessor is currently - /// bound. For a detached accessor, the returned value is null. - const table_type* get_table() const noexcept; - table_type* get_table() noexcept; - - /// The index of the row to which this accessor is currently bound. For a - /// detached accessor, the returned value is unspecified. - size_t get_index() const noexcept; - - explicit operator bool() const noexcept; - -private: - const T* table() const noexcept; - T* table() noexcept; - size_t row_ndx() const noexcept; -}; - - -/// This class is a special kind of row accessor. It differes from a real row -/// accessor (BasicRow) by having a trivial and fast copy constructor and -/// descructor. It is supposed to be used as the return type of functions such -/// as Table::operator[](), and then to be used as a basis for constructing a -/// real row accessor. Objects of this class are intended to only ever exist as -/// temporaries. -/// -/// In contrast to a real row accessor (`BasicRow`), objects of this class do -/// not keep the parent table "alive", nor are they maintained (adjusted) across -/// row insertions and row removals like real row accessors are. -/// -/// \sa BasicRow -template -class BasicRowExpr : public RowFuncs> { -public: - BasicRowExpr() noexcept; - - template - BasicRowExpr(const BasicRowExpr&) noexcept; - -private: - T* m_table; // nullptr if detached. - size_t m_row_ndx; // Undefined if detached. - - BasicRowExpr(T*, size_t init_row_ndx) noexcept; - - T* impl_get_table() const noexcept; - size_t impl_get_row_ndx() const noexcept; - void impl_detach() noexcept; - - // Make impl_get_table(), impl_get_row_ndx(), and impl_detach() accessible - // from RowFuncs. - friend class RowFuncs>; - - // Make m_table and m_col_ndx accessible from BasicRowExpr(const - // BasicRowExpr&) for any U. - template - friend class BasicRowExpr; - - // Make m_table and m_col_ndx accessible from - // BasicRow::BaicRow(BasicRowExpr) for any U. - template - friend class BasicRow; - - // Make BasicRowExpr(T*, size_t) accessible from Table. - friend class Table; -}; - -// fwd decl -class Group; - -class RowBase { -protected: - TableRef m_table; // nullptr if detached. - size_t m_row_ndx; // Undefined if detached. - - void attach(Table*, size_t row_ndx) noexcept; - void reattach(Table*, size_t row_ndx) noexcept; - void impl_detach() noexcept; - - RowBase() - { - } - - RowBase(const RowBase&) = delete; - using HandoverPatch = RowBaseHandoverPatch; - - RowBase(const RowBase& source, HandoverPatch& patch); - -public: - static void generate_patch(const RowBase& source, HandoverPatch& patch); - void apply_patch(HandoverPatch& patch, Group& group); - -private: - RowBase* m_prev = nullptr; // nullptr if first, undefined if detached. - RowBase* m_next = nullptr; // nullptr if last, undefined if detached. - - // Table needs to be able to modify m_table and m_row_ndx. - friend class Table; -}; - - -/// An accessor class for table rows (a.k.a. a "row accessor"). -/// -/// For as long as it remains attached, a row accessor will keep the parent -/// table accessor alive. In case the lifetime of the parent table is not -/// managed by reference counting (such as when the table is an automatic -/// variable on the stack), the destruction of the table will cause all -/// remaining row accessors to be detached. -/// -/// While attached, a row accessor is bound to a particular row of the parent -/// table. If that row is removed, the accesssor becomes detached. If rows are -/// inserted or removed before it (at lower row index), then the accessor is -/// automatically adjusted to account for the change in index of the row to -/// which the accessor is bound. In other words, a row accessor is bound to the -/// contents of a row, not to a row index. See also is_attached(). -/// -/// Row accessors are created and used as follows: -/// -/// Row row = table[7]; // 8th row of `table` -/// ConstRow crow = ctable[2]; // 3rd row of const `ctable` -/// Row first_row = table.front(); -/// Row last_row = table.back(); -/// -/// float v = row.get_float(1); // Get the float in the 2nd column -/// row.set_string(0, "foo"); // Update the string in the 1st column -/// -/// Table* t = row.get_table(); // The parent table -/// size_t i = row.get_index(); // The current row index -/// -/// \sa RowFuncs -template -class BasicRow : private RowBase, public RowFuncs> { -public: - BasicRow() noexcept; - - template - BasicRow(BasicRowExpr) noexcept; - - BasicRow(const BasicRow&) noexcept; - - template - BasicRow(const BasicRow&) noexcept; - - template - BasicRow& operator=(BasicRowExpr) noexcept; - - template - BasicRow& operator=(BasicRow) noexcept; - - BasicRow& operator=(const BasicRow&) noexcept; - - ~BasicRow() noexcept; - -private: - T* impl_get_table() const noexcept; - size_t impl_get_row_ndx() const noexcept; - - // Make impl_get_table(), impl_get_row_ndx(), and impl_detach() accessible - // from RowFuncs. - friend class RowFuncs>; - - // Make m_table and m_col_ndx accessible from BasicRow(const BasicRow&) - // for any U. - template - friend class BasicRow; - -public: - std::unique_ptr> clone_for_handover(std::unique_ptr& patch) const - { - patch.reset(new HandoverPatch); - std::unique_ptr> retval(new BasicRow(*this, *patch)); - return retval; - } - - static void generate_patch(const BasicRow& row, std::unique_ptr& patch) - { - patch.reset(new HandoverPatch); - RowBase::generate_patch(row, *patch); - } - - void apply_and_consume_patch(std::unique_ptr& patch, Group& group) - { - apply_patch(*patch, group); - patch.reset(); - } - - void apply_patch(HandoverPatch& patch, Group& group) - { - RowBase::apply_patch(patch, group); - } - -private: - BasicRow(const BasicRow& source, HandoverPatch& patch) - : RowBase(source, patch) - { - } - friend class SharedGroup; -}; - -typedef BasicRow Row; -typedef BasicRow ConstRow; - - -// Implementation - -template -inline int_fast64_t RowFuncs::get_int(size_t col_ndx) const noexcept -{ - return table()->get_int(col_ndx, row_ndx()); -} - -template -inline bool RowFuncs::get_bool(size_t col_ndx) const noexcept -{ - return table()->get_bool(col_ndx, row_ndx()); -} - -template -inline float RowFuncs::get_float(size_t col_ndx) const noexcept -{ - return table()->get_float(col_ndx, row_ndx()); -} - -template -inline double RowFuncs::get_double(size_t col_ndx) const noexcept -{ - return table()->get_double(col_ndx, row_ndx()); -} - -template -inline StringData RowFuncs::get_string(size_t col_ndx) const noexcept -{ - return table()->get_string(col_ndx, row_ndx()); -} - -template -inline BinaryData RowFuncs::get_binary(size_t col_ndx) const noexcept -{ - return table()->get_binary(col_ndx, row_ndx()); -} - -template -inline OldDateTime RowFuncs::get_olddatetime(size_t col_ndx) const noexcept -{ - return table()->get_olddatetime(col_ndx, row_ndx()); -} - -template -inline Timestamp RowFuncs::get_timestamp(size_t col_ndx) const noexcept -{ - return table()->get_timestamp(col_ndx, row_ndx()); -} - -template -inline typename RowFuncs::ConstTableRef RowFuncs::get_subtable(size_t col_ndx) const -{ - return table()->get_subtable(col_ndx, row_ndx()); // Throws -} - -template -inline typename RowFuncs::TableRef RowFuncs::get_subtable(size_t col_ndx) -{ - return table()->get_subtable(col_ndx, row_ndx()); // Throws -} - -template -inline size_t RowFuncs::get_subtable_size(size_t col_ndx) const noexcept -{ - return table()->get_subtable_size(col_ndx, row_ndx()); -} - -template -inline size_t RowFuncs::get_link(size_t col_ndx) const noexcept -{ - return table()->get_link(col_ndx, row_ndx()); -} - -template -inline bool RowFuncs::is_null_link(size_t col_ndx) const noexcept -{ - return table()->is_null_link(col_ndx, row_ndx()); -} - -template -inline bool RowFuncs::is_null(size_t col_ndx) const noexcept -{ - return table()->is_null(col_ndx, row_ndx()); -} - -template -inline typename RowFuncs::ConstLinkViewRef RowFuncs::get_linklist(size_t col_ndx) const -{ - return table()->get_linklist(col_ndx, row_ndx()); // Throws -} - -template -inline typename RowFuncs::LinkViewRef RowFuncs::get_linklist(size_t col_ndx) -{ - return table()->get_linklist(col_ndx, row_ndx()); // Throws -} - -template -inline bool RowFuncs::linklist_is_empty(size_t col_ndx) const noexcept -{ - return table()->linklist_is_empty(col_ndx, row_ndx()); -} - -template -inline size_t RowFuncs::get_link_count(size_t col_ndx) const noexcept -{ - return table()->get_link_count(col_ndx, row_ndx()); -} - -template -inline Mixed RowFuncs::get_mixed(size_t col_ndx) const noexcept -{ - return table()->get_mixed(col_ndx, row_ndx()); -} - -template -inline DataType RowFuncs::get_mixed_type(size_t col_ndx) const noexcept -{ - return table()->get_mixed_type(col_ndx, row_ndx()); -} - -template -template -inline U RowFuncs::get(size_t col_ndx) const noexcept -{ - return table()->template get(col_ndx, row_ndx()); -} - -template -inline void RowFuncs::set_int(size_t col_ndx, int_fast64_t value) -{ - table()->set_int(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_int_unique(size_t col_ndx, int_fast64_t value) -{ - table()->set_int_unique(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_bool(size_t col_ndx, bool value) -{ - table()->set_bool(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_float(size_t col_ndx, float value) -{ - table()->set_float(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_double(size_t col_ndx, double value) -{ - table()->set_double(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_string(size_t col_ndx, StringData value) -{ - table()->set_string(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_string_unique(size_t col_ndx, StringData value) -{ - table()->set_string_unique(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_binary(size_t col_ndx, BinaryData value) -{ - table()->set_binary(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_olddatetime(size_t col_ndx, OldDateTime value) -{ - table()->set_olddatetime(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_timestamp(size_t col_ndx, Timestamp value) -{ - table()->set_timestamp(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_subtable(size_t col_ndx, const Table* value) -{ - table()->set_subtable(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_link(size_t col_ndx, size_t value) -{ - table()->set_link(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::nullify_link(size_t col_ndx) -{ - table()->nullify_link(col_ndx, row_ndx()); // Throws -} - -template -inline void RowFuncs::set_mixed(size_t col_ndx, Mixed value) -{ - table()->set_mixed(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_mixed_subtable(size_t col_ndx, const Table* value) -{ - table()->set_mixed_subtable(col_ndx, row_ndx(), value); // Throws -} - -template -inline void RowFuncs::set_null(size_t col_ndx) -{ - table()->set_null(col_ndx, row_ndx()); // Throws -} - -template -inline void RowFuncs::set_null_unique(size_t col_ndx) -{ - table()->set_null_unique(col_ndx, row_ndx()); // Throws -} - -template -inline void RowFuncs::insert_substring(size_t col_ndx, size_t pos, StringData value) -{ - table()->insert_substring(col_ndx, row_ndx(), pos, value); // Throws -} - -template -inline void RowFuncs::remove_substring(size_t col_ndx, size_t pos, size_t size) -{ - table()->remove_substring(col_ndx, row_ndx(), pos, size); // Throws -} - -template -inline void RowFuncs::remove() -{ - table()->remove(row_ndx()); // Throws -} - -template -inline void RowFuncs::move_last_over() -{ - table()->move_last_over(row_ndx()); // Throws -} - -template -inline size_t RowFuncs::get_backlink_count(const Table& src_table, size_t src_col_ndx) const noexcept -{ - return table()->get_backlink_count(row_ndx(), src_table, src_col_ndx); -} - -template -inline size_t RowFuncs::get_backlink(const Table& src_table, size_t src_col_ndx, size_t backlink_ndx) const - noexcept -{ - return table()->get_backlink(row_ndx(), src_table, src_col_ndx, backlink_ndx); -} - -template -inline size_t RowFuncs::get_column_count() const noexcept -{ - return table()->get_column_count(); -} - -template -inline DataType RowFuncs::get_column_type(size_t col_ndx) const noexcept -{ - return table()->get_column_type(col_ndx); -} - -template -inline StringData RowFuncs::get_column_name(size_t col_ndx) const noexcept -{ - return table()->get_column_name(col_ndx); -} - -template -inline size_t RowFuncs::get_column_index(StringData name) const noexcept -{ - return table()->get_column_index(name); -} - -template -inline bool RowFuncs::is_attached() const noexcept -{ - return static_cast(this)->impl_get_table(); -} - -template -inline void RowFuncs::detach() noexcept -{ - static_cast(this)->impl_detach(); -} - -template -inline const T* RowFuncs::get_table() const noexcept -{ - return table(); -} - -template -inline T* RowFuncs::get_table() noexcept -{ - return table(); -} - -template -inline size_t RowFuncs::get_index() const noexcept -{ - return row_ndx(); -} - -template -inline RowFuncs::operator bool() const noexcept -{ - return is_attached(); -} - -template -inline const T* RowFuncs::table() const noexcept -{ - return static_cast(this)->impl_get_table(); -} - -template -inline T* RowFuncs::table() noexcept -{ - return static_cast(this)->impl_get_table(); -} - -template -inline size_t RowFuncs::row_ndx() const noexcept -{ - return static_cast(this)->impl_get_row_ndx(); -} - - -template -inline BasicRowExpr::BasicRowExpr() noexcept - : m_table(0) - , m_row_ndx(0) -{ -} - -template -template -inline BasicRowExpr::BasicRowExpr(const BasicRowExpr& expr) noexcept - : m_table(expr.m_table) - , m_row_ndx(expr.m_row_ndx) -{ -} - -template -inline BasicRowExpr::BasicRowExpr(T* init_table, size_t init_row_ndx) noexcept - : m_table(init_table) - , m_row_ndx(init_row_ndx) -{ -} - -template -inline T* BasicRowExpr::impl_get_table() const noexcept -{ - return m_table; -} - -template -inline size_t BasicRowExpr::impl_get_row_ndx() const noexcept -{ - return m_row_ndx; -} - -template -inline void BasicRowExpr::impl_detach() noexcept -{ - m_table = nullptr; -} - - -template -inline BasicRow::BasicRow() noexcept -{ -} - -template -inline BasicRow::BasicRow(const BasicRow& row) noexcept - : RowBase() -{ - attach(const_cast(row.m_table.get()), row.m_row_ndx); -} - -template -template -inline BasicRow::BasicRow(BasicRowExpr expr) noexcept -{ - T* expr_table = expr.m_table; // Check that pointer types are compatible - attach(const_cast(expr_table), expr.m_row_ndx); -} - -template -template -inline BasicRow::BasicRow(const BasicRow& row) noexcept -{ - T* row_table = row.m_table.get(); // Check that pointer types are compatible - attach(const_cast(row_table), row.m_row_ndx); -} - -template -template -inline BasicRow& BasicRow::operator=(BasicRowExpr expr) noexcept -{ - T* expr_table = expr.m_table; // Check that pointer types are compatible - reattach(const_cast(expr_table), expr.m_row_ndx); - return *this; -} - -template -template -inline BasicRow& BasicRow::operator=(BasicRow row) noexcept -{ - T* row_table = row.m_table.get(); // Check that pointer types are compatible - reattach(const_cast(row_table), row.m_row_ndx); - return *this; -} - -template -inline BasicRow& BasicRow::operator=(const BasicRow& row) noexcept -{ - reattach(const_cast(row.m_table.get()), row.m_row_ndx); - return *this; -} - -template -inline BasicRow::~BasicRow() noexcept -{ - RowBase::impl_detach(); -} - -template -inline T* BasicRow::impl_get_table() const noexcept -{ - return m_table.get(); -} - -template -inline size_t BasicRow::impl_get_row_ndx() const noexcept -{ - return m_row_ndx; -} - -} // namespace realm - -#endif // REALM_ROW_HPP diff --git a/Pods/Realm/include/core/realm/spec.hpp b/Pods/Realm/include/core/realm/spec.hpp deleted file mode 100644 index 78448c94..00000000 --- a/Pods/Realm/include/core/realm/spec.hpp +++ /dev/null @@ -1,476 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_SPEC_HPP -#define REALM_SPEC_HPP - -#include -#include -#include -#include -#include -#include - -namespace realm { - -class Table; -class SubspecRef; -class ConstSubspecRef; - -class Spec { -public: - Spec(SubspecRef) noexcept; - ~Spec() noexcept; - - Allocator& get_alloc() const noexcept; - - bool has_strong_link_columns() noexcept; - - void insert_column(size_t column_ndx, ColumnType type, StringData name, ColumnAttr attr = col_attr_None); - void rename_column(size_t column_ndx, StringData new_name); - void move_column(size_t from, size_t to); - - /// Erase the column at the specified index, and move columns at - /// succeeding indexes to the next lower index. - /// - /// This function is guaranteed to *never* throw if the spec is - /// used in a non-transactional context, or if the spec has - /// already been successfully modified within the current write - /// transaction. - void erase_column(size_t column_ndx); - - //@{ - // If a new Spec is constructed from the returned subspec - // reference, it is the responsibility of the application that the - // parent Spec object (this) is kept alive for at least as long as - // the new Spec object. - SubspecRef get_subtable_spec(size_t column_ndx) noexcept; - ConstSubspecRef get_subtable_spec(size_t column_ndx) const noexcept; - //@} - - // Column info - size_t get_column_count() const noexcept; - size_t get_public_column_count() const noexcept; - DataType get_public_column_type(size_t column_ndx) const noexcept; - ColumnType get_column_type(size_t column_ndx) const noexcept; - StringData get_column_name(size_t column_ndx) const noexcept; - - /// Returns size_t(-1) if the specified column is not found. - size_t get_column_index(StringData name) const noexcept; - - // Column Attributes - ColumnAttr get_column_attr(size_t column_ndx) const noexcept; - - size_t get_subspec_ndx(size_t column_ndx) const noexcept; - ref_type get_subspec_ref(size_t subspec_ndx) const noexcept; - SubspecRef get_subspec_by_ndx(size_t subspec_ndx) noexcept; - ConstSubspecRef get_subspec_by_ndx(size_t subspec_ndx) const noexcept; - - // Auto Enumerated string columns - void upgrade_string_to_enum(size_t column_ndx, ref_type keys_ref, ArrayParent*& keys_parent, size_t& keys_ndx); - size_t get_enumkeys_ndx(size_t column_ndx) const noexcept; - ref_type get_enumkeys_ref(size_t column_ndx, ArrayParent** keys_parent = nullptr, - size_t* keys_ndx = nullptr) noexcept; - - // Links - size_t get_opposite_link_table_ndx(size_t column_ndx) const noexcept; - void set_opposite_link_table_ndx(size_t column_ndx, size_t table_ndx); - bool has_backlinks() const noexcept; - void set_backlink_origin_column(size_t backlink_col_ndx, size_t origin_col_ndx); - size_t get_origin_column_ndx(size_t backlink_col_ndx) const noexcept; - size_t find_backlink_column(size_t origin_table_ndx, size_t origin_col_ndx) const noexcept; - - /// Get position in `Table::m_columns` of the specified column. It may be - /// different from the specified logical column index due to the presence of - /// search indexes, since their top refs are stored in Table::m_columns as - /// well. - size_t get_column_ndx_in_parent(size_t column_ndx) const; - - //@{ - /// Compare two table specs for equality. - bool operator==(const Spec&) const noexcept; - bool operator!=(const Spec&) const noexcept; - //@} - - void destroy() noexcept; - - size_t get_ndx_in_parent() const noexcept; - void set_ndx_in_parent(size_t) noexcept; - -#ifdef REALM_DEBUG - void verify() const; - void to_dot(std::ostream&, StringData title = StringData()) const; -#endif - -private: - // Underlying array structure. - // - // `m_subspecs` contains one entry for each subtable column, one entry for - // each link or link list columns, two entries for each backlink column, and - // zero entries for all other column types. For subtable columns the entry - // is a ref pointing to the subtable spec, for link and link list columns it - // is the group-level table index of the target table, and for backlink - // columns the first entry is the group-level table index of the origin - // table, and the second entry is the index of the origin column in the - // origin table. - Array m_top; - ArrayInteger m_types; // 1st slot in m_top - ArrayString m_names; // 2nd slot in m_top - ArrayInteger m_attr; // 3rd slot in m_top - Array m_subspecs; // 4th slot in m_top (optional) - Array m_enumkeys; // 5th slot in m_top (optional) - bool m_has_strong_link_columns; - - Spec(Allocator&) noexcept; // Unattached - - void init(ref_type) noexcept; - void init(MemRef) noexcept; - void init(SubspecRef) noexcept; - void update_has_strong_link_columns() noexcept; - - // Similar in function to Array::init_from_parent(). - void init_from_parent() noexcept; - - ref_type get_ref() const noexcept; - - /// Called in the context of Group::commit() to ensure that - /// attached table accessors stay valid across a commit. Please - /// note that this works only for non-transactional commits. Table - /// accessors obtained during a transaction are always detached - /// when the transaction ends. - void update_from_parent(size_t old_baseline) noexcept; - - void set_parent(ArrayParent*, size_t ndx_in_parent) noexcept; - - void set_column_type(size_t column_ndx, ColumnType type); - void set_column_attr(size_t column_ndx, ColumnAttr attr); - - /// Construct an empty spec and return just the reference to the - /// underlying memory. - static MemRef create_empty_spec(Allocator&); - - struct ColumnInfo { - size_t m_column_ref_ndx = 0; ///< Index within Table::m_columns - bool m_has_search_index = false; - }; - - ColumnInfo get_column_info(size_t column_ndx) const noexcept; - - size_t get_subspec_ndx_after(size_t column_ndx, size_t skip_column_ndx) const noexcept; - size_t get_subspec_entries_for_col_type(ColumnType type) const noexcept; - bool has_subspec() const noexcept; - - // Returns false if the spec has no columns, otherwise it returns - // true and sets `type` to the type of the first column. - static bool get_first_column_type_from_ref(ref_type, Allocator&, ColumnType& type) noexcept; - - friend class Replication; - friend class Group; - friend class Table; -}; - - -class SubspecRef { -public: - struct const_cast_tag { - }; - SubspecRef(const_cast_tag, ConstSubspecRef r) noexcept; - ~SubspecRef() noexcept - { - } - Allocator& get_alloc() const noexcept - { - return m_parent->get_alloc(); - } - -private: - Array* const m_parent; - size_t const m_ndx_in_parent; - - SubspecRef(Array* parent, size_t ndx_in_parent) noexcept; - - friend class Spec; - friend class ConstSubspecRef; -}; - -class ConstSubspecRef { -public: - ConstSubspecRef(SubspecRef r) noexcept; - ~ConstSubspecRef() noexcept - { - } - Allocator& get_alloc() const noexcept - { - return m_parent->get_alloc(); - } - -private: - const Array* const m_parent; - size_t const m_ndx_in_parent; - - ConstSubspecRef(const Array* parent, size_t ndx_in_parent) noexcept; - - friend class Spec; - friend class SubspecRef; -}; - - -// Implementation: - -inline Allocator& Spec::get_alloc() const noexcept -{ - return m_top.get_alloc(); -} - -inline bool Spec::has_strong_link_columns() noexcept -{ - return m_has_strong_link_columns; -} - -inline ref_type Spec::get_subspec_ref(size_t subspec_ndx) const noexcept -{ - REALM_ASSERT(subspec_ndx < m_subspecs.size()); - - // Note that this addresses subspecs directly, indexing - // by number of sub-table columns - return m_subspecs.get_as_ref(subspec_ndx); -} - -inline Spec::Spec(SubspecRef r) noexcept - : m_top(r.m_parent->get_alloc()) - , m_types(r.m_parent->get_alloc()) - , m_names(r.m_parent->get_alloc()) - , m_attr(r.m_parent->get_alloc()) - , m_subspecs(r.m_parent->get_alloc()) - , m_enumkeys(r.m_parent->get_alloc()) -{ - init(r); -} - -// Uninitialized Spec (call init() to init) -inline Spec::Spec(Allocator& alloc) noexcept - : m_top(alloc) - , m_types(alloc) - , m_names(alloc) - , m_attr(alloc) - , m_subspecs(alloc) - , m_enumkeys(alloc) -{ -} - -inline SubspecRef Spec::get_subtable_spec(size_t column_ndx) noexcept -{ - REALM_ASSERT(column_ndx < get_column_count()); - REALM_ASSERT(get_column_type(column_ndx) == col_type_Table); - size_t subspec_ndx = get_subspec_ndx(column_ndx); - return SubspecRef(&m_subspecs, subspec_ndx); -} - -inline ConstSubspecRef Spec::get_subtable_spec(size_t column_ndx) const noexcept -{ - REALM_ASSERT(column_ndx < get_column_count()); - REALM_ASSERT(get_column_type(column_ndx) == col_type_Table); - size_t subspec_ndx = get_subspec_ndx(column_ndx); - return ConstSubspecRef(&m_subspecs, subspec_ndx); -} - -inline SubspecRef Spec::get_subspec_by_ndx(size_t subspec_ndx) noexcept -{ - return SubspecRef(&m_subspecs, subspec_ndx); -} - -inline ConstSubspecRef Spec::get_subspec_by_ndx(size_t subspec_ndx) const noexcept -{ - return const_cast(this)->get_subspec_by_ndx(subspec_ndx); -} - -inline void Spec::init(ref_type ref) noexcept -{ - MemRef mem(ref, get_alloc()); - init(mem); -} - -inline void Spec::init(SubspecRef r) noexcept -{ - m_top.set_parent(r.m_parent, r.m_ndx_in_parent); - ref_type ref = r.m_parent->get_as_ref(r.m_ndx_in_parent); - init(ref); -} - -inline void Spec::init_from_parent() noexcept -{ - ref_type ref = m_top.get_ref_from_parent(); - init(ref); -} - -inline void Spec::destroy() noexcept -{ - m_top.destroy_deep(); -} - -inline size_t Spec::get_ndx_in_parent() const noexcept -{ - return m_top.get_ndx_in_parent(); -} - -inline void Spec::set_ndx_in_parent(size_t ndx) noexcept -{ - m_top.set_ndx_in_parent(ndx); -} - -inline ref_type Spec::get_ref() const noexcept -{ - return m_top.get_ref(); -} - -inline void Spec::set_parent(ArrayParent* parent, size_t ndx_in_parent) noexcept -{ - m_top.set_parent(parent, ndx_in_parent); -} - -inline void Spec::rename_column(size_t column_ndx, StringData new_name) -{ - REALM_ASSERT(column_ndx < m_types.size()); - m_names.set(column_ndx, new_name); -} - -inline size_t Spec::get_column_count() const noexcept -{ - // This is the total count of columns, including backlinks (not public) - return m_types.size(); -} - -inline size_t Spec::get_public_column_count() const noexcept -{ - // Backlinks are the last columns, and do not have names, so getting - // the number of names gives us the count of user facing columns - return m_names.size(); -} - -inline ColumnType Spec::get_column_type(size_t ndx) const noexcept -{ - REALM_ASSERT(ndx < get_column_count()); - return ColumnType(m_types.get(ndx)); -} - -inline void Spec::set_column_type(size_t column_ndx, ColumnType type) -{ - REALM_ASSERT(column_ndx < get_column_count()); - - // At this point we only support upgrading to string enum - REALM_ASSERT(ColumnType(m_types.get(column_ndx)) == col_type_String); - REALM_ASSERT(type == col_type_StringEnum); - - m_types.set(column_ndx, type); // Throws - - update_has_strong_link_columns(); -} - -inline ColumnAttr Spec::get_column_attr(size_t ndx) const noexcept -{ - REALM_ASSERT(ndx < get_column_count()); - return ColumnAttr(m_attr.get(ndx)); -} - -inline void Spec::set_column_attr(size_t column_ndx, ColumnAttr attr) -{ - REALM_ASSERT(column_ndx < get_column_count()); - - // At this point we only allow one attr at a time - // so setting it will overwrite existing. In the future - // we will allow combinations. - m_attr.set(column_ndx, attr); - - update_has_strong_link_columns(); -} - -inline StringData Spec::get_column_name(size_t ndx) const noexcept -{ - REALM_ASSERT(ndx < get_column_count()); - return m_names.get(ndx); -} - -inline size_t Spec::get_column_index(StringData name) const noexcept -{ - return m_names.find_first(name); -} - -inline bool Spec::get_first_column_type_from_ref(ref_type top_ref, Allocator& alloc, ColumnType& type) noexcept -{ - const char* top_header = alloc.translate(top_ref); - ref_type types_ref = to_ref(Array::get(top_header, 0)); - const char* types_header = alloc.translate(types_ref); - if (Array::get_size_from_header(types_header) == 0) - return false; - type = ColumnType(Array::get(types_header, 0)); - return true; -} - -inline bool Spec::has_backlinks() const noexcept -{ - // backlinks are always last and do not have names. - return m_names.size() < m_types.size(); - - // Fixme: It's bad design that backlinks are stored and recognized like this. Backlink columns - // should be a column type like any other, and we should find another way to hide them away from - // the user. -} - -// Spec will have a subspec when it contains a column which is one of: -// link, linklist, backlink, or subtable. It is possible for m_top.size() -// to contain an entry for m_subspecs (at index 3) but this reference -// may be empty if the spec contains enumkeys (at index 4) but no subspec types. -inline bool Spec::has_subspec() const noexcept -{ - return (m_top.size() >= 4) && (m_top.get_as_ref(3) != 0); -} - -inline bool Spec::operator!=(const Spec& s) const noexcept -{ - return !(*this == s); -} - - -inline SubspecRef::SubspecRef(Array* parent, size_t ndx_in_parent) noexcept - : m_parent(parent) - , m_ndx_in_parent(ndx_in_parent) -{ -} - -inline SubspecRef::SubspecRef(const_cast_tag, ConstSubspecRef r) noexcept - : m_parent(const_cast(r.m_parent)) - , m_ndx_in_parent(r.m_ndx_in_parent) -{ -} - -inline ConstSubspecRef::ConstSubspecRef(const Array* parent, size_t ndx_in_parent) noexcept - : m_parent(parent) - , m_ndx_in_parent(ndx_in_parent) -{ -} - -inline ConstSubspecRef::ConstSubspecRef(SubspecRef r) noexcept - : m_parent(r.m_parent) - , m_ndx_in_parent(r.m_ndx_in_parent) -{ -} - - -} // namespace realm - -#endif // REALM_SPEC_HPP diff --git a/Pods/Realm/include/core/realm/string_data.hpp b/Pods/Realm/include/core/realm/string_data.hpp deleted file mode 100644 index 932c1ef4..00000000 --- a/Pods/Realm/include/core/realm/string_data.hpp +++ /dev/null @@ -1,446 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_STRING_HPP -#define REALM_STRING_HPP - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -namespace realm { - -/// A reference to a chunk of character data. -/// -/// An instance of this class can be thought of as a type tag on a region of -/// memory. It does not own the referenced memory, nor does it in any other way -/// attempt to manage the lifetime of it. -/// -/// A null character inside the referenced region is considered a part of the -/// string by Realm. -/// -/// For compatibility with C-style strings, when a string is stored in a Realm -/// database, it is always followed by a terminating null character, regardless -/// of whether the string itself has internal null characters. This means that -/// when a StringData object is extracted from Realm, the referenced region is -/// guaranteed to be followed immediately by an extra null character, but that -/// null character is not inside the referenced region. Therefore, all of the -/// following forms are guaranteed to return a pointer to a null-terminated -/// string: -/// -/// \code{.cpp} -/// -/// group.get_table_name(...).data() -/// table.get_column_name().data() -/// table.get_string(...).data() -/// table.get_mixed(...).get_string().data() -/// -/// \endcode -/// -/// Note that in general, no assumptions can be made about what follows a string -/// that is referenced by a StringData object, or whether anything follows it at -/// all. In particular, the receiver of a StringData object cannot assume that -/// the referenced string is followed by a null character unless there is an -/// externally provided guarantee. -/// -/// This class makes it possible to distinguish between a 'null' reference and a -/// reference to the empty string (see is_null()). -/// -/// \sa BinaryData -/// \sa Mixed -class StringData { -public: - /// Construct a null reference. - StringData() noexcept; - - /// If \a external_data is 'null', \a data_size must be zero. - StringData(const char* external_data, size_t data_size) noexcept; - - template - StringData(const std::basic_string&); - - template - operator std::basic_string() const; - - // StringData does not store data, callers must manage their own strings. - template - StringData(std::basic_string&&) = delete; - - template - StringData(const util::Optional>&); - - StringData(const null&) noexcept; - - /// Initialize from a zero terminated C style string. Pass null to construct - /// a null reference. - StringData(const char* c_str) noexcept; - - char operator[](size_t i) const noexcept; - - const char* data() const noexcept; - size_t size() const noexcept; - - /// Is this a null reference? - /// - /// An instance of StringData is a null reference when, and only when the - /// stored size is zero (size()) and the stored pointer is the null pointer - /// (data()). - /// - /// In the case of the empty string, the stored size is still zero, but the - /// stored pointer is **not** the null pointer. It could for example point - /// to the empty string literal. Note that the actual value of the pointer - /// is immaterial in this case (as long as it is not zero), because when the - /// size is zero, it is an error to dereference the pointer. - /// - /// Conversion of a StringData object to `bool` yields the logical negation - /// of the result of calling this function. In other words, a StringData - /// object is converted to true if it is not the null reference, otherwise - /// it is converted to false. - bool is_null() const noexcept; - - friend bool operator==(const StringData&, const StringData&) noexcept; - friend bool operator!=(const StringData&, const StringData&) noexcept; - - //@{ - /// Trivial bytewise lexicographical comparison. - friend bool operator<(const StringData&, const StringData&) noexcept; - friend bool operator>(const StringData&, const StringData&) noexcept; - friend bool operator<=(const StringData&, const StringData&) noexcept; - friend bool operator>=(const StringData&, const StringData&) noexcept; - //@} - - bool begins_with(StringData) const noexcept; - bool ends_with(StringData) const noexcept; - bool contains(StringData) const noexcept; - bool contains(StringData d, const std::array &charmap) const noexcept; - - // Wildcard matching ('?' for single char, '*' for zero or more chars) - // case insensitive version in unicode.hpp - bool like(StringData) const noexcept; - - //@{ - /// Undefined behavior if \a n, \a i, or i+n is greater than - /// size(). - StringData prefix(size_t n) const noexcept; - StringData suffix(size_t n) const noexcept; - StringData substr(size_t i, size_t n) const noexcept; - StringData substr(size_t i) const noexcept; - //@} - - template - friend std::basic_ostream& operator<<(std::basic_ostream&, const StringData&); - - explicit operator bool() const noexcept; - -private: - const char* m_data; - size_t m_size; - - static bool matchlike(const StringData& text, const StringData& pattern) noexcept; -}; - - -// Implementation: - -inline StringData::StringData() noexcept - : m_data(nullptr) - , m_size(0) -{ -} - -inline StringData::StringData(const char* external_data, size_t data_size) noexcept - : m_data(external_data) - , m_size(data_size) -{ - REALM_ASSERT_DEBUG(external_data || data_size == 0); -} - -template -inline StringData::StringData(const std::basic_string& s) - : m_data(s.data()) - , m_size(s.size()) -{ -} - -template -inline StringData::operator std::basic_string() const -{ - return std::basic_string(m_data, m_size); -} - -template -inline StringData::StringData(const util::Optional>& s) - : m_data(s ? s->data() : nullptr) - , m_size(s ? s->size() : 0) -{ -} - -inline StringData::StringData(const null&) noexcept - : m_data(nullptr) - , m_size(0) -{ -} - -inline StringData::StringData(const char* c_str) noexcept - : m_data(c_str) - , m_size(0) -{ - if (c_str) - m_size = std::char_traits::length(c_str); -} - -inline char StringData::operator[](size_t i) const noexcept -{ - return m_data[i]; -} - -inline const char* StringData::data() const noexcept -{ - return m_data; -} - -inline size_t StringData::size() const noexcept -{ - return m_size; -} - -inline bool StringData::is_null() const noexcept -{ - return !m_data; -} - -inline bool operator==(const StringData& a, const StringData& b) noexcept -{ - return a.m_size == b.m_size && a.is_null() == b.is_null() && safe_equal(a.m_data, a.m_data + a.m_size, b.m_data); -} - -inline bool operator!=(const StringData& a, const StringData& b) noexcept -{ - return !(a == b); -} - -inline bool operator<(const StringData& a, const StringData& b) noexcept -{ - if (a.is_null() && !b.is_null()) { - // Null strings are smaller than all other strings, and not - // equal to empty strings. - return true; - } - return std::lexicographical_compare(a.m_data, a.m_data + a.m_size, b.m_data, b.m_data + b.m_size); -} - -inline bool operator>(const StringData& a, const StringData& b) noexcept -{ - return b < a; -} - -inline bool operator<=(const StringData& a, const StringData& b) noexcept -{ - return !(b < a); -} - -inline bool operator>=(const StringData& a, const StringData& b) noexcept -{ - return !(a < b); -} - -inline bool StringData::begins_with(StringData d) const noexcept -{ - if (is_null() && !d.is_null()) - return false; - return d.m_size <= m_size && safe_equal(m_data, m_data + d.m_size, d.m_data); -} - -inline bool StringData::ends_with(StringData d) const noexcept -{ - if (is_null() && !d.is_null()) - return false; - return d.m_size <= m_size && safe_equal(m_data + m_size - d.m_size, m_data + m_size, d.m_data); -} - -inline bool StringData::contains(StringData d) const noexcept -{ - if (is_null() && !d.is_null()) - return false; - - return d.m_size == 0 || std::search(m_data, m_data + m_size, d.m_data, d.m_data + d.m_size) != m_data + m_size; -} - -/// This method takes an array that maps chars to distance that can be moved (and zero for chars not in needle), -/// allowing the method to apply Boyer-Moore for quick substring search -/// The map is calculated in the StringNode class (so it can be reused across searches) -inline bool StringData::contains(StringData d, const std::array &charmap) const noexcept -{ - if (is_null() && !d.is_null()) - return false; - - size_t needle_size = d.size(); - if (needle_size == 0) - return true; - - // Prepare vars to avoid lookups in loop - size_t last_char_pos = d.size()-1; - unsigned char lastChar = d[last_char_pos]; - - // Do Boyer-Moore search - size_t p = last_char_pos; - while (p < m_size) { - unsigned char c = m_data[p]; // Get candidate for last char - - if (c == lastChar) { - StringData candidate = substr(p-needle_size+1, needle_size); - if (candidate == d) - return true; // text found! - } - - // If we don't have a match, see how far we can move char_pos - if (charmap[c] == 0) - p += needle_size; // char was not present in search string - else - p += charmap[c]; - } - - return false; -} - -inline bool StringData::matchlike(const StringData& text, const StringData& pattern) noexcept -{ - std::vector textpos; - std::vector patternpos; - size_t p1 = 0; // position in text (haystack) - size_t p2 = 0; // position in pattern (needle) - - while (true) { - if (p1 == text.size()) { - if (p2 == pattern.size()) - return true; - if (p2 == pattern.size() - 1 && pattern[p2] == '*') - return true; - goto no_match; - } - if (p2 == pattern.size()) - goto no_match; - - if (pattern[p2] == '*') { - textpos.push_back(p1); - patternpos.push_back(++p2); - continue; - } - if (pattern[p2] == '?') { - // utf-8 encoded characters may take up multiple bytes - if ((text[p1] & 0x80) == 0) { - ++p1; - ++p2; - continue; - } - else { - size_t p = 1; - while (p1 + p != text.size() && (text[p1 + p] & 0xc0) == 0x80) - ++p; - p1 += p; - ++p2; - continue; - } - } - - if (pattern[p2] == text[p1]) { - ++p1; - ++p2; - continue; - } - - no_match: - if (textpos.empty()) - return false; - else { - if (p1 == text.size()) { - textpos.pop_back(); - patternpos.pop_back(); - - if (textpos.empty()) - return false; - - p1 = textpos.back(); - } - else { - p1 = textpos.back(); - textpos.back() = ++p1; - } - p2 = patternpos.back(); - } - } -} - -inline bool StringData::like(StringData d) const noexcept -{ - if (is_null() || d.is_null()) { - return (is_null() && d.is_null()); - } - - return matchlike(*this, d); -} - -inline StringData StringData::prefix(size_t n) const noexcept -{ - return substr(0, n); -} - -inline StringData StringData::suffix(size_t n) const noexcept -{ - return substr(m_size - n); -} - -inline StringData StringData::substr(size_t i, size_t n) const noexcept -{ - return StringData(m_data + i, n); -} - -inline StringData StringData::substr(size_t i) const noexcept -{ - return substr(i, m_size - i); -} - -template -inline std::basic_ostream& operator<<(std::basic_ostream& out, const StringData& d) -{ - for (const char* i = d.m_data; i != d.m_data + d.m_size; ++i) - out << *i; - return out; -} - -inline StringData::operator bool() const noexcept -{ - return !is_null(); -} - -} // namespace realm - -#endif // REALM_STRING_HPP diff --git a/Pods/Realm/include/core/realm/sync/client.hpp b/Pods/Realm/include/core/realm/sync/client.hpp deleted file mode 100644 index 07d26be7..00000000 --- a/Pods/Realm/include/core/realm/sync/client.hpp +++ /dev/null @@ -1,648 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2012] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ -#ifndef REALM_SYNC_CLIENT_HPP -#define REALM_SYNC_CLIENT_HPP - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -namespace realm { -namespace sync { - -class Client { -public: - enum class Error; - - enum class ReconnectMode { - /// This is the mode that should always be used in production. In this - /// mode the client uses a scheme for determining a reconnect delay that - /// prevents it from creating too many connection requests in a short - /// amount of time (i.e., a server hammering protection mechanism). - normal, - - /// Delay reconnect attempts indefinitely. For testing purposes only. - /// - /// A reconnect attempt can be manually scheduled by calling - /// cancel_reconnect_delay(). In particular, when a connection breaks, - /// or when an attempt at establishing the connection fails, the error - /// handler is called. If one calls cancel_reconnect_delay() from that - /// invocation of the error handler, the effect is to allow another - /// reconnect attempt to occur. - never, - - /// Never delay reconnect attempts. Perform them immediately. For - /// testing purposes only. - immediate - }; - - struct Config { - Config() {} - - /// The maximum number of Realm files that will be kept open - /// concurrently by this client. The client keeps a cache of open Realm - /// files for efficiency reasons. - long max_open_files = 256; - - /// An optional logger to be used by the client. If no logger is - /// specified, the client will use an instance of util::StderrLogger - /// with the log level threshold set to util::Logger::Level::info. The - /// client does not require a thread-safe logger, and it guarantees that - /// all logging happens on behalf of the thread that executes run(). - util::Logger* logger = nullptr; - - /// verify_servers_ssl_certificate controls whether the server certificate - /// is verified for SSL connections. It should always be true in production. - /// - /// A server certificate is verified by first checking that the - /// certificate has a valid signature chain back to a trust/anchor certificate, - /// and secondly checking that the host name of the Realm URL matches - /// a host name contained in the certificate. - /// The host name of the certificate is stored in either Common Name or - /// the Alternative Subject Name (DNS section). - /// - /// From the point of view of OpenSSL, setting verify_servers_ssl_certificate - /// to false means calling `SSL_set_verify()` with `SSL_VERIFY_NONE`. - /// Setting verify_servers_ssl_certificate to true means calling `SSL_set_verify()` - /// with `SSL_VERIFY_PEER`, and setting the host name using the function - /// X509_VERIFY_PARAM_set1_host() (OpenSSL version 1.0.2 or newer). - /// For other platforms, an equivalent procedure is followed. - bool verify_servers_ssl_certificate = true; - - /// ssl_trust_certificate_path is the path of a trust/anchor certificate - /// used by the client to verify the server certificate. - /// If ssl_trust_certificate_path is None (default), the default device - /// trust/anchor store is used. - util::Optional ssl_trust_certificate_path; // default None - - /// Use ports 80 and 443 by default instead of 7800 and 7801 - /// respectively. Ideally, these default ports should have been made - /// available via a different URI scheme instead (http/https or ws/wss). - bool enable_default_port_hack = true; - - /// For testing purposes only. - ReconnectMode reconnect_mode = ReconnectMode::normal; - - /// Create a separate connection for each session. For testing purposes - /// only. - /// - // FIXME: This setting defaults to true now, due to limitations in the - // load balancer. Do not set it to false in production. - bool one_connection_per_session = true; - - /// Do not access the local file system. Sessions will act as if - /// initiated on behalf of an empty (or nonexisting) local Realm - /// file. Received DOWNLOAD messages will be accepted, but otherwise - /// ignored. No UPLOAD messages will be generated. For testing purposes - /// only. - bool dry_run = false; - }; - - /// \throw util::EventLoop::Implementation::NotAvailable if no event loop - /// implementation was specified, and - /// util::EventLoop::Implementation::get_default() throws it. - Client(Config = Config()); - Client(Client&&) noexcept; - ~Client() noexcept; - - /// Run the internal event-loop of the client. At most one thread may - /// execute run() at any given time. The call will not return until somebody - /// calls stop(). - void run(); - - /// See run(). - /// - /// Thread-safe. - void stop() noexcept; - - /// \brief Cancel current or next reconnect delay for all servers. - /// - /// This corresponds to calling Session::cancel_reconnect_delay() on all - /// bound sessions, but will also cancel reconnect delays applying to - // servers for which there are currently no bound sessions. - void cancel_reconnect_delay(); - -private: - class Impl; - std::unique_ptr m_impl; - friend class Session; -}; - - -/// Supported protocols: -/// -/// Protocol URL scheme Default port -/// ----------------------------------------------------------------------------------- -/// realm "realm:" 7800 (80 if Client::Config::enable_default_port_hack) -/// realm_ssl "realms:" 7801 (443 if Client::Config::enable_default_port_hack) -/// -enum class Protocol { - realm, - realm_ssl -}; - - -class BadServerUrl; // Exception - - -/// Session objects must be destroyed before the Client object with which they -/// are assocoated is destroyed. -/// -/// It is an error to create two Session objects for a particular Realm file if -/// those Session objects overlap in time, or if they are associated with two -/// different Client objects that overlap in time. -/// -/// Thread-safety: It is safe for multiple threads to construct, use (with some -/// exceptions), and destroy session objects concurrently, regardless of whether -/// those session objects are associated with the same, or with different Client -/// objects. Please note that some of the public member functions are fully -/// thread-safe, while others are not. -class Session { -public: - using port_type = util::network::Endpoint::port_type; - using version_type = _impl::History::version_type; - using SyncTransactCallback = void(VersionID old_version, VersionID new_version); - using ProgressHandler = void(uint_fast64_t downloaded_bytes, uint_fast64_t downloadable_bytes, - uint_fast64_t uploaded_bytes, uint_fast64_t uploadable_bytes); - using WaitOperCompletionHandler = std::function; - - /// \brief Start a new session for the specified client-side Realm. - /// - /// Note that the session is not fully activated until you call bind(). Also - /// note that if you call set_sync_transact_callback(), it must be done - /// before calling bind(). - /// - /// \param realm_path The file-system path of a local client-side Realm - /// file. - Session(Client&, std::string realm_path); - - Session(Session&&) noexcept; - - ~Session() noexcept; - - /// \brief Set a function to be called when the local Realm has changed due - /// to integration of a downloaded changeset. - /// - /// Specify the callback function that will be called when one or more - /// transactions are performed to integrate downloaded changesets into the - /// client-side Realm, that is associated with this session. - /// - /// The callback function will always be called by the thread that executes - /// the event loop (Client::run()), but not until bind() is called. If the - /// callback function throws an exception, that exception will "travel" out - /// through Client::run(). - /// - /// Note: Any call to this function must have returned before bind() is - /// called. If this function is called multiple times, each call overrides - /// the previous setting. - /// - /// Note: This function is **not thread-safe**. That is, it is an error if - /// it is called while another thread is executing any member function on - /// the same Session object. - /// - /// CAUTION: The specified callback function may be called before the call - /// to bind() returns, and it may be called (or continue to execute) after - /// the session object is destroyed. The application must pass a handler - /// that can be safely called, and can safely continue to execute from the - /// point in time where bind() starts executing, and up until the point in - /// time where the last invocation of `client.run()` returns. Here, `client` - /// refers to the associated Client object. - void set_sync_transact_callback(std::function); - - /// \brief Set a handler to monitor the state of download and upload - /// progress. - /// - /// The handler must have signature - /// - /// void(uint_fast64_t downloaded_bytes, uint_fast64_t downloadable_bytes, - /// uint_fast64_t uploaded_bytes, uint_fast64_t uploadable_bytes); - /// - /// downloaded_bytes is the size in bytes of all downloaded changesets. - /// downloadable_bytes is the size in bytes of the part of the server - /// history that do not originate from this client. - /// - /// uploaded_bytes is the size in bytes of all locally produced changesets - /// that have been received and acknowledged by the server. - /// uploadable_bytes is the size in bytes of all locally produced changesets. - /// - /// Due to the nature of the merge rules, it is possible that the size of an - /// uploaded changeset uploaded from one client is not equal to the size of - /// the changesets that other clients will download. - /// - /// Typical uses of this function: - /// - /// Upload completion can be checked by - /// - /// bool upload_complete = (uploaded_bytes == uploadable_bytes); - /// - /// Download completion could be checked by - /// - /// bool download_complete = (downloaded_bytes == downloadable_bytes); - /// - /// However, download completion might never be reached because the server - /// can receive new changesets from other clients. - /// An alternative strategy is to cache downloadable_bytes from the callback, - /// and use the cached value as the threshold. - /// - /// bool download_complete = (downloaded_bytes == cached_downloadable_bytes); - /// - /// Upload progress can be calculated by caching an initial value of - /// uploaded_bytes from the last, or next, callback. Then - /// - /// double upload_progress = - /// (uploaded_bytes - initial_uploaded_bytes) - /// ------------------------------------------- - /// (uploadable_bytes - initial_uploaded_bytes) - /// - /// Download progress can be calculates similarly: - /// - /// double download_progress = - /// (downloaded_bytes - initial_downloaded_bytes) - /// ----------------------------------------------- - /// (downloadable_bytes - initial_downloaded_bytes) - /// - /// The handler is called on the event loop thread. - /// The handler is called after or during set_progress_handler(), - /// after bind(), after each DOWNLOAD message, and after each local - /// transaction (nonsync_transact_notify). - /// - /// set_progress_handler() is not thread safe and it must be called before - /// bind() is called. Subsequent calls to set_progress_handler() overwrite - /// the previous calls. Typically, this function is called once per session. - /// - /// The progress handler is also posted to the event loop during the - /// execution of set_progress_handler(). - /// - /// CAUTION: The specified callback function may be called before the call - /// to set_progress_handler() returns, and it may be called - /// (or continue to execute) after the session object is destroyed. - /// The application must pass a handler that can be safely called, and can - /// execute from the point in time where set_progress_handler() is called, - /// and up until the point in time where the last invocation of - /// `client.run()` returns. Here, `client` refers to the associated - /// Client object. - void set_progress_handler(std::function); - - /// \brief Signature of an error handler. - /// - /// \param ec The error code. For the list of errors reported by the server, - /// see \ref ProtocolError (or `protocol.md`). For the list of errors - /// corresponding with protocol violation that are detected by the client, - /// see Client::Error. - /// - /// \param is_fatal The error is of a kind that is likely to persist, and - /// cause all future reconnect attempts to fail. The client may choose to - /// try to reconnect again later, but if so, the waiting period will be - /// substantial. - /// - /// \param detailed_message The message associated with the error. It is - /// usually equal to `ec.message()`, but may also be a more specific message - /// (one that provides extra context). The purpose of this message is mostly - /// to aid debugging. For non-debugging purposes, `ec.message()` should - /// generally be considered sufficient. - /// - /// \sa set_error_handler(). - using ErrorHandler = void(std::error_code ec, bool is_fatal, - const std::string& detailed_message); - - /// \brief Set the error handler for this session. - /// - /// Sets a function to be called when an error causes a connection - /// initiation attempt to fail, or an established connection to be broken. - /// - /// When a connection is established on behalf of multiple sessions, a - /// connection-level error will be reported to all those sessions. A - /// session-level error, on the other hand, will only be reported to the - /// affected session. - /// - /// The callback function will always be called by the thread that executes - /// the event loop (Client::run()), but not until bind() is called. If the - /// callback function throws an exception, that exception will "travel" out - /// through Client::run(). - /// - /// Note: Any call to this function must have returned before bind() is - /// called. If this function is called multiple times, each call overrides - /// the previous setting. - /// - /// Note: This function is **not thread-safe**. That is, it is an error if - /// it is called while another thread is executing any member function on - /// the same Session object. - /// - /// CAUTION: The specified callback function may be called before the call - /// to bind() returns, and it may be called (or continue to execute) after - /// the session object is destroyed. The application must pass a handler - /// that can be safely called, and can safely continue to execute from the - /// point in time where bind() starts executing, and up until the point in - /// time where the last invocation of `client.run()` returns. Here, `client` - /// refers to the associated Client object. - void set_error_handler(std::function); - - /// @{ \brief Bind this session to the specified server side Realm. - /// - /// No communication takes place on behalf of this session before the - /// session is bound, but as soon as the session becomes bound, the server - /// will start to push changes to the client, and vice versa. - /// - /// If a callback function was set using set_sync_transact_callback(), then - /// that callback function will start to be called as changesets are - /// downloaded and integrated locally. It is important to understand that - /// callback functions are executed by the event loop thread (Client::run()) - /// and the callback function may therefore be called before bind() returns. - /// - /// Note: It is an error if this function is called more than once per - /// Session object. - /// - /// Note: This function is **not thread-safe**. That is, it is an error if - /// it is called while another thread is executing any member function on - /// the same Session object. - /// - /// \param server_url For example "realm://sync.realm.io/test". See \a - /// server_address, \a server_path, and \a server_port for information about - /// the individual components of the URL. See \ref Protocol for the list of - /// available URL schemes and the associated default ports. The 2-argument - /// version has exactly the same affect as the 5-argument version. - /// - /// \param server_address The fully qualified host name, or IP address of - /// the server. - /// - /// \param server_path The virtual path by which the server identifies the - /// Realm. This path must always be an absolute path, and must therefore - /// always contain a leading slash (`/`). Further more, each segment of the - /// virtual path must consist of one or more characters that are either - /// alpha-numeric or in (`_`, `-`, `.`), and each segment is not allowed to - /// equal `.` or `..`, and must not end with `.realm`, `.realm.lock`, or - /// `.realm.management`. These rules are necessary because the server - /// currently reserves the right to use the specified path as part of the - /// file system path of a Realm file. It is expected that these rules will - /// be significantly relaxed in the future by completely decoupling the - /// virtual paths from actual file system paths. - /// - /// \param signed_user_token A cryptographically signed token describing the - /// identity and access rights of the current user. See \ref Protocol. - /// - /// \param server_port If zero, use the default port for the specified - /// protocol. See \ref Protocol for information on default ports. - /// - /// \param protocol See \ref Protocol. - /// - /// \throw BadServerUrl if the specified server URL is malformed. - void bind(std::string server_url, std::string signed_user_token); - void bind(std::string server_address, std::string server_path, - std::string signed_user_token, port_type server_port = 0, - Protocol protocol = Protocol::realm); - /// @} - - /// \brief Refresh the user token associated with this session. - /// - /// This causes the REFRESH protocol message to be sent to the server. See - /// \ref Protocol. - /// - /// In an on-going session a client may expect its access token to expire at - /// a certain time and schedule acquisition of a fresh access token (using a - /// refresh token or by other means) in due time to provide a better user - /// experience. Without refreshing the token, the client will be notified - /// that the session is terminated due to insufficient privileges and must - /// reacquire a fresh token, which is a potentially disruptive process. - /// - /// It is an error to call this function before calling `Client::bind()`. - /// - /// Note: This function is thread-safe. - /// - /// \param signed_user_token A cryptographically signed token describing the - /// identity and access rights of the current user. See \ref Protocol. - void refresh(std::string signed_user_token); - - /// \brief Inform the synchronization agent about changes of local origin. - /// - /// This function must be called by the application after a transaction - /// performed on its behlaf, that is, after a transaction that is not - /// performed to integrate a changeset that was downloaded from the server. - /// - /// It is an error to call this function before bind() has been called, and - /// has returned. - /// - /// Note: This function is fully thread-safe. That is, it may be called by - /// any thread, and by multiple threads concurrently. - void nonsync_transact_notify(version_type new_version); - - /// @{ \brief Wait for upload, download, or upload+download completion. - /// - /// async_wait_for_upload_completion() initiates an asynchronous wait for - /// upload to complete, async_wait_for_download_completion() initiates an - /// asynchronous wait for download to complete, and - /// async_wait_for_sync_completion() initiates an asynchronous wait for - /// upload and download to complete. - /// - /// Upload is considered complete when all non-empty changesets of local - /// origin have been uploaded to the server, and the server has acknowledged - /// reception of them. Changesets of local origin introduced after the - /// initiation of the session (after bind() is called) will generally not be - /// considered for upload unless they are announced to this client through - /// nonsync_transact_notify() prior to the initiation of the wait operation, - /// i.e., prior to the invocation of async_wait_for_upload_completion() or - /// async_wait_for_sync_completion(). Unannounced changesets may get picked - /// up, but there is no guarantee that they will be, however, if a certain - /// changeset is announced, then all previous changesets are implicitely - /// announced. Also all preexisting changesets are implicitely announced - /// when the session is initiated. - /// - /// Download is considered complete when all non-empty changesets of remote - /// origin have been downloaded from the server, and integrated into the - /// local Realm state. To know what is currently outstanding on the server, - /// the client always sends a special "marker" message to the server, and - /// waits until it has downloaded all outstanding changesets that were - /// present on the server at the time when the server received that marker - /// message. Each call to async_wait_for_download_completion() and - /// async_wait_for_sync_completion() therefore requires a full client <-> - /// server round-trip. - /// - /// If a new wait operation is initiated while other wait operations are in - /// progress, the waiting period of operations in progress may, or may not - /// get extended. The client must not assume either. The client may assume, - /// however, that async_wait_for_upload_completion() will not affect the - /// waiting period of async_wait_for_download_completion(), and vice versa. - /// - /// It is an error to call these functions before bind() has been called, - /// and has returned. - /// - /// The specified completion handlers will always be executed by the thread - /// that executes the event loop (the thread that calls Client::run()). If - /// the handler throws an exception, that exception will "travel" out - /// through Client::run(). - /// - /// If incomplete wait operations exist when the session is terminated, - /// those wait operations will be canceled. Session termination is an event - /// that happens in the context of the client's event loop thread shortly - /// after the destruction of the session object. The std::error_code - /// argument passed to the completion handler of a canceled wait operation - /// will be `util::error::operation_aborted`. For uncanceled wait operations - /// it will be `std::error_code{}`. Note that as long as the client's event - /// loop thread is running, all completion handlers will be called - /// regardless of whether the operations get canceled or not. - /// - /// CAUTION: The specified completion handlers may be called before the - /// initiation function returns (e.g. before - /// async_wait_for_upload_completion() returns), and it may be called (or - /// continue to execute) after the session object is destroyed. The - /// application must pass a handler that can be safely called, and can - /// safely continue to execute from the point in time where the initiating - /// function starts executing, and up until the point in time where the last - /// invocation of `clint.run()` returns. Here, `client` refers to the - /// associated Client object. - /// - /// Note: These functions are fully thread-safe. That is, they may be called - /// by any thread, and by multiple threads concurrently. - void async_wait_for_sync_completion(WaitOperCompletionHandler); - void async_wait_for_upload_completion(WaitOperCompletionHandler); - void async_wait_for_download_completion(WaitOperCompletionHandler); - /// @} - - /// @{ \brief Synchronous wait for upload or download completion. - /// - /// These functions are synchronous equivalents to - /// async_wait_for_upload_completion() and - /// async_wait_for_download_completion() respectively. This means that they - /// block the caller until the completion condition is satisfied, or the - /// client event loop is stopped (Client::stop()). - /// - /// It is an error to call these functions before bind() has been called, - /// and has returned. - /// - /// Note: These functions are fully thread-safe. That is, they may be called - /// by any thread, and by multiple threads concurrently. - void wait_for_upload_complete_or_client_stopped(); - void wait_for_download_complete_or_client_stopped(); - /// @} - - /// \brief Cancel the current or next reconnect delay for the server - /// associated with this session. - /// - /// When the network connection is severed, or an attempt to establish - /// connection fails, a certain delay will take effect before the client - /// will attempt to reestablish the connection. This delay will generally - /// grow with the number of unsuccessful reconnect attempts, and can grow to - /// over a minute. In some cases however, the application will know when it - /// is a good time to stop waiting and retry immediately. One example is - /// when a device has been offline for a while, and the operating system - /// then tells the application that network connectivity has been restored. - /// - /// Clearly, this function should not be called too often and over extended - /// periods of time, as that would effectively disable the built-in "server - /// hammering" protection. - /// - /// It is an error to call this function before bind() has been called, and - /// has returned. - /// - /// This function is fully thread-safe. That is, it may be called by any - /// thread, and by multiple threads concurrently. - void cancel_reconnect_delay(); - -private: - class Impl; - Impl* m_impl; - - void async_wait_for(bool upload_completion, bool download_completion, - WaitOperCompletionHandler); -}; - - -/// \brief Protocol errors discovered by the client. -/// -/// These errors will terminate the network connection (disconnect all sessions -/// associated with the affected connection), and the error will be reported to -/// the application via the error handlers of the affected sessions. -enum class Client::Error { - connection_closed = 100, ///< Connection closed (no error) - unknown_message = 101, ///< Unknown type of input message - bad_syntax = 102, ///< Bad syntax in input message head - limits_exceeded = 103, ///< Limits exceeded in input message - bad_session_ident = 104, ///< Bad session identifier in input message - bad_message_order = 105, ///< Bad input message order - bad_file_ident_pair = 106, ///< Bad file identifier pair (ALLOC) - bad_progress = 107, ///< Bad progress information (DOWNLOAD) - bad_changeset_header_syntax = 108, ///< Bad syntax in changeset header (DOWNLOAD) - bad_changeset_size = 109, ///< Bad changeset size in changeset header (DOWNLOAD) - bad_origin_file_ident = 110, ///< Bad origin file identifier in changeset header (DOWNLOAD) - bad_server_version = 111, ///< Bad server version in changeset header (DOWNLOAD) - bad_changeset = 112, ///< Bad changeset (DOWNLOAD) - bad_request_ident = 113, ///< Bad request identifier (MARK) - bad_error_code = 114, ///< Bad error code (ERROR), - bad_compression = 115, ///< Bad compression (DOWNLOAD) -}; - -const std::error_category& client_error_category() noexcept; - -std::error_code make_error_code(Client::Error) noexcept; - -} // namespace sync -} // namespace realm - -namespace std { - -template<> struct is_error_code_enum { - static const bool value = true; -}; - -} // namespace std - -namespace realm { -namespace sync { - - - -// Implementation - -class BadServerUrl: public std::exception { -public: - const char* what() const noexcept override - { - return "Bad server URL"; - } -}; - -inline void Session::async_wait_for_sync_completion(WaitOperCompletionHandler handler) -{ - bool upload_completion = true, download_completion = true; - async_wait_for(upload_completion, download_completion, std::move(handler)); // Throws -} - -inline void Session::async_wait_for_upload_completion(WaitOperCompletionHandler handler) -{ - bool upload_completion = true, download_completion = false; - async_wait_for(upload_completion, download_completion, std::move(handler)); // Throws -} - -inline void Session::async_wait_for_download_completion(WaitOperCompletionHandler handler) -{ - bool upload_completion = false, download_completion = true; - async_wait_for(upload_completion, download_completion, std::move(handler)); // Throws -} - -} // namespace sync -} // namespace realm - -#endif // REALM_SYNC_CLIENT_HPP diff --git a/Pods/Realm/include/core/realm/sync/crypto.hpp b/Pods/Realm/include/core/realm/sync/crypto.hpp deleted file mode 100644 index 016543e4..00000000 --- a/Pods/Realm/include/core/realm/sync/crypto.hpp +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2015] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ - -#ifndef REALM_SYNC_CRYPTO_HPP -#define REALM_SYNC_CRYPTO_HPP - -#include -#include - -#include -#include - -namespace realm { -namespace sync { -namespace crypto { - -/// sha1() calculates the sha1 hash value of \param in_buffer of size \param -/// in_buffer_size. The value is placed in \param out_buffer. The value has -/// size 20, and the caller must ensure that \param out_buffer has size at -/// least 20. -/// sha1() throws an exception if the underlying openssl implementation -/// fails, which should just happen in case of memory allocation failure. -void sha1(const char* in_buffer, size_t in_buffer_size, char* out_buffer); - -} // namespace crypto -} // namespace sync -} // namespace realm - -#endif // REALM_SYNC_CRYPTO_HPP diff --git a/Pods/Realm/include/core/realm/sync/crypto_server.hpp b/Pods/Realm/include/core/realm/sync/crypto_server.hpp deleted file mode 100644 index f2ac3f06..00000000 --- a/Pods/Realm/include/core/realm/sync/crypto_server.hpp +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2015] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ - -#ifndef REALM_SYNC_CRYPTO_SERVER_HPP -#define REALM_SYNC_CRYPTO_SERVER_HPP - -#include -#include - -#include -#include - -namespace realm { -namespace sync { - -struct CryptoError: std::runtime_error { - CryptoError(std::string message) : std::runtime_error(std::move(message)) {} -}; - -/// This class represents a public/private keypair, or more commonly a single public -/// key used for verifying signatures. -/// -/// Only RSA keys are supported for now. -/// -/// Its methods correspond roughly to the EVP_PKEY_* set of functionality found in -/// the OpenSSL library. -class PKey { -public: - PKey(PKey&&); - PKey& operator=(PKey&&); - ~PKey(); - - /// Load RSA public key from \a pemfile. - static PKey load_public(const std::string& pemfile); - /// Load RSA public/private keypair from \a pemfile. - static PKey load_private(const std::string& pemfile); - - /// Whether or not the key can be used for signing. - /// - /// True if the private part is loaded. - bool can_sign() const noexcept; - - /// Whether or not the key can be used for verifying. - /// - /// Always true for RSA keys. - bool can_verify() const noexcept; - - /// Sign \a message with the loaded key, if the private part is - /// loaded. Store the signed message as binary data in \a signature. - /// - /// If a private key is not loaded, throws an exception of type CryptoError. - void sign(BinaryData message, util::Buffer& signature) const; - - /// Verify that \a signature is a valid digest of \a message. - /// - /// Returns true if the signature is valid, otherwise false. If an error occurs while - /// attempting verification, an exception of type CryptoError is thrown. - bool verify(BinaryData message, BinaryData signature) const; - -private: - PKey(); - struct Impl; - std::unique_ptr m_impl; -}; - -} // namespace sync -} // namespace realm - -#endif // REALM_SYNC_CRYPTO_SERVER_HPP diff --git a/Pods/Realm/include/core/realm/sync/history.hpp b/Pods/Realm/include/core/realm/sync/history.hpp deleted file mode 100644 index 7ca83a1e..00000000 --- a/Pods/Realm/include/core/realm/sync/history.hpp +++ /dev/null @@ -1,234 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2015] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ - -#include -#include - -#include -#include - -#ifndef REALM_SYNC_HISTORY_HPP -#define REALM_SYNC_HISTORY_HPP - -namespace realm { -namespace sync { - -/// SyncProgress is the progress sent by the server in the download message. The -/// server scans through its history in connection with every download message. -/// scan_server_version is the server_version of the changeset at which the -/// server ended the scan. scan_client_version is the client_version for this -/// client that was last integrated before scan_server_version. -/// latest_server_version is the end of the server history, and -/// latest_server_session_ident is the server_session_ident corresponding to -/// latest_sever_version. latest_client_version is the corresponding -/// client_version. In other words, latest_client_version is the very latest -/// version of a changeset originating from this client. -/// -/// The client persists the entire progress. It is not very important to persist -/// latest_server_version, but for consistency the entire progress is persisted. -struct SyncProgress { - using version_type = HistoryEntry::version_type; - - version_type scan_server_version = 0; - version_type scan_client_version = 0; - version_type latest_server_version = 0; - int_fast64_t latest_server_session_ident = 0; - version_type latest_client_version = 0; - int_fast64_t downloadable_bytes = 0; -}; - - -class SyncHistory: - public TrivialReplication { -public: - using version_type = TrivialReplication::version_type; - using file_ident_type = HistoryEntry::file_ident_type; - using SyncTransactCallback = void(VersionID old_version, VersionID new_version); - - SyncHistory(const std::string& realm_path); - - /// Get the version of the latest snapshot of the associated Realm, as well - /// as the file identifier pair and the synchronization progress pair as - /// they are stored in that snapshot. - /// - /// The returned current client version is the version of the latest - /// snapshot of the associated SharedGroup object, and is guaranteed to be - /// zero for the initial empty Realm state. - /// - /// The returned file identifier pair (server, client) is the one that was - /// last stored by set_file_ident_pair(). If no identifier pair has been - /// stored yet, \a client_file_ident is set to zero. - /// - /// The returned SyncProgress is the one that was last stored by - /// set_sync_progress(), or {} if set_sync_progress() has never been called - /// for the associated Realm file. - virtual void get_status(version_type& current_client_version, - file_ident_type& server_file_ident, - file_ident_type& client_file_ident, - int_fast64_t& client_file_ident_secret, - SyncProgress& progress) = 0; - - /// Stores the server assigned file identifier pair (server, client) in the - /// associated Realm file, such that it is available via get_status() during - /// future synchronization sessions. It is an error to set this identifier - /// pair more than once per Realm file. - /// - /// \param server_file_ident The server assigned server-side file - /// identifier. This can be any non-zero integer strictly less than 2**64. - /// The server is supposed to choose a cryptic value that cannot easily be - /// guessed by clients (intentionally or not), and its only purpose is to - /// provide a higher level of fidelity during subsequent identification of - /// the server Realm. The server does not have to guarantee that this - /// identifier is unique, but in almost all cases it will be. Since the - /// client will also always specify the path name when referring to a server - /// file, the lack of a uniqueness guarantee is effectively not a problem. - /// - /// \param client_file_ident The server assigned client-side file - /// identifier. A client-side file identifier is a non-zero positive integer - /// strictly less than 2**64. The server guarantees that all client-side - /// file identifiers generated on behalf of a particular server Realm are - /// unique with respect to each other. The server is free to generate - /// identical identifiers for two client files if they are associated with - /// different server Realms. - /// - /// The client is required to obtain the file identifiers before engaging in - /// synchronization proper, and it must store the identifiers and use them - /// to reestablish the connection between the client file and the server - /// file when engaging in future synchronization sessions. - virtual void set_file_ident_pair(file_ident_type server_file_ident, - file_ident_type client_file_ident, - int_fast64_t client_file_ident_secret) = 0; - - /// Stores the SyncProgress progress in the associated Realm file in a way - /// that makes it available via get_status() during future synchronization - /// sessions. Progress is reported by the server in the DOWNLOAD message. - /// - /// See struct SyncProgress for a description of \param progress. - /// - /// `progress.scan_client_version` has an effect on the process by which old - /// history entries are discarded. - /// - /// `progress.scan_client_version` The version produced on this client by - /// the last changeset, that was sent to, and integrated by the server at - /// the time `progress.scan_server_version was produced, or zero if - /// `progress.scan_server_version` is zero. - /// - /// Since all changesets produced after `progress.scan_client_version` are - /// potentially needed during operational transformation of the next - /// changeset received from the server, the implementation of this class - /// must promise to retain all history entries produced after - /// `progress.scan_client_version`. That is, a history entry with a - /// changeset, that produces version V, is guaranteed to be retained as long - /// as V is strictly greater than `progress.scan_client_version`. - /// - /// It is an error to specify a client version that is less than the - /// currently stored version, since there is no way to get discarded history - /// back. - virtual void set_sync_progress(SyncProgress progress) = 0; - - /// Get the first history entry whose changeset produced a version that - /// succeeds `begin_version` and, and does not succeed `end_version`, whose - /// changeset was not produced by integration of a changeset received from - /// the server, and whose changeset was not empty. - /// - /// \param begin_version, end_version The range of versions to consider. If - /// `begin_version` is equal to `end_version`, this is the empty range. If - /// `begin_version` is zero, it means that everything preceding - /// `end_version` is to be considered, which is again the empty range if - /// `end_version` is also zero. Zero is a special value in that no changeset - /// produces that version. It is an error if `end_version` precedes - /// `begin_version`, or if `end_version` is zero and `begin_version` is not. - /// - /// \param buffer Owner of memory referenced by entry.changeset upon return. - /// - /// \return The version produced by the changeset of the located history - /// entry, or zero if no history entry exists matching the specified - /// criteria. - virtual version_type find_history_entry_for_upload(version_type begin_version, - version_type end_version, - HistoryEntry& entry, - std::unique_ptr& buffer) const = 0; - - using RemoteChangeset = Transformer::RemoteChangeset; - - /// \brief Integrate a sequence of remote changesets using a single Realm - /// transaction. - /// - /// Each changeset will be transformed as if by a call to - /// Transformer::transform_remote_changeset(), and then applied to the - /// associated Realm. - /// - /// As a final step, each changeset will be added to the local history (list - /// of applied changesets). - /// - /// \param progress is the SyncProgress received in the download message. - /// Progress will be persisted along with the changesets. - /// - /// \param num_changesets The number of passed changesets. Must be non-zero. - /// - /// \param callback An optional callback which will be called with the - /// version immediately processing the sync transaction and that of the sync - /// transaction. - /// - /// \return The new local version produced by the application of the - /// transformed changeset. - virtual version_type integrate_remote_changesets(SyncProgress progress, - const RemoteChangeset* changesets, - size_t num_changesets, - util::Logger* replay_logger, - std::function& callback) = 0; - - /// Get the persisted upload/download progress in bytes. - virtual void get_upload_download_bytes(uint_fast64_t& downloaded_bytes, - uint_fast64_t& downloadable_bytes, - uint_fast64_t& uploaded_bytes, - uint_fast64_t& uploadable_bytes) = 0; -}; - - -/// \brief Create a "sync history" implementation of the realm::Replication -/// interface. -/// -/// The main function of such an object is as a plugin for new -/// realm::SharedGroup objects. -/// -/// \param owner_is_sync_agent Must be set to true if, and only if the created -/// history object represents (is owned by) the sync agent of the specified -/// Realm file. At most one such instance is allowed to participate in a Realm -/// file access session at any point in time. Ordinarily the sync agent is -/// encapsulated by the sync::Client class, and the history instance -/// representing the agent is created transparently by sync::Client (one history -/// instance per sync::Session object). -std::unique_ptr make_sync_history(const std::string& realm_path, - bool owner_is_sync_agent = false); - - - -// Implementation - -inline SyncHistory::SyncHistory(const std::string& realm_path): - TrivialReplication(realm_path) -{ -} - -} // namespace sync -} // namespace realm - -#endif // REALM_SYNC_SYNC_HPP diff --git a/Pods/Realm/include/core/realm/sync/metrics.hpp b/Pods/Realm/include/core/realm/sync/metrics.hpp deleted file mode 100644 index d4c5cfc3..00000000 --- a/Pods/Realm/include/core/realm/sync/metrics.hpp +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2012] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ -#ifndef REALM_SYNC_METRICS_HPP -#define REALM_SYNC_METRICS_HPP - -#if REALM_HAVE_DOGLESS -# include -#endif - -namespace realm { -namespace sync { - -// FIXME: Consider adding support for specification of sample rate. The Dogless -// API already supports this. -class Metrics { -public: - /// Increment the counter identified by the specified key. - virtual void increment(const char* key) = 0; - - /// Set value of the guage identified by the specified key. - virtual void gauge(const char* key, double value) = 0; - - /// Add the specified value to the guage identified by the specified - /// key. The value is allowed to be negative. - virtual void gauge_relative(const char* key, double value) = 0; - - /// Allow the dogless library to send each metric to multiple endpoints, as - /// required - virtual void add_endpoint(const std::string& endpoint) = 0; - - virtual ~Metrics() {} -}; - -#if REALM_HAVE_DOGLESS - -class DoglessMetrics: public sync::Metrics { -public: - DoglessMetrics(): - m_dogless(dogless::hostname_prefix("realm")) // Throws - { - m_dogless.loop_interval(1); - } - - void increment(const char* key) override - { - const char* metric = key; - m_dogless.increment(metric); // Throws - } - - void gauge(const char* key, double value) override - { - const char* metric = key; - m_dogless.gauge(metric, value); // Throws - } - - void gauge_relative(const char* key, double value) override - { - const char* metric = key; - double amount = value; - m_dogless.gauge_relative(metric, amount); // Throws - } - - void add_endpoint(const std::string& endpoint) override - { - m_dogless.add_endpoint(endpoint); - } - -private: - dogless::BufferedStatsd m_dogless; -}; - -#endif - -} // namespace sync -} // namespace realm - -#endif // REALM_SYNC_METRICS_HPP diff --git a/Pods/Realm/include/core/realm/sync/protocol.hpp b/Pods/Realm/include/core/realm/sync/protocol.hpp deleted file mode 100644 index 6597129b..00000000 --- a/Pods/Realm/include/core/realm/sync/protocol.hpp +++ /dev/null @@ -1,711 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2016] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ -#ifndef REALM_SYNC_PROTOCOL_HPP -#define REALM_SYNC_PROTOCOL_HPP - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include // Get rid of this? - - -// NOTE: The protocol specification is in `/doc/protocol.md` - - -namespace realm { -namespace sync { - -// Protocol versions: -// -// 1 Initial version. -// -// 2 Introduces the UNBOUND message (sent from server to client in -// response to a BIND message). -// -// 3 Introduces the ERROR message (sent from server to client before the -// server closes a connection). Introduces MARK message from client to -// server, and MARK response message from server to client as a way for the -// client to wait for download to complete. -// -// 4 User token and signature are now passed as a single string (see -// /doc/protocol.md for details). Also, `application_ident` parameter -// removed from IDENT message. -// -// 5 IDENT message renamed to CLIENT, and ALLOC message (client->server) -// renamed to IDENT. Also, parameter added to CLIENT -// message. Also, the protocol has been changed to make the clients -// acquisition of a server allocated file identifier pair be part of a -// session from the servers point of view. File identifier and version -// parameters moved from the BIND message to a new IDENT message sent by -// client when it has obtained the file identifier pair. Both the new IDENT -// message and the ALLOC message sent by the server are now properly -// associated with a session. -// -// 6 Server session IDs have been added to the IDENT, DOWNLOAD, and PROGRESS -// messages, and the "Divergent history" error code was added as an -// indication that a server version / session ID pair does not match the -// server's history. -// -// 7 FIXME: Who introduced version 7? Please describe what changed. -// -// 8 Error code (`bad_authentication`) moved from 200-range to 300-range -// because it is now session specific. Other error codes were renumbered. -// -// 9 New format of the DOWNLOAD message to support progress reporting on the -// client -// 10 Error codes reordered (now categorized as either connection or session -// level errors). -// 11 Bugfixes in Link List and ChangeLinkTargets merge rules, that -// make previous versions incompatible. -// 12 FIXME What was 12? -// 13 Bugfixes in Link List and ChangeLinkTargets merge rules, that -// make previous versions incompatible. -// 14 Further bugfixes related to primary keys and link lists. Add support for -// LinkListSwap. -// 15 Deleting an object with a primary key deletes all objects on other -// with the same primary key. -// 16 Downloadable bytes added to DOWNLOAD message. It is used for download progress -// by the client -constexpr int get_current_protocol_version() noexcept -{ - return 16; -} - -/// \brief Protocol errors discovered by the server, and reported to the client -/// by way of ERROR messages. -/// -/// These errors will be reported to the client-side application via the error -/// handlers of the affected sessions. -/// -/// ATTENTION: Please remember to update is_session_level_error() when -/// adding/removing error codes. -enum class ProtocolError { - // Connection level and protocol errors - connection_closed = 100, // Connection closed (no error) - other_error = 101, // Other connection level error - unknown_message = 102, // Unknown type of input message - bad_syntax = 103, // Bad syntax in input message head - limits_exceeded = 104, // Limits exceeded in input message - wrong_protocol_version = 105, // Wrong protocol version (CLIENT) - bad_session_ident = 106, // Bad session identifier in input message - reuse_of_session_ident = 107, // Overlapping reuse of session identifier (BIND) - bound_in_other_session = 108, // Client file bound in other session (IDENT) - bad_message_order = 109, // Bad input message order - - // Session level errors - session_closed = 200, // Session closed (no error) - other_session_error = 201, // Other session level error - token_expired = 202, // Access token expired - bad_authentication = 203, // Bad user authentication (BIND, REFRESH) - illegal_realm_path = 204, // Illegal Realm path (BIND) - no_such_realm = 205, // No such Realm (BIND) - permission_denied = 206, // Permission denied (BIND, REFRESH) - bad_server_file_ident = 207, // Bad server file identifier (IDENT) - bad_client_file_ident = 208, // Bad client file identifier (IDENT) - bad_server_version = 209, // Bad server version (IDENT, UPLOAD) - bad_client_version = 210, // Bad client version (IDENT, UPLOAD) - diverging_histories = 211, // Diverging histories (IDENT) - bad_changeset = 212, // Bad changeset (UPLOAD) - disabled_session = 213, // Disabled session -}; - -inline constexpr bool is_session_level_error(ProtocolError error) -{ - return int(error) >= 200 && int(error) <= 299; -} - -/// Returns null if the specified protocol error code is not defined by -/// ProtocolError. -const char* get_protocol_error_message(int error_code) noexcept; - -const std::error_category& protocol_error_category() noexcept; - -std::error_code make_error_code(ProtocolError) noexcept; - -} // namespace sync -} // namespace realm - -namespace std { - -template<> struct is_error_code_enum { - static const bool value = true; -}; - -} // namespace std - -namespace realm { -namespace sync { -namespace protocol { - -using OutputBuffer = util::ResettableExpandableBufferOutputStream; -using session_ident_type = uint_fast16_t; -using file_ident_type = uint_fast64_t; -using version_type = uint_fast64_t; -using timestamp_type = uint_fast64_t; -using request_ident_type = uint_fast64_t; - - - - -class ClientProtocol { -public: - util::Logger& logger; - - enum class Error { - unknown_message = 101, // Unknown type of input message - bad_syntax = 102, // Bad syntax in input message head - limits_exceeded = 103, // Limits exceeded in input message - bad_changeset_header_syntax = 108, // Bad syntax in changeset header (DOWNLOAD) - bad_changeset_size = 109, // Bad changeset size in changeset header (DOWNLOAD) - bad_server_version = 111, // Bad server version in changeset header (DOWNLOAD) - bad_error_code = 114, ///< Bad error code (ERROR) - bad_decompression = 115, // Error in decompression (DOWNLOAD) - }; - - ClientProtocol(util::Logger& logger); - - - /// Messages sent by the client. - - void make_client_message(OutputBuffer& out, const std::string& client_info); - - void make_bind_message(OutputBuffer& out, session_ident_type session_ident, - const std::string& server_path, - const std::string& signed_user_token, - bool need_file_ident_pair); - - void make_refresh_message(OutputBuffer& out, session_ident_type session_ident, - const std::string& signed_user_token); - - void make_ident_message(OutputBuffer& out, session_ident_type session_ident, - file_ident_type server_file_ident, - file_ident_type client_file_ident, - int_fast64_t client_file_ident_secret, - SyncProgress progress); - - void make_upload_message(OutputBuffer& out, session_ident_type session_ident, - version_type client_version, version_type server_version, - size_t changeset_size, timestamp_type timestamp, - const std::unique_ptr& body_buffer); - - void make_unbind_message(OutputBuffer& out, session_ident_type session_ident); - - void make_mark_message(OutputBuffer& out, session_ident_type session_ident, - request_ident_type request_ident); - - - - // Messages received by the client. - - // parse_message_received takes a (WebSocket) message and parses it. - // The result of the parsing is handled by an object of type Connection. - // Typically, Connection would be the Connection class from client.cpp - template - void parse_message_received(Connection& connection, const char* data, size_t size) - { - util::MemoryInputStream in; - in.set_buffer(data, data + size); - in.unsetf(std::ios_base::skipws); - size_t header_size = 0; - std::string message_type; - in >> message_type; - logger.debug("message_type = %1", message_type); - - if (message_type == "download") { - session_ident_type session_ident; - SyncProgress progress; - int is_body_compressed; - size_t uncompressed_body_size, compressed_body_size; - char sp_1, sp_2, sp_3, sp_4, sp_5, sp_6, sp_7, sp_8, sp_9, sp_10, newline; - - in >> sp_1 >> session_ident >> sp_2 >> progress.scan_server_version >> sp_3 >> - progress.scan_client_version >> sp_4 >> progress.latest_server_version >> - sp_5 >> progress.latest_server_session_ident >> sp_6 >> - progress.latest_client_version >> sp_7 >> progress.downloadable_bytes >> - sp_8 >> is_body_compressed >> sp_9 >> uncompressed_body_size >> sp_10 >> - compressed_body_size >> newline; // Throws - - bool good_syntax = in && sp_1 == ' ' && sp_2 == ' ' && - sp_3 == ' ' && sp_4 == ' ' && sp_5 == ' ' && sp_6 == ' ' && - sp_7 == ' ' && sp_8 == ' ' && sp_9 == ' ' && sp_10 == ' ' && - newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size_t(in.tellg()); - if (uncompressed_body_size > s_max_body_size) - goto limits_exceeded; - - size_t body_size = is_body_compressed ? compressed_body_size : uncompressed_body_size; - if (header_size + body_size != size) - goto bad_syntax; - - BinaryData body(data + header_size, body_size); - BinaryData uncompressed_body; - - std::unique_ptr uncompressed_body_buffer; - // if is_body_compressed == true, we must decompress the received body. - if (is_body_compressed) { - uncompressed_body_buffer.reset(new char[uncompressed_body_size]); - std::error_code ec = util::compression::decompress(body.data(), compressed_body_size, - uncompressed_body_buffer.get(), - uncompressed_body_size); - - if (ec) { - logger.error("compression::inflate: %1", ec.message()); - connection.handle_protocol_error(Error::bad_decompression); - return; - } - - uncompressed_body = BinaryData(uncompressed_body_buffer.get(), uncompressed_body_size); - } - else { - uncompressed_body = body; - } - - logger.debug("Download message compression: is_body_compressed = %1, " - "compressed_body_size=%2, uncompressed_body_size=%3", - is_body_compressed, compressed_body_size, uncompressed_body_size); - - util::MemoryInputStream in; - in.unsetf(std::ios_base::skipws); - in.set_buffer(uncompressed_body.data(), uncompressed_body.data() + uncompressed_body_size); - - std::vector received_changesets; - - // Loop through the body and find the changesets. - size_t position = 0; - while (position < uncompressed_body_size) { - version_type server_version; - version_type client_version; - timestamp_type origin_timestamp; - file_ident_type origin_client_file_ident; - size_t changeset_size; - char sp_1, sp_2, sp_3, sp_4, sp_5; - - in >> server_version >> sp_1 >> client_version >> sp_2 >> origin_timestamp >> - sp_3 >> origin_client_file_ident >> sp_4 >> changeset_size >> sp_5; - - bool good_syntax = in && sp_1 == ' ' && sp_2 == ' ' && - sp_3 == ' ' && sp_4 == ' ' && sp_5 == ' '; - - if (!good_syntax) { - logger.error("Bad changeset header syntax"); - connection.handle_protocol_error(Error::bad_changeset_header_syntax); - return; - } - - // Update position to the end of the change set - position = size_t(in.tellg()) + changeset_size; - - if (position > uncompressed_body_size) { - logger.error("Bad changeset size"); - connection.handle_protocol_error(Error::bad_changeset_size); - return; - } - - if (server_version == 0) { - // The received changeset can never have version 0. - logger.error("Bad server version"); - connection.handle_protocol_error(Error::bad_server_version); - return; - } - - BinaryData changeset_data(uncompressed_body.data() + size_t(in.tellg()), changeset_size); - in.seekg(position); - - if (logger.would_log(util::Logger::Level::trace)) { - logger.trace("Received: DOWNLOAD CHANGESET(server_version=%1, client_version=%2, " - "origin_timestamp=%3, origin_client_file_ident=%4, changeset_size=%5)", - server_version, client_version, origin_timestamp, - origin_client_file_ident, changeset_size); // Throws - logger.trace("Changeset: %1", util::hex_dump(changeset_data.data(), changeset_size)); // Throws - } - - Transformer::RemoteChangeset changeset_2(server_version, client_version, - changeset_data, origin_timestamp, - origin_client_file_ident); - received_changesets.push_back(changeset_2); // Throws - } - - connection.receive_download_message(session_ident, progress, received_changesets); // Throws - return; - } - if (message_type == "unbound") { - session_ident_type session_ident; - char sp_1, newline; - in >> sp_1 >> session_ident >> newline; // Throws - bool good_syntax = in && size_t(in.tellg()) == size && sp_1 == ' ' && - newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size_t(in.tellg()); - - connection.receive_unbound_message(session_ident); // Throws - return; - } - if (message_type == "error") { - int error_code; - size_t message_size; - bool try_again; - session_ident_type session_ident; - char sp_1, sp_2, sp_3, sp_4, newline; - in >> sp_1 >> error_code >> sp_2 >> message_size >> sp_3 >> try_again >> sp_4 >> - session_ident >> newline; // Throws - bool good_syntax = in && sp_1 == ' ' && sp_2 == ' ' && sp_3 == ' ' && - sp_4 == ' ' && newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size_t(in.tellg()); - if (header_size + message_size != size) - goto bad_syntax; - - bool unknown_error = !get_protocol_error_message(error_code); - if (unknown_error) { - logger.error("Bad error code"); // Throws - connection.handle_protocol_error(Error::bad_error_code); - return; - } - - std::string message{data + header_size, message_size}; // Throws (copy) - - connection.receive_error_message(error_code, message_size, try_again, session_ident, message); // Throws - return; - } - if (message_type == "mark") { - session_ident_type session_ident; - request_ident_type request_ident; - char sp_1, sp_2, newline; - in >> sp_1 >> session_ident >> sp_2 >> request_ident >> newline; // Throws - bool good_syntax = in && size_t(in.tellg()) == size && sp_1 == ' ' && - sp_2 == ' ' && newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size_t(in.tellg()); - - connection.receive_mark_message(session_ident, request_ident); // Throws - return; - } - if (message_type == "alloc") { - session_ident_type session_ident; - file_ident_type server_file_ident, client_file_ident; - int_fast64_t client_file_ident_secret; - char sp_1, sp_2, sp_3, sp_4, newline; - in >> sp_1 >> session_ident >> sp_2 >> server_file_ident >> sp_3 >> - client_file_ident >> sp_4 >> client_file_ident_secret >> newline; // Throws - bool good_syntax = in && size_t(in.tellg()) == size && sp_1 == ' ' && - sp_2 == ' ' && sp_3 == ' ' && sp_4 == ' ' && newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size_t(in.tellg()); - - connection.receive_alloc_message(session_ident,server_file_ident, client_file_ident, - client_file_ident_secret); // Throws - return; - } - - logger.error("Unknown input message type '%1'", - StringData(data, size)); - connection.handle_protocol_error(Error::unknown_message); - return; - bad_syntax: - logger.error("Bad syntax in input message '%1'", - StringData(data, size)); - connection.handle_protocol_error(Error::bad_syntax); - return; - limits_exceeded: - logger.error("Limits exceeded in input message '%1'", - StringData(data, header_size)); - connection.handle_protocol_error(Error::limits_exceeded); - return; - } - -private: - static constexpr size_t s_max_body_size = std::numeric_limits::max(); -}; - - -class ServerProtocol { -public: - util::Logger& logger; - - enum class Error { - unknown_message = 101, // Unknown type of input message - bad_syntax = 102, // Bad syntax in input message head - limits_exceeded = 103, // Limits exceeded in input message - }; - - ServerProtocol(util::Logger& logger); - - // Messages sent by the server to the client - - void make_alloc_message(OutputBuffer& out, session_ident_type session_ident, - file_ident_type server_file_ident, file_ident_type client_file_ident, - int_fast64_t client_file_ident_secret); - - void make_unbound_message(OutputBuffer& out, session_ident_type session_ident); - - - class ChangesetInfo { - public: - version_type server_version; - version_type client_version; - HistoryEntry entry; - - ChangesetInfo(version_type server_version, version_type client_version, HistoryEntry entry): - server_version(server_version), - client_version(client_version), - entry(entry) - {} - }; - - void make_download_message(int protocol_version, OutputBuffer& out, session_ident_type session_ident, - version_type scan_server_version, - version_type scan_client_version, - version_type latest_server_version, - int_fast64_t latest_server_session_ident, - version_type latest_client_version, - uint_fast64_t downloadable_bytes, - const std::vector& changeset_infos); - - void make_error_message(OutputBuffer& out, ProtocolError error_code, - const char* message, size_t message_size, - bool try_again, session_ident_type session_ident); - - void make_mark_message(OutputBuffer& out, session_ident_type session_ident, - request_ident_type request_ident); - - // Messages received by the server. - - // parse_message_received takes a (WebSocket) message and parses it. - // The result of the parsing is handled by an object of type Connection. - // Typically, Connection would be the Connection class from server.cpp - template - void parse_message_received(Connection& connection, const char* data, size_t size) - { - util::MemoryInputStream in; - in.set_buffer(data, data + size); - in.unsetf(std::ios_base::skipws); - size_t header_size = 0; - std::string message_type; - in >> message_type; - - if (message_type == "upload") { - session_ident_type session_ident; - version_type client_version, server_version; - size_t changeset_size; - timestamp_type timestamp; - char sp_1, sp_2, sp_3, sp_4, sp_5, newline; - in >> sp_1 >> session_ident >> sp_2 >> client_version >> sp_3 >> - server_version >> sp_4 >> changeset_size >> sp_5 >> timestamp >> - newline; - bool good_syntax = in && sp_1 == ' ' && sp_2 == ' ' && sp_3 == ' ' && - sp_4 == ' ' && sp_5 == ' ' && newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size_t(in.tellg()); - if (changeset_size > s_max_changeset_size) - goto limits_exceeded; - if (header_size + changeset_size != size) - goto bad_syntax; - - BinaryData changeset(data + header_size, changeset_size); - - connection.receive_upload_message(session_ident, client_version, - server_version, changeset, - timestamp); // Throws - return; - } - if (message_type == "mark") { - session_ident_type session_ident; - request_ident_type request_ident; - char sp_1, sp_2, newline; - in >> sp_1 >> session_ident >> sp_2 >> request_ident >> newline; - bool good_syntax = in && size_t(in.tellg()) == size && - sp_1 == ' ' && sp_2 == ' ' && newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size; - - connection.receive_mark_message(session_ident, request_ident); // Throws - return; - } - if (message_type == "bind") { - session_ident_type session_ident; - size_t path_size; - size_t signed_user_token_size; - bool need_file_ident_pair; - char sp_1, sp_2, sp_3, sp_4, newline; - in >> sp_1 >> session_ident >> sp_2 >> path_size >> sp_3 >> - signed_user_token_size >> sp_4 >> need_file_ident_pair >> - newline; - bool good_syntax = in && sp_1 == ' ' && sp_2 == ' ' && - sp_3 == ' ' && sp_4 == ' ' && newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size_t(in.tellg()); - if (path_size == 0) - goto bad_syntax; - if (path_size > s_max_path_size) - goto limits_exceeded; - if (signed_user_token_size > s_max_signed_user_token_size) - goto limits_exceeded; - if (header_size + path_size + signed_user_token_size != size) - goto bad_syntax; - - std::string path {data + header_size, path_size}; // Throws - std::string signed_user_token {data + header_size + path_size, - signed_user_token_size}; // Throws - - connection.receive_bind_message(session_ident, std::move(path), - std::move(signed_user_token), - need_file_ident_pair); // Throws - return; - } - if (message_type == "refresh") { - session_ident_type session_ident; - size_t signed_user_token_size; - char sp_1, sp_2, newline; - in >> sp_1 >> session_ident >> sp_2 >> signed_user_token_size >> - newline; - bool good_syntax = in && sp_1 == ' ' && sp_2 == ' ' && newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size_t(in.tellg()); - if (signed_user_token_size > s_max_signed_user_token_size) - goto limits_exceeded; - if (header_size + signed_user_token_size != size) - goto bad_syntax; - - std::string signed_user_token {data + header_size, signed_user_token_size}; - - connection.receive_refresh_message(session_ident, std::move(signed_user_token)); // Throws - return; - } - if (message_type == "ident") { - session_ident_type session_ident; - file_ident_type server_file_ident, client_file_ident; - int_fast64_t client_file_ident_secret; - version_type scan_server_version, scan_client_version, latest_server_version; - int_fast64_t latest_server_session_ident; - char sp_1, sp_2, sp_3, sp_4, sp_5, sp_6, sp_7, sp_8, newline; - in >> sp_1 >> session_ident >> sp_2 >> server_file_ident >> sp_3 >> - client_file_ident >> sp_4 >> client_file_ident_secret >> sp_5 >> - scan_server_version >> sp_6 >> scan_client_version >> sp_7 >> - latest_server_version >> sp_8 >> latest_server_session_ident >> - newline; - bool good_syntax = in && size_t(in.tellg()) == size && sp_1 == ' ' && - sp_2 == ' ' && sp_3 == ' ' && sp_4 == ' ' && sp_5 == ' ' && - sp_6 == ' ' && sp_7 == ' ' && sp_8 == ' ' && newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size; - - connection.receive_ident_message(session_ident, server_file_ident, client_file_ident, - client_file_ident_secret, scan_server_version, scan_client_version, - latest_server_version, latest_server_session_ident); // Throws - return; - } - if (message_type == "unbind") { - session_ident_type session_ident; - char sp_1, newline; - in >> sp_1 >> session_ident >> newline; - bool good_syntax = in && size_t(in.tellg()) == size && - sp_1 == ' ' && newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size; - - connection.receive_unbind_message(session_ident); // Throws - return; - } - if (message_type == "client") { - int_fast64_t protocol_version; - char sp_1, sp_2, newline; - size_t client_info_size; - in >> sp_1 >> protocol_version >> sp_2 >> client_info_size >> newline; - bool good_syntax = in && sp_1 == ' ' && sp_2 == ' ' && newline == '\n'; - if (!good_syntax) - goto bad_syntax; - header_size = size_t(in.tellg()); - bool limits_exceeded = (client_info_size > s_max_client_info_size); - if (limits_exceeded) - goto limits_exceeded; - if (header_size + client_info_size != size) - goto bad_syntax; - - std::string client_info {data + header_size, client_info_size}; // Throws - - connection.receive_client_message(protocol_version, std::move(client_info)); // Throws - return; - } - - // unknown message - if (size < 256) - logger.error("Unknown input message type '%1'", StringData(data, size)); // Throws - else - logger.error("Unknown input message type '%1'.......", StringData(data, 256)); // Throws - - connection.handle_protocol_error(Error::unknown_message); - return; - - bad_syntax: - logger.error("Bad syntax in input message '%1'", - StringData(data, size)); - connection.handle_protocol_error(Error::bad_syntax); // Throws - return; - limits_exceeded: - logger.error("Limits exceeded in input message '%1'", - StringData(data, header_size)); - connection.handle_protocol_error(Error::limits_exceeded); // Throws - return; - } - -private: - static constexpr size_t s_max_head_size = 256; - static constexpr size_t s_max_signed_user_token_size = 2048; - static constexpr size_t s_max_client_info_size = 1024; - static constexpr size_t s_max_path_size = 1024; - static constexpr size_t s_max_changeset_size = std::numeric_limits::max(); - - util::compression::CompressMemoryArena m_compress_memory_arena; - - // Permanent buffer to use for internal purposes such as compression. - std::vector m_buffer; - - // Outputbuffer to use for internal purposes such as creating the - // download body. - OutputBuffer m_output_buffer; - - void insert_single_changeset_download_message(OutputBuffer& out, const ChangesetInfo& changeset_info); -}; - -} // namespace protocol -} // namespace sync -} // namespace realm - -#endif // REALM_SYNC_PROTOCOL_HPP diff --git a/Pods/Realm/include/core/realm/sync/server.hpp b/Pods/Realm/include/core/realm/sync/server.hpp deleted file mode 100644 index 1f52e7ae..00000000 --- a/Pods/Realm/include/core/realm/sync/server.hpp +++ /dev/null @@ -1,181 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2012] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ -#ifndef REALM_SYNC_SERVER_HPP -#define REALM_SYNC_SERVER_HPP - -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace realm { -namespace sync { - -class Server { -public: - class Clock; - - struct Config { - Config() {} - - /// The maximum number of Realm files that will be kept open - /// concurrently by this server. The server keeps a cache of open Realm - /// files for efficiency reasons. - long max_open_files = 256; - - /// An optional time provider to be used by the server. - /// If no time provider is specified, the server will use the - /// system clock. - Clock* clock = nullptr; - - /// An optional logger to be used by the server. If no logger is - /// specified, the server will use an instance of util::StderrLogger - /// with the log level threshold set to util::Logger::Level::info. The - /// server does not require a thread-safe logger, and it guarantees that - /// all logging happens on behalf of start() and run() (which are not - /// allowed to execute concurrently). - util::Logger* logger = nullptr; - - /// An optional sink for recording metrics about the internal operation - /// of the server. Below is a list of counters and gauges that are - /// updated by the server. The server may or may not update additional - /// counters and gauges. - /// - /// Statistics counters Incremented when - /// ------------------------------------------------------------------------ - /// server.started The server was started - /// connection.started A new client connection was established - /// connection.terminated A client connection was terminated - /// session.started A new session was started - /// session.terminated A session was terminated - /// connection.read.failed A connection was closed due to read error - /// connection.write.failed A connection was closed due to write error - /// protocol.upload.received An UPLOAD message was received - /// protocol.download.sent A DOWNLOAD message was sent - /// protocol.connection.errored Connection level protocol error occurred - /// protocol.session.errored Session level protocol error occurred - /// - /// Statistics gauges Continuously updated to reflect - /// -------------------------------------------------------------------------- - /// connection.opened The current total number of connections - /// session.opened The current total number of sessions - /// - Metrics* metrics = nullptr; - - /// FIXME: This seems to be related to the dashboard feature, but it - /// would be nice with some additional explanation (Sebastian). - const char* stats_db = nullptr; - - /// The address at which the listening socket is bound. - /// The address can be a name or on numerical form. - /// Use "localhost" to listen on the loopback interface. - std::string listen_address; - - /// The port at which the listening socket is bound. - /// The port can be a name or on numerical form. - /// Use the empty string to have the system assign a dynamic - /// listening port. - std::string listen_port; - - bool reuse_address = true; - - /// The listening socket accepts TLS/SSL connections if `ssl` is - /// true, and non-secure tcp connections otherwise. - bool ssl = false; - - /// The path of the certificate that will be sent to clients during - /// the SSL/TLS handshake. - /// - /// From the point of view of OpenSSL, this file will be passed to - /// `SSL_CTX_use_certificate_chain_file()`. - /// - /// This option is ignore if `ssl` is false. - std::string ssl_certificate_path; - - /// The path of the private key corresponding to the certificate. - /// - /// From the point of view of OpenSSL, this file will be passed to - /// `SSL_CTX_use_PrivateKey_file()`. - /// - /// This option is ignore if `ssl` is false. - std::string ssl_certificate_key_path; - }; - - Server(const std::string& root_dir, util::Optional public_key, Config = Config()); - Server(Server&&) noexcept; - ~Server() noexcept; - - /// start() binds a listening socket to the address and port specified in - /// Config and starts accepting connections. - /// The resolved endpoint (including the dynamically assigned port, if requested) - /// can be obtained by calling listen_endpoint(). - /// This can be done immediately after start() returns. - void start(); - - /// A helper function, for backwards compatibility, that starts a listening - /// socket without SSL at the specified address and port. - void start(const std::string& listen_address, - const std::string& listen_port, - bool reuse_address = true); - - /// Return the resolved and bound endpoint of the listening socket. - util::network::Endpoint listen_endpoint() const; - - /// Run the internal event-loop of the server. At most one thread may - /// execute run() at any given time. It is an error if run() is called - /// before start() has been successfully executed. The call to run() will - /// not return until somebody calls stop(). - void run(); - - /// Stop any thread that is currently executing run(). This function may be - /// called by any thread. - void stop() noexcept; - - /// Must not be called while run() is executing. - uint_fast64_t errors_seen() const noexcept; - - /// Initialise the directory structure as required for correct operation of - /// the server. This is a static function, as it should be run on the \a - /// root_path prior to instantiating the \c Server object. - static void init_directory_structure(const std::string& root_path, util::Logger& logger); - - -private: - class Implementation; - std::unique_ptr m_impl; -}; - - -class Server::Clock { -public: - virtual int_fast64_t now() = 0; - - virtual ~Clock() {} -}; - -} // namespace sync -} // namespace realm - -#endif // REALM_SYNC_SERVER_HPP diff --git a/Pods/Realm/include/core/realm/sync/server_configuration.hpp b/Pods/Realm/include/core/realm/sync/server_configuration.hpp deleted file mode 100644 index 50144959..00000000 --- a/Pods/Realm/include/core/realm/sync/server_configuration.hpp +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2015] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ -#ifndef REALM_SYNC_SERVER_CONFIGURATION_HPP -#define REALM_SYNC_SERVER_CONFIGURATION_HPP - -// Realm headers -#include -#include - -namespace realm { -namespace config { - -struct Configuration { - std::string listen_address = "127.0.0.1"; - std::string listen_port = ""; // Empty means choose default based on `ssl`. - realm::util::Optional root_dir; - std::string user_data_dir; - std::string internal_data_dir; - realm::util::Optional public_key_path; - realm::util::Optional config_file_path; - bool reuse_address = true; - bool disable_sync = false; - realm::util::Logger::Level log_level = realm::util::Logger::Level::info; - realm::util::Optional log_path; - std::string stats_db_path; - long max_open_files = 256; - bool ssl = false; - std::string ssl_certificate_path; - std::string ssl_certificate_key_path; - std::string dashboard_stats_endpoint = "localhost:28125"; -}; - -void show_help(const std::string& program_name); -Configuration build_configuration(int argc, char* argv[]); -Configuration load_configuration(std::string configuration_file_path); - -} // namespace config -} // namespace realm - -#endif // REALM_SYNC_SERVER_CONFIGURATION_HPP diff --git a/Pods/Realm/include/core/realm/sync/transform.hpp b/Pods/Realm/include/core/realm/sync/transform.hpp deleted file mode 100644 index 5d9b1152..00000000 --- a/Pods/Realm/include/core/realm/sync/transform.hpp +++ /dev/null @@ -1,371 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2015] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ - -#ifndef REALM_SYNC_TRANSFORM_HPP -#define REALM_SYNC_TRANSFORM_HPP - -#include - -#include -#include -#include - -namespace realm { -namespace sync { - -class HistoryEntry { -public: - using timestamp_type = uint_fast64_t; - using file_ident_type = uint_fast64_t; - using version_type = _impl::History::version_type; - - /// The time of origination of the changes referenced by this history entry, - /// meassured as the number of milliseconds since 2015-01-01T00:00:00Z, not - /// including leap seconds. For changes of local origin, this is the local - /// time at the point when the local transaction was committed. For changes - /// of remote origin, it is the remote time of origin at the client - /// identified by `origin_client_file_ident`. - /// - /// All clients that will be, or are already participating in - /// synchronization must guarantee that their local history is causally - /// consistent. The convergence guarantee offered by the merge system relies - /// strongly on this. - /// - /// FIXME: In its current form, the merge algorithm seems to achieve - /// convergence even without causal consistency. Figure out whether we still - /// want to require it, and if so, why. - /// - /// **Definition:** The local history is *causally consistent* if, and only - /// if every entry, referring to changes of local origin, has an effective - /// timestamp, which is greater than, or equal to the effective timestamp of - /// all preceding entries in the local history. - /// - /// **Definition:** The *effective timestamp* of a history entry is the pair - /// `(origin_timestamp, origin_client_file_ident)` endowed with the standard - /// lexicographic order. Note that this implies that it is impossible for - /// two entries to have equal effective timestamps if they originate from - /// different clients. - timestamp_type origin_timestamp; - - /// For changes of local origin, `origin_client_file_ident` is always - /// zero. For changes of remote origin, this history entry was produced by - /// the integration of a changeset received from a remote peer P. In some - /// cases, that changeset may itself have been produced by the integration - /// on P of a changeset received from another remote peer. In any case, as - /// long as these changes are of remote origin, `origin_client_file_ident` - /// identifies the peer on which they originated, which may or may not be P. - /// - /// More concretely, on the server-side, the remote peer is a client, and - /// and the changes always originate from that client, so - /// `origin_client_file_ident` always refer to that client. Conversely, on - /// the client-side, the remote peer is the server, and the server received - /// the original changeset from a client, so `origin_client_file_ident` - /// refers to that client. - /// - /// Note that *peer* is used colloquially here to refer to a particular - /// synchronization participant. In reality, a synchronization participant - /// is either a server-side file, or a particular client-side file - /// associated with that server-side file. To make things even more - /// confusing, a single client application may contain multiple client-side - /// files associated with the same server-side file. In the same vein, - /// *client* should be understood as client-side file, and *remote peer* as - /// any other file from the set of associated files, even other such files - /// contained within the same client application, if there are any. - file_ident_type origin_client_file_ident; - - /// For changes of local origin, `remote_version` is the version produced on - /// the remote peer by the last changeset integrated locally prior to the - /// production of the changeset referenced by this history entry, or zero if - /// no remote changeset was integrated yet. This only makes sense when there - /// is a unique remote peer, and since that is not the case on the server, - /// the server cannot be the originator of any changes. - /// - /// For changes of remote origin, this history entry was produced by the - /// integration of a changeset directly received from a remote peer P, and - /// `remote_version` is then the version produced on P by that - /// changeset. Note that such changes may have originated from a different - /// peer (not P), but `remote_version` will still be the version produced on - /// P. - /// - /// More concretely, on the server-side, the remote peer is a client, and - /// the changes always originate from that client, and `remote_version` is - /// the `` specified in an UPLOAD message of the - /// client-server communication protocol. Conversely, for changes of remote - /// origin on the client-side, the remote peer is the server, and - /// `remote_version` is the specified in a received - /// DOWNLOAD message. - version_type remote_version; - - /// Referenced memory is not owned by this class. - BinaryData changeset; -}; - - -/// The interface between the sync history and the operational transformer -/// (Transformer). -class TransformHistory { -public: - using timestamp_type = HistoryEntry::timestamp_type; - using file_ident_type = HistoryEntry::file_ident_type; - using version_type = HistoryEntry::version_type; - - /// Get the first history entry whose changeset produced a version that - /// succeeds `begin_version` and, and does not succeed `end_version`, and - /// whose changeset was not produced by integration of a changeset received - /// from the specified remote peer. - /// - /// The ownership of the memory referenced by `entry.changeset` is **not** - /// passed to the caller upon return. The callee retains ownership. - /// - /// \param begin_version, end_version The range of versions to consider. If - /// `begin_version` is equal to `end_version`, this is the empty range. If - /// `begin_version` is zero, it means that everything preceeding - /// `end_version` is to be considered, which is again the empty range if - /// `end_version` is also zero. Zero is is special value in that no - /// changeset produces that version. It is an error if `end_version` - /// preceeds `begin_version`, or if `end_version` is zero and - /// `begin_version` is not. - /// - /// \param not_from_remote_client_file_ident Skip entries whose changeset is - /// produced by integration of changesets received from this remote - /// peer. Zero if the remote peer is the server, otherwise the peer - /// identifier of a client. - /// - /// \param only_nonempty Skip entries with empty changesets. - /// - /// \return The version produced by the changeset of the located history - /// entry, or zero if no history entry exists matching the specified - /// criteria. - virtual version_type find_history_entry(version_type begin_version, version_type end_version, - file_ident_type not_from_remote_client_file_ident, - bool only_nonempty, - HistoryEntry& entry) const noexcept = 0; - - /// Copy a contiguous sequence of bytes from the specified reciprocally - /// transformed changeset into the specified buffer. The targeted history - /// entry is the one whose untransformed changeset produced the specified - /// version. Copying starts at the specified offset within the transform, - /// and will continue until the end of the transform or the end of the - /// buffer, whichever comes first. The first copied byte is always placed in - /// `buffer[0]`. The number of copied bytes is returned. - /// - /// \param remote_client_file_ident Zero if the remote peer is the server, - /// otherwise the peer identifier of a client. - virtual size_t read_reciprocal_transform(version_type version, - file_ident_type remote_client_file_ident, - size_t offset, char* buffer, size_t size) const = 0; - - /// Replace a contiguous chunk of bytes within the specified reciprocally - /// transformed changeset. The targeted history entry is the one whose - /// untransformed changeset produced the specified version. If the new chunk - /// has a different size than the on it replaces, subsequent bytes (those - /// beyond the end of the replaced chunk) are shifted to lower or higher - /// offsets accordingly. If `replaced_size` is equal to `size_t(-1)`, the - /// replaced chunk extends from `offset` to the end of the transform. Let - /// `replaced_size_2` be the actual size of the replaced chunk, then the - /// total number of bytes in the transform will increase by `size - - /// replaced_size_2`. It is an error if `replaced_size` is not `size_t(-1)` - /// and `offset + replaced_size` is greater than the size of the transform. - /// - /// \param remote_client_file_ident See read_reciprocal_transform(). - /// - /// \param offset The index of the first replaced byte relative to the - /// beginning of the transform. - /// - /// \param replaced_size The number of bytes in the replaced chunk. - /// - /// \param data The buffer holding the replacing chunk. - /// - /// \param size The number of bytes in the replacing chunk, which is also - /// the number of bytes that will be read from the specified buffer. - virtual void write_reciprocal_transform(version_type version, - file_ident_type remote_client_file_ident, - size_t offset, size_t replaced_size, - const char* data, size_t size) = 0; - - virtual ~TransformHistory() noexcept {} - -protected: - static bool register_local_time(timestamp_type local_timestamp, - timestamp_type& timestamp_threshold) noexcept; - - static bool register_remote_time(timestamp_type remote_timestamp, - timestamp_type& timestamp_threshold) noexcept; -}; - - -class TransformError; // Exception - - -class Transformer { -public: - using timestamp_type = HistoryEntry::timestamp_type; - using file_ident_type = HistoryEntry::file_ident_type; - using version_type = HistoryEntry::version_type; - - struct RemoteChangeset { - /// The version produced on the remote peer by this changeset. - /// - /// On the server, the remote peer is the client from which the - /// changeset originated, and `remote_version` is the client version - /// produced by the changeset on that client. - /// - /// On a client, the remote peer is the server, and `remote_version` is - /// the server version produced by this changeset on the server. Since - /// the server is never the originator of changes, this changeset must - /// in turn have been produced on the server by integration of a - /// changeset uploaded by some other client. - version_type remote_version; - - /// The last local version that has been integrated into - /// `remote_version`. - /// - /// A local version, L, has been integrated into a remote version, R, - /// when, and only when L is the latest local version such that all - /// preceeding changesets in the local history have been integrated by - /// the remote peer prior to R. - /// - /// On the server, this is the last server version integrated into the - /// client version `remote_version`. On a client, it is the last client - /// version integrated into the server version `remote_version`. - version_type last_integrated_local_version; - - /// The changeset itself. - BinaryData data; - - /// Same meaning as `HistoryEntry::origin_timestamp`. - timestamp_type origin_timestamp; - - /// Same meaning as `HistoryEntry::origin_client_file_ident`. - file_ident_type origin_client_file_ident; - - RemoteChangeset(version_type rv, version_type lv, BinaryData d, timestamp_type ot, - file_ident_type fi); - }; - - /// Produce an operationally transformed version of the specified changeset, - /// which is assumed to be of remote origin, and received from remote peer - /// P. Note that P is not necessarily the peer from which the changes - /// originated. - /// - /// Operational transformation is carried out between the specified - /// changeset and all causally unrelated changesets in the local history. A - /// changeset in the local history is causally unrelated if, and only if it - /// occurs after the local changeset that produced - /// `remote_changeset.last_integrated_local_version` and is not a produced - /// by integration of a changeset received from P. This assumes that - /// `remote_changeset.last_integrated_local_version` is set to the local - /// version produced by the last local changeset, that was integrated by P - /// before P produced the specified changeset. - /// - /// The operational transformation is reciprocal (two-way), so it also - /// transforms the causally unrelated local changesets. This process does - /// not modify the history itself (the changesets available through - /// TransformHistory::get_history_entry()), instead the reciprocally - /// transformed changesets are stored separately, and individually for each - /// remote peer, such that they can participate in transformation of the - /// next incoming changeset from P. Note that the peer identifier of P can - /// be derived from `origin_client_file_ident` and information about whether - /// the local peer is a server or a client. - /// - /// In general, if A and B are two causally unrelated (alternative) - /// changesets based on the same version V, then the operational - /// transformation between A and B produces changesets A' and B' such that - /// both of the concatenated changesets A + B' and B + A' produce the same - /// final state when applied to V. Operational transformation is meaningful - /// only when carried out between alternative changesets based on the same - /// version. - /// - /// \return The size of the transformed version of the specified - /// changeset. Upon return, the changeset itself is stored in the specified - /// output buffer. - /// - /// \throw TransformError Thrown if operational transformation fails due to - /// a problem with the specified changeset. - virtual size_t transform_remote_changeset(TransformHistory&, - version_type current_local_version, - RemoteChangeset changeset, - util::Buffer& output_buffer) = 0; - - virtual ~Transformer() noexcept {} -}; - - -/// \param local_client_file_ident The server assigned local client file -/// identifier. This must be zero on the server-side, and only on the -/// server-side. -std::unique_ptr make_transformer(Transformer::file_ident_type local_client_file_ident); - - - - -// Implementation - -inline bool TransformHistory::register_local_time(timestamp_type local_timestamp, - timestamp_type& timestamp_threshold) noexcept -{ - // Needed to ensure causal consistency. This also guards against - // nonmonotonic local time. - if (timestamp_threshold < local_timestamp) { - timestamp_threshold = local_timestamp; - return true; - } - return false; -} - -inline bool TransformHistory::register_remote_time(timestamp_type remote_timestamp, - timestamp_type& timestamp_threshold) noexcept -{ - // To ensure causal consistency, we need to know the latest remote (or - // local) timestamp seen so far. Adding one to the incoming remote - // timestamp, before using it to bump the `timestamp_threshold`, is a - // simple way of ensuring not only proper ordering among timestamps, but - // also among 'effective timestamps' (which is required), regardless of the - // values of the assiciated client file identifiers. - if (timestamp_threshold < remote_timestamp + 1) { - timestamp_threshold = remote_timestamp + 1; - return true; - } - return false; -} - -class TransformError: public std::runtime_error { -public: - TransformError(const std::string& message): - std::runtime_error(message) - { - } -}; - -inline Transformer::RemoteChangeset::RemoteChangeset(version_type rv, version_type lv, - BinaryData d, timestamp_type ot, - file_ident_type fi): - remote_version(rv), - last_integrated_local_version(lv), - data(d), - origin_timestamp(ot), - origin_client_file_ident(fi) -{ -} - -} // namespace sync -} // namespace realm - -#endif // REALM_SYNC_TRANSFORM_HPP diff --git a/Pods/Realm/include/core/realm/sync/version.hpp b/Pods/Realm/include/core/realm/sync/version.hpp deleted file mode 100644 index b0858631..00000000 --- a/Pods/Realm/include/core/realm/sync/version.hpp +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************* - * - * REALM CONFIDENTIAL - * __________________ - * - * [2011] - [2013] Realm Inc - * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Realm Incorporated and its suppliers, - * if any. The intellectual and technical concepts contained - * herein are proprietary to Realm Incorporated - * and its suppliers and may be covered by U.S. and Foreign Patents, - * patents in process, and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Realm Incorporated. - * - **************************************************************************/ -#ifndef REALM_SYNC_VERSION_HPP -#define REALM_SYNC_VERSION_HPP - -#include - -#define REALM_SYNC_VER_MAJOR 1 -#define REALM_SYNC_VER_MINOR 0 -#define REALM_SYNC_VER_PATCH 1 -#define REALM_SYNC_PRODUCT_NAME "realm-sync" - -#define REALM_SYNC_VER_STRING REALM_QUOTE(REALM_SYNC_VER_MAJOR) "." \ - REALM_QUOTE(REALM_SYNC_VER_MINOR) "." REALM_QUOTE(REALM_SYNC_VER_PATCH) -#define REALM_SYNC_VER_CHUNK "[" REALM_SYNC_PRODUCT_NAME "-" REALM_SYNC_VER_STRING "]" - -#endif // REALM_SYNC_VERSION_HPP diff --git a/Pods/Realm/include/core/realm/table.hpp b/Pods/Realm/include/core/realm/table.hpp deleted file mode 100644 index 01c44ac5..00000000 --- a/Pods/Realm/include/core/realm/table.hpp +++ /dev/null @@ -1,2439 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_TABLE_HPP -#define REALM_TABLE_HPP - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace realm { - -class BacklinkColumn; -class BinaryColumy; -class ConstTableView; -class Group; -class LinkColumn; -class LinkColumnBase; -class LinkListColumn; -class LinkView; -class SortDescriptor; -class StringIndex; -class TableView; -class TableViewBase; -class TimestampColumn; -template -class Columns; -template -class SubQuery; -struct LinkTargetInfo; - -struct Link { -}; -typedef Link LinkList; -typedef Link BackLink; - -namespace _impl { -class TableFriend; -} - -class Replication; - - -/// The Table class is non-polymorphic, that is, it has no virtual -/// functions. This is important because it ensures that there is no run-time -/// distinction between a Table instance and an instance of any variation of -/// BasicTable, and this, in turn, makes it valid to cast a pointer from -/// Table to BasicTable even when the instance is constructed as a Table. Of -/// course, this also assumes that BasicTable<> is non-polymorphic, has no -/// destructor, and adds no extra data members. -/// -/// FIXME: Table assignment (from any group to any group) could be made aliasing -/// safe as follows: Start by cloning source table into target allocator. On -/// success, assign, and then deallocate any previous structure at the target. -/// -/// FIXME: It might be desirable to have a 'table move' feature between two -/// places inside the same group (say from a subtable or a mixed column to group -/// level). This could be done in a very efficient manner. -/// -/// FIXME: When compiling in debug mode, all public non-static table functions -/// should REALM_ASSERT(is_attached()). -class Table { -public: - /// Construct a new freestanding top-level table with static - /// lifetime. - /// - /// This constructor should be used only when placing a table - /// instance on the stack, and it is then the responsibility of - /// the application that there are no objects of type TableRef or - /// ConstTableRef that refer to it, or to any of its subtables, - /// when it goes out of scope. To create a top-level table with - /// dynamic lifetime, use Table::create() instead. - Table(Allocator& = Allocator::get_default()); - - /// Construct a copy of the specified table as a new freestanding - /// top-level table with static lifetime. - /// - /// This constructor should be used only when placing a table - /// instance on the stack, and it is then the responsibility of - /// the application that there are no objects of type TableRef or - /// ConstTableRef that refer to it, or to any of its subtables, - /// when it goes out of scope. To create a top-level table with - /// dynamic lifetime, use Table::copy() instead. - Table(const Table&, Allocator& = Allocator::get_default()); - - ~Table() noexcept; - - Allocator& get_alloc() const; - - /// Construct a new freestanding top-level table with dynamic lifetime. - static TableRef create(Allocator& = Allocator::get_default()); - - /// Construct a copy of the specified table as a new freestanding top-level - /// table with dynamic lifetime. - TableRef copy(Allocator& = Allocator::get_default()) const; - - /// Returns true if, and only if this accessor is currently attached to an - /// underlying table. - /// - /// A table accessor may get detached from the underlying row for various - /// reasons (see below). When it does, it no longer refers to anything, and - /// can no longer be used, except for calling is_attached(). The - /// consequences of calling other non-static functions on a detached table - /// accessor are unspecified. Table accessors obtained by calling functions in - /// the Realm API are always in the 'attached' state immediately upon - /// return from those functions. - /// - /// A table accessor of a free-standing table never becomes detached (except - /// during its eventual destruction). A group-level table accessor becomes - /// detached if the underlying table is removed from the group, or when the - /// group accessor is destroyed. A subtable accessor becomes detached if the - /// underlying subtable is removed, or if the parent table accessor is - /// detached. A table accessor does not become detached for any other reason - /// than those mentioned here. - /// - /// FIXME: High level language bindings will probably want to be able to - /// explicitely detach a group and all tables of that group if any modifying - /// operation fails (e.g. memory allocation failure) (and something similar - /// for freestanding tables) since that leaves the group in state where any - /// further access is disallowed. This way they will be able to reliably - /// intercept any attempt at accessing such a failed group. - /// - /// FIXME: The C++ documentation must state that if any modifying operation - /// on a group (incl. tables, subtables, and specs) or on a free standing - /// table (incl. subtables and specs) fails, then any further access to that - /// group (except ~Group()) or freestanding table (except ~Table()) has - /// undefined behaviour and is considered an error on behalf of the - /// application. Note that even Table::is_attached() is disallowed in this - /// case. - bool is_attached() const noexcept; - - /// Get the name of this table, if it has one. Only group-level tables have - /// names. For a table of any other kind, this function returns the empty - /// string. - StringData get_name() const noexcept; - - // Whether or not elements can be null. - bool is_nullable(size_t col_ndx) const; - - //@{ - /// Conventience functions for inspecting the dynamic table type. - /// - /// These functions behave as if they were called on the descriptor returned - /// by get_descriptor(). - size_t get_column_count() const noexcept; - DataType get_column_type(size_t column_ndx) const noexcept; - StringData get_column_name(size_t column_ndx) const noexcept; - size_t get_column_index(StringData name) const noexcept; - //@} - - //@{ - /// Convenience functions for manipulating the dynamic table type. - /// - /// These function must be called only for tables with independent dynamic - /// type. A table has independent dynamic type if the function - /// has_shared_type() returns false. A table that is a direct member of a - /// group has independent dynamic type. So does a free-standing table, and a - /// subtable in a column of type 'mixed'. All other tables have shared - /// dynamic type. The consequences of calling any of these functions for a - /// table with shared dynamic type are undefined. - /// - /// Apart from that, these functions behave as if they were called on the - /// descriptor returned by get_descriptor(). Note especially that the - /// `_link` suffixed functions must be used when inserting link-type - /// columns. - /// - /// If you need to change the shared dynamic type of the subtables in a - /// subtable column, consider using the API offered by the Descriptor class. - /// - /// \sa has_shared_type() - /// \sa get_descriptor() - - size_t add_column(DataType type, StringData name, bool nullable = false, DescriptorRef* subdesc = nullptr); - void insert_column(size_t column_ndx, DataType type, StringData name, bool nullable = false, - DescriptorRef* subdesc = nullptr); - - // Todo, these prototypes only exist for backwards compatibility. We should remove them because they are error - // prone (optional arguments and implicit bool to null-ptr conversion) - size_t add_column(DataType type, StringData name, DescriptorRef* subdesc) - { - return add_column(type, name, false, subdesc); - } - void insert_column(size_t column_ndx, DataType type, StringData name, DescriptorRef* subdesc) - { - insert_column(column_ndx, type, name, false, subdesc); - } - - size_t add_column_link(DataType type, StringData name, Table& target, LinkType link_type = link_Weak); - void insert_column_link(size_t column_ndx, DataType type, StringData name, Table& target, - LinkType link_type = link_Weak); - void remove_column(size_t column_ndx); - void rename_column(size_t column_ndx, StringData new_name); - //@} - - //@{ - - /// has_search_index() returns true if, and only if a search index has been - /// added to the specified column. Rather than throwing, it returns false if - /// the table accessor is detached or the specified index is out of range. - /// - /// add_search_index() adds a search index to the specified column of this - /// table. It has no effect if a search index has already been added to the - /// specified column (idempotency). - /// - /// remove_search_index() removes the search index from the specified column - /// of this table. It has no effect if the specified column has no search - /// index. The search index cannot be removed from the primary key of a - /// table. - /// - /// This table must be a root table; that is, it must have an independent - /// descriptor. Freestanding tables, group-level tables, and subtables in a - /// column of type 'mixed' are all examples of root tables. See add_column() - /// for more on this. - /// - /// \param column_ndx The index of a column of this table. - - bool has_search_index(size_t column_ndx) const noexcept; - void add_search_index(size_t column_ndx); - void remove_search_index(size_t column_ndx); - - //@} - - //@{ - /// Get the dynamic type descriptor for this table. - /// - /// Every table has an associated descriptor that specifies its dynamic - /// type. For simple tables, that is, tables without subtable columns, the - /// dynamic type can be inspected and modified directly using member - /// functions such as get_column_count() and add_column(). For more complex - /// tables, the type is best managed through the associated descriptor - /// object which is returned by this function. - /// - /// \sa has_shared_type() - DescriptorRef get_descriptor(); - ConstDescriptorRef get_descriptor() const; - //@} - - //@{ - /// Get the dynamic type descriptor for the column with the - /// specified index. That column must have type 'table'. - /// - /// This is merely a shorthand for calling `get_subdescriptor(column_ndx)` - /// on the descriptor returned by `get_descriptor()`. - DescriptorRef get_subdescriptor(size_t column_ndx); - ConstDescriptorRef get_subdescriptor(size_t column_ndx) const; - //@} - - //@{ - /// Get access to an arbitrarily nested dynamic type descriptor. - /// - /// The returned descriptor is the one you would get by calling - /// Descriptor::get_subdescriptor() once for each entry in the specified - /// path, starting with the descriptor returned by get_descriptor(). The - /// path is allowed to be empty. - typedef std::vector path_vec; - DescriptorRef get_subdescriptor(const path_vec& path); - ConstDescriptorRef get_subdescriptor(const path_vec& path) const; - //@} - - //@{ - /// Convenience functions for manipulating nested table types. - /// - /// These functions behave as if they were called on the descriptor returned - /// by `get_subdescriptor(path)`. These function must be called only on - /// tables with independent dynamic type. - /// - /// \return The value returned by add_subcolumn(), is the index of - /// the added column within the descriptor referenced by the - /// specified path. - /// - /// \sa Descriptor::add_column() - /// \sa has_shared_type() - size_t add_subcolumn(const path_vec& path, DataType type, StringData name); - void insert_subcolumn(const path_vec& path, size_t column_ndx, DataType type, StringData name); - void remove_subcolumn(const path_vec& path, size_t column_ndx); - void rename_subcolumn(const path_vec& path, size_t column_ndx, StringData new_name); - //@} - - /// Does this table share its type with other tables? - /// - /// Tables that are direct members of groups have independent - /// dynamic types. The same is true for free-standing tables and - /// subtables in coulmns of type 'mixed'. For such tables, this - /// function returns false. - /// - /// When a table has a column of type 'table', the cells in that - /// column contain subtables. All those subtables have the same - /// dynamic type, and they share a single type descriptor. For all - /// such subtables, this function returns true. See - /// Descriptor::is_root() for more on this. - /// - /// Please note that Table functions that modify the dynamic type - /// directly, such as add_column(), are only allowed to be used on - /// tables with non-shared type. If you need to modify a shared - /// type, you will have to do that through the descriptor returned - /// by get_descriptor(), but note that it will then affect all the - /// tables sharing that descriptor. - /// - /// \sa get_descriptor() - /// \sa Descriptor::is_root() - bool has_shared_type() const noexcept; - - - template - Columns column(size_t column); // FIXME: Should this one have been declared noexcept? - template - Columns column(const Table& origin, size_t origin_column_ndx); - - template - SubQuery column(size_t column, Query subquery); - template - SubQuery column(const Table& origin, size_t origin_column_ndx, Query subquery); - - // Table size and deletion - bool is_empty() const noexcept; - size_t size() const noexcept; - - typedef BasicRowExpr
RowExpr; - typedef BasicRowExpr ConstRowExpr; - - RowExpr get(size_t row_ndx) noexcept; - ConstRowExpr get(size_t row_ndx) const noexcept; - - RowExpr front() noexcept; - ConstRowExpr front() const noexcept; - - RowExpr back() noexcept; - ConstRowExpr back() const noexcept; - - RowExpr operator[](size_t row_ndx) noexcept; - ConstRowExpr operator[](size_t row_ndx) const noexcept; - - - //@{ - - /// Row handling. - /// - /// remove() removes the specified row from the table and shifts all rows at - /// higher index to fill the vacated slot. This operation assumes that the - /// table is ordered, and it is therefore allowed only on tables **without** - /// link columns, as link columns are only allowed in unordered tables. - /// - /// move_last_over() removes the specified row from the table, and if it is - /// not the last row in the table, it then moves the last row into the - /// vacated slot. This operation assumes that the table is unordered, and it - /// may therfore be used on tables with link columns. - /// - /// The removal of a row from an unordered table (move_last_over()) may - /// cause other linked rows to be cascade-removed. The clearing of a table - /// may also cause linked rows to be cascade-removed, but in this respect, - /// the effect is exactly as if each row had been removed individually. See - /// Descriptor::set_link_type() for details. - - size_t add_empty_row(size_t num_rows = 1); - void insert_empty_row(size_t row_ndx, size_t num_rows = 1); - void remove(size_t row_ndx); - void remove_last(); - void move_last_over(size_t row_ndx); - void clear(); - void swap_rows(size_t row_ndx_1, size_t row_ndx_2); - //@} - - /// Replaces all links to \a row_ndx with links to \a new_row_ndx. - /// - /// This operation is usually followed by Table::move_last_over() - /// as part of Table::set_int_unique() or Table::set_string_unique() - /// or Table::set_null_unique() detecting a collision. - /// - /// \sa Table::move_last_over() - /// \sa Table::set_int_unique() - /// \sa Table::set_string_unique() - /// \sa Table::set_null_unique() - void merge_rows(size_t row_ndx, size_t new_row_ndx); - - // Get cell values. Will assert if the requested type does not match the column type - int64_t get_int(size_t column_ndx, size_t row_ndx) const noexcept; - bool get_bool(size_t column_ndx, size_t row_ndx) const noexcept; - OldDateTime get_olddatetime(size_t column_ndx, size_t row_ndx) const noexcept; - float get_float(size_t column_ndx, size_t row_ndx) const noexcept; - double get_double(size_t column_ndx, size_t row_ndx) const noexcept; - StringData get_string(size_t column_ndx, size_t row_ndx) const noexcept; - BinaryData get_binary(size_t column_ndx, size_t row_ndx) const noexcept; - Mixed get_mixed(size_t column_ndx, size_t row_ndx) const noexcept; - DataType get_mixed_type(size_t column_ndx, size_t row_ndx) const noexcept; - Timestamp get_timestamp(size_t column_ndx, size_t row_ndx) const noexcept; - - template - T get(size_t c, size_t r) const noexcept; - - size_t get_link(size_t column_ndx, size_t row_ndx) const noexcept; - bool is_null_link(size_t column_ndx, size_t row_ndx) const noexcept; - LinkViewRef get_linklist(size_t column_ndx, size_t row_ndx); - ConstLinkViewRef get_linklist(size_t column_ndx, size_t row_ndx) const; - size_t get_link_count(size_t column_ndx, size_t row_ndx) const noexcept; - bool linklist_is_empty(size_t column_ndx, size_t row_ndx) const noexcept; - bool is_null(size_t column_ndx, size_t row_ndx) const noexcept; - - TableRef get_link_target(size_t column_ndx) noexcept; - ConstTableRef get_link_target(size_t column_ndx) const noexcept; - - template - typename T::RowAccessor get_link_accessor(size_t column_ndx, size_t row_ndx); - - //@{ - - /// Set cell values. - /// - /// It is an error to specify a column index, row index, or string position - /// that is out of range. - /// - /// The number of bytes in a string value must not exceed `max_string_size`, - /// and the number of bytes in a binary data value must not exceed - /// `max_binary_size`. String must also contain valid UTF-8 encodings. These - /// requirements also apply when modifying a string with insert_substring() - /// and remove_substring(), and for strings in a mixed columnt. Passing, or - /// producing an oversized string or binary data value will cause an - /// exception to be thrown. - /// - /// The "unique" variants (set_int_unique(), set_string_unique(), set_null_unique()) - /// are intended to be used in the implementation of primary key support. They - /// check if the given column already contains one or more values that are - /// equal to \a value, and if there are conflicts, it calls - /// Table::merge_rows() for the row_ndx to be replaced by the - /// existing row, followed by a Table::move_last_over() of row_ndx. The - /// return value is always a row index of a row that contains \a value in - /// the specified column, possibly different from \a row_ndx if a conflict - /// occurred. Users intending to implement primary keys must therefore - /// manually check for duplicates if they want to raise an error instead. - /// - /// NOTE: It is an error to call either function after adding elements to a - /// linklist in the object. In general, calling set_int_unique() or - /// set_string_unique() or set_null_unique() should be the first thing that - /// happens after creating a row. These limitations are imposed by limitations - /// in the Realm Object Server and may be relaxed in the future. A violation of - /// these rules results in a LogicError being thrown. - /// - /// add_int() adds a 64-bit signed integer to the current value of the - /// cell. If the addition would cause signed integer overflow or - /// underflow, the addition "wraps around" with semantics similar to - /// unsigned integer arithmetic, such that Table::max_integer + 1 == - /// Table::min_integer and Table::min_integer - 1 == Table::max_integer. - /// Note that the wrapping is platform-independent (all platforms wrap in - /// the same way regardless of integer representation). If the existing - /// value in the cell is null, a LogicError exception is thrown. - /// - /// insert_substring() inserts the specified string into the currently - /// stored string at the specified position. The position must be less than - /// or equal to the size of the currently stored string. - /// - /// remove_substring() removes the specified byte range from the currently - /// stored string. The beginning of the range (\a pos) must be less than or - /// equal to the size of the currently stored string. If the specified range - /// extends beyond the end of the currently stored string, it will be - /// silently clamped. - /// - /// String level modifications performed via insert_substring() and - /// remove_substring() are mergable and subject to operational - /// trsnaformation. That is, the effect of two causally unrelated - /// modifications will in general both be retained during synchronization. - - static const size_t max_string_size = 0xFFFFF8 - Array::header_size - 1; - static const size_t max_binary_size = 0xFFFFF8 - Array::header_size; - - // FIXME: These limits should be chosen independently of the underlying - // platform's choice to define int64_t and independent of the integer - // representation. The current values only work for 2's complement, which is - // not guaranteed by the standard. - static constexpr int_fast64_t max_integer = std::numeric_limits::max(); - static constexpr int_fast64_t min_integer = std::numeric_limits::min(); - - void set_int(size_t column_ndx, size_t row_ndx, int_fast64_t value, bool is_default = false); - size_t set_int_unique(size_t column_ndx, size_t row_ndx, int_fast64_t value); - void set_bool(size_t column_ndx, size_t row_ndx, bool value, bool is_default = false); - void set_olddatetime(size_t column_ndx, size_t row_ndx, OldDateTime value, bool is_default = false); - void set_timestamp(size_t column_ndx, size_t row_ndx, Timestamp value, bool is_default = false); - template - void set_enum(size_t column_ndx, size_t row_ndx, E value); - void set_float(size_t column_ndx, size_t row_ndx, float value, bool is_default = false); - void set_double(size_t column_ndx, size_t row_ndx, double value, bool is_default = false); - void set_string(size_t column_ndx, size_t row_ndx, StringData value, bool is_default = false); - size_t set_string_unique(size_t column_ndx, size_t row_ndx, StringData value); - void set_binary(size_t column_ndx, size_t row_ndx, BinaryData value, bool is_default = false); - void set_mixed(size_t column_ndx, size_t row_ndx, Mixed value, bool is_default = false); - void set_link(size_t column_ndx, size_t row_ndx, size_t target_row_ndx, bool is_default = false); - void nullify_link(size_t column_ndx, size_t row_ndx); - void set_null(size_t column_ndx, size_t row_ndx, bool is_default = false); - void set_null_unique(size_t col_ndx, size_t row_ndx); - - void add_int(size_t column_ndx, size_t row_ndx, int_fast64_t value); - - void insert_substring(size_t col_ndx, size_t row_ndx, size_t pos, StringData); - void remove_substring(size_t col_ndx, size_t row_ndx, size_t pos, size_t substring_size = realm::npos); - - //@} - - /// Assumes that the specified column is a subtable column (in - /// particular, not a mixed column) and that the specified table - /// has a spec that is compatible with that column, that is, the - /// number of columns must be the same, and corresponding columns - /// must have identical data types (as returned by - /// get_column_type()). - void set_subtable(size_t col_ndx, size_t row_ndx, const Table*); - void set_mixed_subtable(size_t col_ndx, size_t row_ndx, const Table*); - - - // Sub-tables (works on columns whose type is either 'subtable' or - // 'mixed', for a value in a mixed column that is not a subtable, - // get_subtable() returns null, get_subtable_size() returns zero, - // and clear_subtable() replaces the value with an empty table.) - TableRef get_subtable(size_t column_ndx, size_t row_ndx); - ConstTableRef get_subtable(size_t column_ndx, size_t row_ndx) const; - size_t get_subtable_size(size_t column_ndx, size_t row_ndx) const noexcept; - void clear_subtable(size_t column_ndx, size_t row_ndx); - - // Backlinks - size_t get_backlink_count(size_t row_ndx, const Table& origin, size_t origin_col_ndx) const noexcept; - size_t get_backlink(size_t row_ndx, const Table& origin, size_t origin_col_ndx, size_t backlink_ndx) const - noexcept; - - - //@{ - - /// If this accessor is attached to a subtable, then that subtable has a - /// parent table, and the subtable either resides in a column of type - /// `table` or of type `mixed` in that parent. In that case - /// get_parent_table() returns a reference to the accessor associated with - /// the parent, and get_parent_row_index() returns the index of the row in - /// which the subtable resides. In all other cases (free-standing and - /// group-level tables), get_parent_table() returns null and - /// get_parent_row_index() returns realm::npos. - /// - /// If this accessor is attached to a subtable, and \a column_ndx_out is - /// specified, then `*column_ndx_out` is set to the index of the column of - /// the parent table in which the subtable resides. If this accessor is not - /// attached to a subtable, then `*column_ndx_out` will retain its original - /// value upon return. - - TableRef get_parent_table(size_t* column_ndx_out = nullptr) noexcept; - ConstTableRef get_parent_table(size_t* column_ndx_out = nullptr) const noexcept; - size_t get_parent_row_index() const noexcept; - - //@} - - - /// Only group-level unordered tables can be used as origins or targets of - /// links. - bool is_group_level() const noexcept; - - /// If this table is a group-level table, then this function returns the - /// index of this table within the group. Otherwise it returns realm::npos. - size_t get_index_in_group() const noexcept; - - // Aggregate functions - size_t count_int(size_t column_ndx, int64_t value) const; - size_t count_string(size_t column_ndx, StringData value) const; - size_t count_float(size_t column_ndx, float value) const; - size_t count_double(size_t column_ndx, double value) const; - - int64_t sum_int(size_t column_ndx) const; - double sum_float(size_t column_ndx) const; - double sum_double(size_t column_ndx) const; - int64_t maximum_int(size_t column_ndx, size_t* return_ndx = nullptr) const; - float maximum_float(size_t column_ndx, size_t* return_ndx = nullptr) const; - double maximum_double(size_t column_ndx, size_t* return_ndx = nullptr) const; - OldDateTime maximum_olddatetime(size_t column_ndx, size_t* return_ndx = nullptr) const; - Timestamp maximum_timestamp(size_t column_ndx, size_t* return_ndx = nullptr) const; - int64_t minimum_int(size_t column_ndx, size_t* return_ndx = nullptr) const; - float minimum_float(size_t column_ndx, size_t* return_ndx = nullptr) const; - double minimum_double(size_t column_ndx, size_t* return_ndx = nullptr) const; - OldDateTime minimum_olddatetime(size_t column_ndx, size_t* return_ndx = nullptr) const; - Timestamp minimum_timestamp(size_t column_ndx, size_t* return_ndx = nullptr) const; - double average_int(size_t column_ndx, size_t* value_count = nullptr) const; - double average_float(size_t column_ndx, size_t* value_count = nullptr) const; - double average_double(size_t column_ndx, size_t* value_count = nullptr) const; - - // Searching - size_t find_first_link(size_t target_row_index) const; - size_t find_first_int(size_t column_ndx, int64_t value) const; - size_t find_first_bool(size_t column_ndx, bool value) const; - size_t find_first_olddatetime(size_t column_ndx, OldDateTime value) const; - size_t find_first_timestamp(size_t column_ndx, Timestamp value) const; - size_t find_first_float(size_t column_ndx, float value) const; - size_t find_first_double(size_t column_ndx, double value) const; - size_t find_first_string(size_t column_ndx, StringData value) const; - size_t find_first_binary(size_t column_ndx, BinaryData value) const; - size_t find_first_null(size_t column_ndx) const; - - TableView find_all_link(size_t target_row_index); - ConstTableView find_all_link(size_t target_row_index) const; - TableView find_all_int(size_t column_ndx, int64_t value); - ConstTableView find_all_int(size_t column_ndx, int64_t value) const; - TableView find_all_bool(size_t column_ndx, bool value); - ConstTableView find_all_bool(size_t column_ndx, bool value) const; - TableView find_all_olddatetime(size_t column_ndx, OldDateTime value); - ConstTableView find_all_olddatetime(size_t column_ndx, OldDateTime value) const; - TableView find_all_float(size_t column_ndx, float value); - ConstTableView find_all_float(size_t column_ndx, float value) const; - TableView find_all_double(size_t column_ndx, double value); - ConstTableView find_all_double(size_t column_ndx, double value) const; - TableView find_all_string(size_t column_ndx, StringData value); - ConstTableView find_all_string(size_t column_ndx, StringData value) const; - TableView find_all_binary(size_t column_ndx, BinaryData value); - ConstTableView find_all_binary(size_t column_ndx, BinaryData value) const; - TableView find_all_null(size_t column_ndx); - ConstTableView find_all_null(size_t column_ndx) const; - - /// The following column types are supported: String, Integer, OldDateTime, Bool - TableView get_distinct_view(size_t column_ndx); - ConstTableView get_distinct_view(size_t column_ndx) const; - - TableView get_sorted_view(size_t column_ndx, bool ascending = true); - ConstTableView get_sorted_view(size_t column_ndx, bool ascending = true) const; - - TableView get_sorted_view(SortDescriptor order); - ConstTableView get_sorted_view(SortDescriptor order) const; - - TableView get_range_view(size_t begin, size_t end); - ConstTableView get_range_view(size_t begin, size_t end) const; - - TableView get_backlink_view(size_t row_ndx, Table* src_table, size_t src_col_ndx); - - - // Pivot / aggregate operation types. Experimental! Please do not document method publicly. - enum AggrType { - aggr_count, - aggr_sum, - aggr_avg, - aggr_min, - aggr_max, - }; - - // Simple pivot aggregate method. Experimental! Please do not document method publicly. - void aggregate(size_t group_by_column, size_t aggr_column, AggrType op, Table& result, - const IntegerColumn* viewrefs = nullptr) const; - - /// Report the current versioning counter for the table. The versioning counter is guaranteed to - /// change when the contents of the table changes after advance_read() or promote_to_write(), or - /// immediately after calls to methods which change the table. The term "change" means "change of - /// value": The storage layout of the table may change, for example due to optimization, but this - /// is not considered a change of a value. This means that you *cannot* use a non-changing version - /// count to indicate that object addresses (e.g. strings, binary data) remain the same. - /// The versioning counter *may* change (but is not required to do so) when another table linked - /// from this table, or linking to this table, is changed. The version counter *may* also change - /// without any apparent reason. - uint_fast64_t get_version_counter() const noexcept; - -private: - template - size_t find_first(size_t column_ndx, T value) const; // called by above methods - template - TableView find_all(size_t column_ndx, T value); - -public: - //@{ - /// Find the lower/upper bound according to a column that is - /// already sorted in ascending order. - /// - /// For an integer column at index 0, and an integer value '`v`', - /// lower_bound_int(0,v) returns the index '`l`' of the first row - /// such that `get_int(0,l) ≥ v`, and upper_bound_int(0,v) - /// returns the index '`u`' of the first row such that - /// `get_int(0,u) > v`. In both cases, if no such row is found, - /// the returned value is the number of rows in the table. - /// - /// 3 3 3 4 4 4 5 6 7 9 9 9 - /// ^ ^ ^ ^ ^ - /// | | | | | - /// | | | | -- Lower and upper bound of 15 - /// | | | | - /// | | | -- Lower and upper bound of 8 - /// | | | - /// | | -- Upper bound of 4 - /// | | - /// | -- Lower bound of 4 - /// | - /// -- Lower and upper bound of 1 - /// - /// These functions are similar to std::lower_bound() and - /// std::upper_bound(). - /// - /// The string versions assume that the column is sorted according - /// to StringData::operator<(). - size_t lower_bound_int(size_t column_ndx, int64_t value) const noexcept; - size_t upper_bound_int(size_t column_ndx, int64_t value) const noexcept; - size_t lower_bound_bool(size_t column_ndx, bool value) const noexcept; - size_t upper_bound_bool(size_t column_ndx, bool value) const noexcept; - size_t lower_bound_float(size_t column_ndx, float value) const noexcept; - size_t upper_bound_float(size_t column_ndx, float value) const noexcept; - size_t lower_bound_double(size_t column_ndx, double value) const noexcept; - size_t upper_bound_double(size_t column_ndx, double value) const noexcept; - size_t lower_bound_string(size_t column_ndx, StringData value) const noexcept; - size_t upper_bound_string(size_t column_ndx, StringData value) const noexcept; - //@} - - // Queries - // Using where(tv) is the new method to perform queries on TableView. The 'tv' can have any order; it does not - // need to be sorted, and, resulting view retains its order. - Query where(TableViewBase* tv = nullptr) - { - return Query(*this, tv); - } - - // FIXME: We need a ConstQuery class or runtime check against modifications in read transaction. - Query where(TableViewBase* tv = nullptr) const - { - return Query(*this, tv); - } - - // Perform queries on a LinkView. The returned Query holds a reference to lv. - Query where(const LinkViewRef& lv) - { - return Query(*this, lv); - } - - Table& link(size_t link_column); - Table& backlink(const Table& origin, size_t origin_col_ndx); - - // Optimizing. enforce == true will enforce enumeration of all string columns; - // enforce == false will auto-evaluate if they should be enumerated or not - void optimize(bool enforce = false); - - /// Write this table (or a slice of this table) to the specified - /// output stream. - /// - /// The output will have the same format as any other Realm - /// database file, such as those produced by Group::write(). In - /// this case, however, the resulting database file will contain - /// exactly one table, and that table will contain only the - /// specified slice of the source table (this table). - /// - /// The new table will always have the same dynamic type (see - /// Descriptor) as the source table (this table), and unless it is - /// overridden (\a override_table_name), the new table will have - /// the same name as the source table (see get_name()). Indexes - /// (see add_search_index()) will not be carried over to the new - /// table. - /// - /// \param out The destination output stream buffer. - /// - /// \param offset Index of first row to include (if `slice_size > - /// 0`). Must be less than, or equal to size(). - /// - /// \param slice_size Number of rows to include. May be zero. If - /// `slice_size > size() - offset`, then the effective size of - /// the written slice will be `size() - offset`. - /// - /// \param override_table_name Custom name to write out instead of - /// the actual table name. - /// - /// \throw std::out_of_range If `offset > size()`. - /// - /// FIXME: While this function does provided a maximally efficient - /// way of serializing part of a table, it offers little in terms - /// of general utility. This is unfortunate, because it pulls - /// quite a large amount of code into the core library to support - /// it. - void write(std::ostream& out, size_t offset = 0, size_t slice_size = npos, - StringData override_table_name = StringData()) const; - - // Conversion - void to_json(std::ostream& out, size_t link_depth = 0, - std::map* renames = nullptr) const; - void to_string(std::ostream& out, size_t limit = 500) const; - void row_to_string(size_t row_ndx, std::ostream& out) const; - - // Get a reference to this table - TableRef get_table_ref() - { - return TableRef(this); - } - ConstTableRef get_table_ref() const - { - return ConstTableRef(this); - } - - /// \brief Compare two tables for equality. - /// - /// Two tables are equal if they have equal descriptors - /// (`Descriptor::operator==()`) and equal contents. Equal descriptors imply - /// that the two tables have the same columns in the same order. Equal - /// contents means that the two tables must have the same number of rows, - /// and that for each row index, the two rows must have the same values in - /// each column. - /// - /// In mixed columns, both the value types and the values are required to be - /// equal. - /// - /// For a particular row and column, if the two values are themselves tables - /// (subtable and mixed columns) value equality implies a recursive - /// invocation of `Table::operator==()`. - bool operator==(const Table&) const; - - /// \brief Compare two tables for inequality. - /// - /// See operator==(). - bool operator!=(const Table& t) const; - - /// A subtable in a column of type 'table' (which shares descriptor with - /// other subtables in the same column) is initially in a degenerate state - /// where it takes up a minimal amout of space. This function returns true - /// if, and only if the table accessor is attached to such a subtable. This - /// function is mainly intended for debugging purposes. - bool is_degenerate() const noexcept; - - // Debug - void verify() const; -#ifdef REALM_DEBUG - void to_dot(std::ostream&, StringData title = StringData()) const; - void print() const; - MemStats stats() const; - void dump_node_structure() const; // To std::cerr (for GDB) - void dump_node_structure(std::ostream&, int level) const; -#endif - - class Parent; - using HandoverPatch = TableHandoverPatch; - static void generate_patch(const Table* ref, std::unique_ptr& patch); - static TableRef create_from_and_consume_patch(std::unique_ptr& patch, Group& group); - -protected: - /// Get a pointer to the accessor of the specified subtable. The - /// accessor will be created if it does not already exist. - /// - /// The returned table pointer must **always** end up being - /// wrapped in some instantiation of BasicTableRef<>. - Table* get_subtable_ptr(size_t col_ndx, size_t row_ndx); - - /// See non-const get_subtable_ptr(). - const Table* get_subtable_ptr(size_t col_ndx, size_t row_ndx) const; - - /// Compare the rows of two tables under the assumption that the two tables - /// have the same number of columns, and the same data type at each column - /// index (as expressed through the DataType enum). - bool compare_rows(const Table&) const; - - void set_into_mixed(Table* parent, size_t col_ndx, size_t row_ndx) const; - - void check_lists_are_empty(size_t row_ndx) const; - -private: - class SliceWriter; - - // Number of rows in this table - size_t m_size; - - // Underlying array structure. `m_top` is in use only for root tables; that - // is, for tables with independent descriptor. `m_columns` contains a ref - // for each column and search index in order of the columns. A search index - // ref always occurs immediately after the ref of the column to which the - // search index belongs. - // - // A subtable column (a column of type `type_table`) is essentially just a - // column of 'refs' pointing to the root node of each subtable. - // - // To save space in the database file, a subtable in such a column always - // starts out in a degenerate form where nothing is allocated on its behalf, - // and a null 'ref' is stored in the corresponding slot of the column. A - // subtable remains in this degenerate state until the first row is added to - // the subtable. - // - // For this scheme to work, it must be (and is) possible to create a table - // accessor that refers to a degenerate subtable. A table accessor (instance - // of `Table`) refers to a degenerate subtable if, and only if `m_columns` - // is unattached. - // - // FIXME: The fact that `m_columns` may be detached means that many - // functions (even non-modifying functions) need to check for that before - // accessing the contents of the table. This incurs a runtime - // overhead. Consider whether this overhead can be eliminated by having - // `Table::m_columns` always attached to something, and then detect the - // degenerate state in a different way. - Array m_top; - Array m_columns; // 2nd slot in m_top (for root tables) - Spec m_spec; // 1st slot in m_top (for root tables) - - // Is guaranteed to be empty for a detached accessor. Otherwise it is empty - // when the table accessor is attached to a degenerate subtable (unattached - // `m_columns`), otherwise it contains precisely one column accessor for - // each column in the table, in order. - // - // In some cases an entry may be null. This is currently possible only in - // connection with Group::advance_transact(), but it means that several - // member functions must be prepared to handle these null entries; in - // particular, detach(), ~Table(), functions called on behalf of detach() - // and ~Table(), and functiones called on behalf of - // Group::advance_transact(). - typedef std::vector column_accessors; - column_accessors m_cols; - - mutable std::atomic m_ref_count; - - // If this table is a root table (has independent descriptor), - // then Table::m_descriptor refers to the accessor of its - // descriptor when, and only when the descriptor accessor - // exists. This is used to ensure that at most one descriptor - // accessor exists for each underlying descriptor at any given - // point in time. Subdescriptors are kept unique by means of a - // registry in the parent descriptor. Table::m_descriptor is - // always null for tables with shared descriptor. - mutable std::weak_ptr m_descriptor; - - // Table view instances - // Access needs to be protected by m_accessor_mutex - typedef std::vector views; - mutable views m_views; - - // Points to first bound row accessor, or is null if there are none. - mutable RowBase* m_row_accessors = nullptr; - - // Mutex which must be locked any time the row accessor chain or m_views is used - mutable util::Mutex m_accessor_mutex; - - // Used for queries: Items are added with link() method during buildup of query - mutable std::vector m_link_chain; - - /// Used only in connection with Group::advance_transact() and - /// Table::refresh_accessor_tree(). - mutable bool m_mark; - - mutable uint_fast64_t m_version; - - void erase_row(size_t row_ndx, bool is_move_last_over); - void batch_erase_rows(const IntegerColumn& row_indexes, bool is_move_last_over); - void do_remove(size_t row_ndx, bool broken_reciprocal_backlinks); - void do_move_last_over(size_t row_ndx, bool broken_reciprocal_backlinks); - void do_swap_rows(size_t row_ndx_1, size_t row_ndx_2); - void do_merge_rows(size_t row_ndx, size_t new_row_ndx); - void do_clear(bool broken_reciprocal_backlinks); - size_t do_set_link(size_t col_ndx, size_t row_ndx, size_t target_row_ndx); - template - size_t do_find_unique(ColType& col, size_t ndx, T&& value, bool& conflict); - template - size_t do_set_unique_null(ColType& col, size_t ndx, bool& conflict); - template - size_t do_set_unique(ColType& column, size_t row_ndx, T&& value, bool& conflict); - - void upgrade_file_format(size_t target_file_format_version); - - // Upgrades OldDateTime columns to Timestamp columns - void upgrade_olddatetime(); - - /// Update the version of this table and all tables which have links to it. - /// This causes all views referring to those tables to go out of sync, so that - /// calls to sync_if_needed() will bring the view up to date by reexecuting the - /// query. - /// - /// \param bump_global chooses whether the global versioning counter must be - /// bumped first as part of the update. This is the normal mode of operation, - /// when a change is made to the table. When calling recursively (following links - /// or going to the parent table), the parameter should be set to false to correctly - /// prune traversal. - void bump_version(bool bump_global = true) const noexcept; - - /// Disable copying assignment. - /// - /// It could easily be implemented by calling assign(), but the - /// non-checking nature of the low-level dynamically typed API - /// makes it too risky to offer this feature as an - /// operator. - /// - /// FIXME: assign() has not yet been implemented, but the - /// intention is that it will copy the rows of the argument table - /// into this table after clearing the original contents, and for - /// target tables without a shared spec, it would also copy the - /// spec. For target tables with shared spec, it would be an error - /// to pass an argument table with an incompatible spec, but - /// assign() would not check for spec compatibility. This would - /// make it ideal as a basis for implementing operator=() for - /// typed tables. - Table& operator=(const Table&); - - /// Used when constructing an accessor whose lifetime is going to be managed - /// by reference counting. The lifetime of accessors of free-standing tables - /// allocated on the stack by the application is not managed by reference - /// counting, so that is a case where this tag must **not** be specified. - class ref_count_tag { - }; - - /// Create an uninitialized accessor whose lifetime is managed by reference - /// counting. - Table(ref_count_tag, Allocator&); - - void init(ref_type top_ref, ArrayParent*, size_t ndx_in_parent, bool skip_create_column_accessors = false); - void init(ConstSubspecRef shared_spec, ArrayParent* parent_column, size_t parent_row_ndx); - - static void do_insert_column(Descriptor&, size_t col_ndx, DataType type, StringData name, - LinkTargetInfo& link_target_info, bool nullable = false); - static void do_insert_column_unless_exists(Descriptor&, size_t col_ndx, DataType type, StringData name, - LinkTargetInfo& link, bool nullable = false, - bool* was_inserted = nullptr); - static void do_erase_column(Descriptor&, size_t col_ndx); - static void do_rename_column(Descriptor&, size_t col_ndx, StringData name); - static void do_move_column(Descriptor&, size_t col_ndx_1, size_t col_ndx_2); - - struct InsertSubtableColumns; - struct EraseSubtableColumns; - struct RenameSubtableColumns; - struct MoveSubtableColumns; - - void insert_root_column(size_t col_ndx, DataType type, StringData name, LinkTargetInfo& link_target, - bool nullable = false); - void erase_root_column(size_t col_ndx); - void move_root_column(size_t from, size_t to); - void do_insert_root_column(size_t col_ndx, ColumnType, StringData name, bool nullable = false); - void do_erase_root_column(size_t col_ndx); - void do_move_root_column(size_t from, size_t to); - void do_set_link_type(size_t col_ndx, LinkType); - void insert_backlink_column(size_t origin_table_ndx, size_t origin_col_ndx, size_t backlink_col_ndx); - void erase_backlink_column(size_t origin_table_ndx, size_t origin_col_ndx); - void update_link_target_tables(size_t old_col_ndx_begin, size_t new_col_ndx_begin); - void update_link_target_tables_after_column_move(size_t moved_from, size_t moved_to); - - struct SubtableUpdater { - virtual void update(const SubtableColumn&, Array& subcolumns) = 0; - virtual void update_accessor(Table&) = 0; - virtual ~SubtableUpdater() - { - } - }; - static void update_subtables(Descriptor&, SubtableUpdater*); - void update_subtables(const size_t* col_path_begin, const size_t* col_path_end, SubtableUpdater*); - - struct AccessorUpdater { - virtual void update(Table&) = 0; - virtual void update_parent(Table&) = 0; - virtual ~AccessorUpdater() - { - } - }; - void update_accessors(const size_t* col_path_begin, const size_t* col_path_end, AccessorUpdater&); - - void create_degen_subtab_columns(); - ColumnBase* create_column_accessor(ColumnType, size_t col_ndx, size_t ndx_in_parent); - void destroy_column_accessors() noexcept; - - /// Called in the context of Group::commit() to ensure that - /// attached table accessors stay valid across a commit. Please - /// note that this works only for non-transactional commits. Table - /// accessors obtained during a transaction are always detached - /// when the transaction ends. - void update_from_parent(size_t old_baseline) noexcept; - - // Support function for conversions - void to_string_header(std::ostream& out, std::vector& widths) const; - void to_string_row(size_t row_ndx, std::ostream& out, const std::vector& widths) const; - - // recursive methods called by to_json, to follow links - void to_json(std::ostream& out, size_t link_depth, std::map& renames, - std::vector& followed) const; - void to_json_row(size_t row_ndx, std::ostream& out, size_t link_depth, - std::map& renames, std::vector& followed) const; - void to_json_row(size_t row_ndx, std::ostream& out, size_t link_depth = 0, - std::map* renames = nullptr) const; - - // Detach accessor from underlying table. Caller must ensure that - // a reference count exists upon return, for example by obtaining - // an extra reference count before the call. - // - // This function puts this table accessor into the detached - // state. This detaches it from the underlying structure of array - // nodes. It also recursively detaches accessors for subtables, - // and the type descriptor accessor. When this function returns, - // is_attached() will return false. - // - // This function may be called for a table accessor that is - // already in the detached state (idempotency). - // - // It is also valid to call this function for a table accessor - // that has not yet been detached, but whose underlying structure - // of arrays have changed in an unpredictable/unknown way. This - // kind of change generally happens when a modifying table - // operation fails, and also when one transaction is ended and a - // new one is started. - void detach() noexcept; - - /// Detach and remove all attached row, link list, and subtable - /// accessors. This function does not discard the descriptor accessor, if - /// any, and it does not discard column accessors either. - void discard_child_accessors() noexcept; - - void discard_row_accessors() noexcept; - - // Detach the type descriptor accessor if it exists. - void discard_desc_accessor() noexcept; - - void bind_ptr() const noexcept; - void unbind_ptr() const noexcept; - - void register_view(const TableViewBase* view); - void unregister_view(const TableViewBase* view) noexcept; - void move_registered_view(const TableViewBase* old_addr, const TableViewBase* new_addr) noexcept; - void discard_views() noexcept; - - void register_row_accessor(RowBase*) const noexcept; - void unregister_row_accessor(RowBase*) const noexcept; - void do_unregister_row_accessor(RowBase*) const noexcept; - - class UnbindGuard; - - ColumnType get_real_column_type(size_t column_ndx) const noexcept; - - /// If this table is a group-level table, the parent group is returned, - /// otherwise null is returned. - Group* get_parent_group() const noexcept; - - const ColumnBase& get_column_base(size_t column_ndx) const noexcept; - ColumnBase& get_column_base(size_t column_ndx); - - const ColumnBaseWithIndex& get_column_base_indexed(size_t ndx) const noexcept; - ColumnBaseWithIndex& get_column_base_indexed(size_t ndx); - - template - T& get_column(size_t ndx); - - template - const T& get_column(size_t ndx) const noexcept; - - IntegerColumn& get_column(size_t column_ndx); - const IntegerColumn& get_column(size_t column_ndx) const noexcept; - IntNullColumn& get_column_int_null(size_t column_ndx); - const IntNullColumn& get_column_int_null(size_t column_ndx) const noexcept; - FloatColumn& get_column_float(size_t column_ndx); - const FloatColumn& get_column_float(size_t column_ndx) const noexcept; - DoubleColumn& get_column_double(size_t column_ndx); - const DoubleColumn& get_column_double(size_t column_ndx) const noexcept; - StringColumn& get_column_string(size_t column_ndx); - const StringColumn& get_column_string(size_t column_ndx) const noexcept; - BinaryColumn& get_column_binary(size_t column_ndx); - const BinaryColumn& get_column_binary(size_t column_ndx) const noexcept; - StringEnumColumn& get_column_string_enum(size_t column_ndx); - const StringEnumColumn& get_column_string_enum(size_t column_ndx) const noexcept; - SubtableColumn& get_column_table(size_t column_ndx); - const SubtableColumn& get_column_table(size_t column_ndx) const noexcept; - MixedColumn& get_column_mixed(size_t column_ndx); - const MixedColumn& get_column_mixed(size_t column_ndx) const noexcept; - TimestampColumn& get_column_timestamp(size_t column_ndx); - const TimestampColumn& get_column_timestamp(size_t column_ndx) const noexcept; - const LinkColumnBase& get_column_link_base(size_t ndx) const noexcept; - LinkColumnBase& get_column_link_base(size_t ndx); - const LinkColumn& get_column_link(size_t ndx) const noexcept; - LinkColumn& get_column_link(size_t ndx); - const LinkListColumn& get_column_link_list(size_t ndx) const noexcept; - LinkListColumn& get_column_link_list(size_t ndx); - const BacklinkColumn& get_column_backlink(size_t ndx) const noexcept; - BacklinkColumn& get_column_backlink(size_t ndx); - - void instantiate_before_change(); - void validate_column_type(const ColumnBase& col, ColumnType expected_type, size_t ndx) const; - - static size_t get_size_from_ref(ref_type top_ref, Allocator&) noexcept; - static size_t get_size_from_ref(ref_type spec_ref, ref_type columns_ref, Allocator&) noexcept; - - const Table* get_parent_table_ptr(size_t* column_ndx_out = nullptr) const noexcept; - Table* get_parent_table_ptr(size_t* column_ndx_out = nullptr) noexcept; - - /// Create an empty table with independent spec and return just - /// the reference to the underlying memory. - static ref_type create_empty_table(Allocator&); - - /// Create a column of the specified type, fill it with the - /// specified number of default values, and return just the - /// reference to the underlying memory. - static ref_type create_column(ColumnType column_type, size_t num_default_values, bool nullable, Allocator&); - - /// Construct a copy of the columns array of this table using the - /// specified allocator and return just the ref to that array. - /// - /// In the clone, no string column will be of the enumeration - /// type. - ref_type clone_columns(Allocator&) const; - - /// Construct a complete copy of this table (including its spec) - /// using the specified allocator and return just the ref to the - /// new top array. - ref_type clone(Allocator&) const; - - /// True for `col_type_Link` and `col_type_LinkList`. - static bool is_link_type(ColumnType) noexcept; - - void connect_opposite_link_columns(size_t link_col_ndx, Table& target_table, size_t backlink_col_ndx) noexcept; - - size_t get_num_strong_backlinks(size_t row_ndx) const noexcept; - - //@{ - - /// Cascading removal of strong links. - /// - /// cascade_break_backlinks_to() removes all backlinks pointing to the row - /// at \a row_ndx. Additionally, if this causes the number of **strong** - /// backlinks originating from a particular opposite row (target row of - /// corresponding forward link) to drop to zero, and that row is not already - /// in \a state.rows, then that row is added to \a state.rows, and - /// cascade_break_backlinks_to() is called recursively for it. This - /// operation is the first half of the cascading row removal operation. The - /// second half is performed by passing the resulting contents of \a - /// state.rows to remove_backlink_broken_rows(). - /// - /// Operations that trigger cascading row removal due to explicit removal of - /// one or more rows (the *initiating rows*), should add those rows to \a - /// rows initially, and then call cascade_break_backlinks_to() once for each - /// of them in turn. This is opposed to carrying out the explicit row - /// removals independently, which is also possible, but does require that - /// any initiating rows, that end up in \a state.rows due to link cycles, - /// are removed before passing \a state.rows to - /// remove_backlink_broken_rows(). In the case of clear(), where all rows of - /// a table are explicitly removed, it is better to use - /// cascade_break_backlinks_to_all_rows(), and then carry out the table - /// clearing as an independent step. For operations that trigger cascading - /// row removal for other reasons than explicit row removal, \a state.rows - /// must be empty initially, but cascade_break_backlinks_to() must still be - /// called for each of the initiating rows. - /// - /// When the last non-recursive invocation of cascade_break_backlinks_to() - /// returns, all forward links originating from a row in \a state.rows have - /// had their reciprocal backlinks removed, so remove_backlink_broken_rows() - /// does not perform reciprocal backlink removal at all. Additionally, all - /// remaining backlinks originating from rows in \a state.rows are - /// guaranteed to point to rows that are **not** in \a state.rows. This is - /// true because any backlink that was pointing to a row in \a state.rows - /// has been removed by one of the invocations of - /// cascade_break_backlinks_to(). The set of forward links, that correspond - /// to these remaining backlinks, is precisely the set of forward links that - /// need to be removed/nullified by remove_backlink_broken_rows(), which it - /// does by way of reciprocal forward link removal. Note also, that while - /// all the rows in \a state.rows can have remaining **weak** backlinks - /// originating from them, only the initiating rows in \a state.rows can - /// have remaining **strong** backlinks originating from them. This is true - /// because a non-initiating row is added to \a state.rows only when the - /// last backlink originating from it is lost. - /// - /// Each row removal is replicated individually (as opposed to one - /// replication instruction for the entire cascading operation). This is - /// done because it provides an easy way for Group::advance_transact() to - /// know which tables are affected by the cascade. Note that this has - /// several important consequences: First of all, the replication log - /// receiver must execute the row removal instructions in a non-cascading - /// fashion, meaning that there will be an asymmetry between the two sides - /// in how the effect of the cascade is brought about. While this is fine - /// for simple 1-to-1 replication, it may end up interfering badly with - /// *transaction merging*, when that feature is introduced. Imagine for - /// example that the cascade initiating operation gets canceled during - /// conflict resolution, but some, or all of the induced row removals get to - /// stay. That would break causal consistency. It is important, however, for - /// transaction merging that the cascaded row removals are explicitly - /// mentioned in the replication log, such that they can be used to adjust - /// row indexes during the *operational transform*. - /// - /// cascade_break_backlinks_to_all_rows() has the same affect as calling - /// cascade_break_backlinks_to() once for each row in the table. When - /// calling this function, \a state.stop_on_table must be set to the origin - /// table (origin table of corresponding forward links), and \a - /// state.stop_on_link_list_column must be null. - /// - /// It is immaterial which table remove_backlink_broken_rows() is called on, - /// as long it that table is in the same group as the removed rows. - - void cascade_break_backlinks_to(size_t row_ndx, CascadeState& state); - void cascade_break_backlinks_to_all_rows(CascadeState& state); - void remove_backlink_broken_rows(const CascadeState&); - - //@} - - /// Used by query. Follows chain of link columns and returns final target table - const Table* get_link_chain_target(const std::vector& link_chain) const; - - /// Remove the specified row by the 'move last over' method. - void do_move_last_over(size_t row_ndx); - - // Precondition: 1 <= end - begin - size_t* record_subtable_path(size_t* begin, size_t* end) const noexcept; - - /// Check if an accessor exists for the specified subtable. If it does, - /// return a pointer to it, otherwise return null. This function assumes - /// that the specified column index in a valid index into `m_cols` but does - /// not otherwise assume more than minimal accessor consistency (see - /// AccessorConsistencyLevels.) - Table* get_subtable_accessor(size_t col_ndx, size_t row_ndx) noexcept; - - /// Unless the column accessor is missing, this function returns the - /// accessor for the target table of the specified link-type column. The - /// column accessor is said to be missing if `m_cols[col_ndx]` is null, and - /// this can happen only during certain operations such as the updating of - /// the accessor tree when a read transaction is advanced. Note that for - /// link type columns, the target table accessor exists when, and only when - /// the origin table accessor exists. This function assumes that the - /// specified column index in a valid index into `m_cols` and that the - /// column is a link-type column. Beyond that, it assume nothing more than - /// minimal accessor consistency (see AccessorConsistencyLevels.) - Table* get_link_target_table_accessor(size_t col_ndx) noexcept; - - void discard_subtable_accessor(size_t col_ndx, size_t row_ndx) noexcept; - - void adj_acc_insert_rows(size_t row_ndx, size_t num_rows) noexcept; - void adj_acc_erase_row(size_t row_ndx) noexcept; - void adj_acc_swap_rows(size_t row_ndx_1, size_t row_ndx_2) noexcept; - void adj_acc_merge_rows(size_t old_row_ndx, size_t new_row_ndx) noexcept; - - /// Adjust this table accessor and its subordinates after move_last_over() - /// (or its inverse). - /// - /// First, any row, subtable, or link list accessors registered as being at - /// \a to_row_ndx will be detached, as that row is assumed to have been - /// replaced. Next, any row, subtable, or link list accessors registered as - /// being at \a from_row_ndx, will be reregistered as being at \a - /// to_row_ndx, as the row at \a from_row_ndx is assumed to have been moved - /// to \a to_row_ndx. - /// - /// Crucially, if \a to_row_ndx is equal to \a from_row_ndx, then row, - /// subtable, or link list accessors at that row are **still detached**. - /// - /// Additionally, this function causes all link-adjacent tables to be marked - /// (dirty). Two tables are link-adjacent if one is the target table of a - /// link column of the other table. Note that this marking follows these - /// relations in both directions, but only to a depth of one. - /// - /// When this function is used in connection with move_last_over(), set \a - /// to_row_ndx to the index of the row to be removed, and set \a - /// from_row_ndx to the index of the last row in the table. As mentioned - /// earlier, this function can also be used in connection with the **inverse - /// of** move_last_over(), which is an operation that vacates a row by - /// moving its contents into a new last row of the table. In that case, set - /// \a to_row_ndx to one plus the index of the last row in the table, and - /// set \a from_row_ndx to the index of the row to be vacated. - /// - /// This function is used as part of Table::refresh_accessor_tree() to - /// promote the state of the accessors from Minimal Consistency into - /// Structural Correspondence, so it must be able to execute without - /// accessing the underlying array nodes. - void adj_acc_move_over(size_t from_row_ndx, size_t to_row_ndx) noexcept; - - void adj_acc_clear_root_table() noexcept; - void adj_acc_clear_nonroot_table() noexcept; - void adj_row_acc_insert_rows(size_t row_ndx, size_t num_rows) noexcept; - void adj_row_acc_erase_row(size_t row_ndx) noexcept; - void adj_row_acc_swap_rows(size_t row_ndx_1, size_t row_ndx_2) noexcept; - void adj_row_acc_merge_rows(size_t old_row_ndx, size_t new_row_ndx) noexcept; - - /// Called by adj_acc_move_over() to adjust row accessors. - void adj_row_acc_move_over(size_t from_row_ndx, size_t to_row_ndx) noexcept; - - void adj_insert_column(size_t col_ndx); - void adj_erase_column(size_t col_ndx) noexcept; - void adj_move_column(size_t col_ndx_1, size_t col_ndx_2) noexcept; - - bool is_marked() const noexcept; - void mark() noexcept; - void unmark() noexcept; - void recursive_mark() noexcept; - void mark_link_target_tables(size_t col_ndx_begin) noexcept; - void mark_opposite_link_tables() noexcept; - - Replication* get_repl() noexcept; - - void set_ndx_in_parent(size_t ndx_in_parent) noexcept; - - /// Refresh the part of the accessor tree that is rooted at this - /// table. Subtable accessors will be refreshed only if they are marked - /// (Table::m_mark), and this applies recursively to subtables of - /// subtables. All refreshed table accessors (including this one) will be - /// unmarked upon return. - /// - /// The following conditions are necessary and sufficient for the proper - /// operation of this function: - /// - /// - This table must be a group-level table, or a subtable. It must not be - /// a free-standing table (because a free-standing table has no parent). - /// - /// - The `index in parent` property is correct. The `index in parent` - /// property of the table is the `index in parent` property of - /// `m_columns` for subtables with shared descriptor, and the `index in - /// parent` property of `m_top` for all other tables. - /// - /// - If this table has shared descriptor, then the `index in parent` - /// property of the contained spec accessor is correct. - /// - /// - The parent accessor is in a valid state (already refreshed). If the - /// parent is a group, then the group accessor (excluding its table - /// accessors) must be in a valid state. If the parent is a table, then - /// the table accessor (excluding its subtable accessors) must be in a - /// valid state. - /// - /// - Every descendant subtable accessor is marked if it needs to be - /// refreshed, or if it has a descendant accessor that needs to be - /// refreshed. - /// - /// - This table accessor, as well as all its descendant accessors, are in - /// structural correspondence with the underlying node hierarchy whose - /// root ref is stored in the parent (see AccessorConsistencyLevels). - void refresh_accessor_tree(); - - void refresh_column_accessors(size_t col_ndx_begin = 0); - - // Look for link columns starting from col_ndx_begin. - // If a link column is found, follow the link and update it's - // backlink column accessor if it is in different table. - void refresh_link_target_accessors(size_t col_ndx_begin = 0); - - bool is_cross_table_link_target() const noexcept; - -#ifdef REALM_DEBUG - void to_dot_internal(std::ostream&) const; -#endif - - friend class SubtableNode; - friend class _impl::TableFriend; - friend class Query; - template - friend class util::bind_ptr; - template - friend class SimpleQuerySupport; - friend class LangBindHelper; - friend class TableViewBase; - template - friend class Columns; - friend class Columns; - friend class ParentNode; - template - friend class SequentialGetter; - friend class RowBase; - friend class LinksToNode; - friend class LinkMap; - friend class LinkView; - friend class Group; -}; - - -class Table::Parent : public ArrayParent { -public: - ~Parent() noexcept override - { - } - -protected: - virtual StringData get_child_name(size_t child_ndx) const noexcept; - - /// If children are group-level tables, then this function returns the - /// group. Otherwise it returns null. - virtual Group* get_parent_group() noexcept; - - /// If children are subtables, then this function returns the - /// parent table. Otherwise it returns null. - /// - /// If \a column_ndx_out is not null, this function must assign the index of - /// the column within the parent table to `*column_ndx_out` when , and only - /// when this table parent is a column in a parent table. - virtual Table* get_parent_table(size_t* column_ndx_out = nullptr) noexcept; - - /// Must be called whenever a child table accessor is about to be destroyed. - /// - /// Note that the argument is a pointer to the child Table rather than its - /// `ndx_in_parent` property. This is because only minimal accessor - /// consistency can be assumed by this function. - virtual void child_accessor_destroyed(Table* child) noexcept = 0; - - virtual size_t* record_subtable_path(size_t* begin, size_t* end) noexcept; - - friend class Table; -}; - - -// Implementation: - - -inline uint_fast64_t Table::get_version_counter() const noexcept -{ - return m_version; -} - -inline void Table::bump_version(bool bump_global) const noexcept -{ - if (bump_global) { - // This is only set on initial entry through an operation on the same - // table. recursive calls (via parent or via backlinks) must be done - // with bump_global=false. - m_top.get_alloc().bump_global_version(); - } - if (m_top.get_alloc().should_propagate_version(m_version)) { - if (const Table* parent = get_parent_table_ptr()) - parent->bump_version(false); - // Recurse through linked tables, use m_mark to avoid infinite recursion - for (auto& column_ptr : m_cols) { - // We may meet a null pointer in place of a backlink column, pending - // replacement with a new one. This can happen ONLY when creation of - // the corresponding forward link column in the origin table is - // pending as well. In this case it is ok to just ignore the zeroed - // backlink column, because the origin table is guaranteed to also - // be refreshed/marked dirty and hence have it's version bumped. - if (column_ptr != nullptr) - column_ptr->bump_link_origin_table_version(); - } - } -} - -inline void Table::remove(size_t row_ndx) -{ - bool is_move_last_over = false; - erase_row(row_ndx, is_move_last_over); // Throws -} - -inline void Table::move_last_over(size_t row_ndx) -{ - bool is_move_last_over = true; - erase_row(row_ndx, is_move_last_over); // Throws -} - -inline void Table::remove_last() -{ - if (!is_empty()) - remove(size() - 1); -} - -// A good place to start if you want to understand the memory ordering -// chosen for the operations below is http://preshing.com/20130922/acquire-and-release-fences/ -inline void Table::bind_ptr() const noexcept -{ - m_ref_count.fetch_add(1, std::memory_order_relaxed); -} - -inline void Table::unbind_ptr() const noexcept -{ - // The delete operation runs the destructor, and the destructor - // must always see all changes to the object being deleted. - // Within each thread, we know that unbind_ptr will always happen after - // any changes, so it is a convenient place to do a release. - // The release will then be observed by the acquire fence in - // the case where delete is actually called (the count reaches 0) - if (m_ref_count.fetch_sub(1, std::memory_order_release) != 1) - return; - - std::atomic_thread_fence(std::memory_order_acquire); - delete this; -} - -inline void Table::register_view(const TableViewBase* view) -{ - util::LockGuard lock(m_accessor_mutex); - // Casting away constness here - operations done on tableviews - // through m_views are all internal and preserving "some" kind - // of logical constness. - m_views.push_back(const_cast(view)); -} - -inline bool Table::is_attached() const noexcept -{ - // Note that it is not possible to tie the state of attachment of a table to - // the state of attachment of m_top, because tables with shared spec do not - // have a 'top' array. Neither is it possible to tie it to the state of - // attachment of m_columns, because subtables with shared spec start out in - // a degenerate form where they do not have a 'columns' array. For these - // reasons, it is neccessary to define the notion of attachment for a table - // as follows: A table is attached if, and ony if m_column stores a non-null - // parent pointer. This works because even for degenerate subtables, - // m_columns is initialized with the correct parent pointer. - return m_columns.has_parent(); -} - -inline StringData Table::get_name() const noexcept -{ - REALM_ASSERT(is_attached()); - const Array& real_top = m_top.is_attached() ? m_top : m_columns; - ArrayParent* parent = real_top.get_parent(); - if (!parent) - return StringData(""); - size_t index_in_parent = real_top.get_ndx_in_parent(); - REALM_ASSERT(dynamic_cast(parent)); - return static_cast(parent)->get_child_name(index_in_parent); -} - -inline size_t Table::get_column_count() const noexcept -{ - REALM_ASSERT(is_attached()); - return m_spec.get_public_column_count(); -} - -inline StringData Table::get_column_name(size_t ndx) const noexcept -{ - REALM_ASSERT_3(ndx, <, get_column_count()); - return m_spec.get_column_name(ndx); -} - -inline size_t Table::get_column_index(StringData name) const noexcept -{ - REALM_ASSERT(is_attached()); - return m_spec.get_column_index(name); -} - -inline ColumnType Table::get_real_column_type(size_t ndx) const noexcept -{ - REALM_ASSERT_3(ndx, <, m_spec.get_column_count()); - return m_spec.get_column_type(ndx); -} - -inline DataType Table::get_column_type(size_t ndx) const noexcept -{ - REALM_ASSERT_3(ndx, <, m_spec.get_column_count()); - return m_spec.get_public_column_type(ndx); -} - -template -inline Col& Table::get_column(size_t ndx) -{ - ColumnBase& col = get_column_base(ndx); -#ifdef REALM_DEBUG - validate_column_type(col, col_type, ndx); -#endif - REALM_ASSERT(typeid(Col) == typeid(col)); - return static_cast(col); -} - -template -inline const Col& Table::get_column(size_t ndx) const noexcept -{ - const ColumnBase& col = get_column_base(ndx); -#ifdef REALM_DEBUG - validate_column_type(col, col_type, ndx); -#endif - REALM_ASSERT(typeid(Col) == typeid(col)); - return static_cast(col); -} - -inline bool Table::has_shared_type() const noexcept -{ - REALM_ASSERT(is_attached()); - return !m_top.is_attached(); -} - - -class Table::UnbindGuard { -public: - UnbindGuard(Table* table) noexcept - : m_table(table) - { - } - - ~UnbindGuard() noexcept - { - if (m_table) - m_table->unbind_ptr(); - } - - Table& operator*() const noexcept - { - return *m_table; - } - - Table* operator->() const noexcept - { - return m_table; - } - - Table* get() const noexcept - { - return m_table; - } - - Table* release() noexcept - { - Table* table = m_table; - m_table = nullptr; - return table; - } - -private: - Table* m_table; -}; - - -inline Table::Table(Allocator& alloc) - : m_top(alloc) - , m_columns(alloc) - , m_spec(alloc) -{ - m_ref_count = 1; // Explicitely managed lifetime - - ref_type ref = create_empty_table(alloc); // Throws - Parent* parent = nullptr; - size_t ndx_in_parent = 0; - init(ref, parent, ndx_in_parent); -} - -inline Table::Table(const Table& t, Allocator& alloc) - : m_top(alloc) - , m_columns(alloc) - , m_spec(alloc) -{ - m_ref_count = 1; // Explicitely managed lifetime - - ref_type ref = t.clone(alloc); // Throws - Parent* parent = nullptr; - size_t ndx_in_parent = 0; - init(ref, parent, ndx_in_parent); -} - -inline Table::Table(ref_count_tag, Allocator& alloc) - : m_top(alloc) - , m_columns(alloc) - , m_spec(alloc) -{ - m_ref_count = 0; // Lifetime managed by reference counting -} - -inline Allocator& Table::get_alloc() const -{ - return m_top.get_alloc(); -} - -inline TableRef Table::create(Allocator& alloc) -{ - std::unique_ptr
table(new Table(ref_count_tag(), alloc)); // Throws - ref_type ref = create_empty_table(alloc); // Throws - Parent* parent = nullptr; - size_t ndx_in_parent = 0; - table->init(ref, parent, ndx_in_parent); // Throws - return table.release()->get_table_ref(); -} - -inline TableRef Table::copy(Allocator& alloc) const -{ - std::unique_ptr
table(new Table(ref_count_tag(), alloc)); // Throws - ref_type ref = clone(alloc); // Throws - Parent* parent = nullptr; - size_t ndx_in_parent = 0; - table->init(ref, parent, ndx_in_parent); // Throws - return table.release()->get_table_ref(); -} - -// For use by queries -template -inline Columns Table::column(size_t column_ndx) -{ - std::vector link_chain = std::move(m_link_chain); - m_link_chain.clear(); - - // Check if user-given template type equals Realm type. Todo, we should clean up and reuse all our - // type traits (all the is_same() cases below). - const Table* table = get_link_chain_target(link_chain); - - realm::DataType ct = table->get_column_type(column_ndx); - if (std::is_same::value && ct != type_Int) - throw(LogicError::type_mismatch); - else if (std::is_same::value && ct != type_Bool) - throw(LogicError::type_mismatch); - else if (std::is_same::value && ct != type_OldDateTime) - throw(LogicError::type_mismatch); - else if (std::is_same::value && ct != type_Float) - throw(LogicError::type_mismatch); - else if (std::is_same::value && ct != type_Double) - throw(LogicError::type_mismatch); - - if (std::is_same::value || std::is_same::value || std::is_same::value) { - link_chain.push_back(column_ndx); - } - - return Columns(column_ndx, this, std::move(link_chain)); -} - -template -inline Columns Table::column(const Table& origin, size_t origin_col_ndx) -{ - static_assert(std::is_same::value, ""); - - size_t origin_table_ndx = origin.get_index_in_group(); - const Table& current_target_table = *get_link_chain_target(m_link_chain); - size_t backlink_col_ndx = current_target_table.m_spec.find_backlink_column(origin_table_ndx, origin_col_ndx); - - std::vector link_chain = std::move(m_link_chain); - m_link_chain.clear(); - link_chain.push_back(backlink_col_ndx); - - return Columns(backlink_col_ndx, this, std::move(link_chain)); -} - -template -SubQuery Table::column(size_t column_ndx, Query subquery) -{ - static_assert(std::is_same::value, "A subquery must involve a link list or backlink column"); - return SubQuery(column(column_ndx), std::move(subquery)); -} - -template -SubQuery Table::column(const Table& origin, size_t origin_col_ndx, Query subquery) -{ - static_assert(std::is_same::value, "A subquery must involve a link list or backlink column"); - return SubQuery(column(origin, origin_col_ndx), std::move(subquery)); -} - -// For use by queries -inline Table& Table::link(size_t link_column) -{ - m_link_chain.push_back(link_column); - return *this; -} - -inline Table& Table::backlink(const Table& origin, size_t origin_col_ndx) -{ - size_t origin_table_ndx = origin.get_index_in_group(); - const Table& current_target_table = *get_link_chain_target(m_link_chain); - size_t backlink_col_ndx = current_target_table.m_spec.find_backlink_column(origin_table_ndx, origin_col_ndx); - return link(backlink_col_ndx); -} - -inline bool Table::is_empty() const noexcept -{ - return m_size == 0; -} - -inline size_t Table::size() const noexcept -{ - return m_size; -} - -inline Table::RowExpr Table::get(size_t row_ndx) noexcept -{ - REALM_ASSERT_3(row_ndx, <, size()); - return RowExpr(this, row_ndx); -} - -inline Table::ConstRowExpr Table::get(size_t row_ndx) const noexcept -{ - REALM_ASSERT_3(row_ndx, <, size()); - return ConstRowExpr(this, row_ndx); -} - -inline Table::RowExpr Table::front() noexcept -{ - return get(0); -} - -inline Table::ConstRowExpr Table::front() const noexcept -{ - return get(0); -} - -inline Table::RowExpr Table::back() noexcept -{ - return get(m_size - 1); -} - -inline Table::ConstRowExpr Table::back() const noexcept -{ - return get(m_size - 1); -} - -inline Table::RowExpr Table::operator[](size_t row_ndx) noexcept -{ - return get(row_ndx); -} - -inline Table::ConstRowExpr Table::operator[](size_t row_ndx) const noexcept -{ - return get(row_ndx); -} - -inline size_t Table::add_empty_row(size_t num_rows) -{ - size_t row_ndx = m_size; - insert_empty_row(row_ndx, num_rows); // Throws - return row_ndx; // Return index of first new row -} - -inline const Table* Table::get_subtable_ptr(size_t col_ndx, size_t row_ndx) const -{ - return const_cast(this)->get_subtable_ptr(col_ndx, row_ndx); // Throws -} - -inline bool Table::is_null_link(size_t col_ndx, size_t row_ndx) const noexcept -{ - return get_link(col_ndx, row_ndx) == realm::npos; -} - -inline ConstTableRef Table::get_link_target(size_t col_ndx) const noexcept -{ - return const_cast(this)->get_link_target(col_ndx); -} - -template -inline void Table::set_enum(size_t column_ndx, size_t row_ndx, E value) -{ - set_int(column_ndx, row_ndx, value); -} - -inline void Table::nullify_link(size_t col_ndx, size_t row_ndx) -{ - set_link(col_ndx, row_ndx, realm::npos); -} - -inline TableRef Table::get_subtable(size_t column_ndx, size_t row_ndx) -{ - return TableRef(get_subtable_ptr(column_ndx, row_ndx)); -} - -inline ConstTableRef Table::get_subtable(size_t column_ndx, size_t row_ndx) const -{ - return ConstTableRef(get_subtable_ptr(column_ndx, row_ndx)); -} - -inline ConstTableRef Table::get_parent_table(size_t* column_ndx_out) const noexcept -{ - return ConstTableRef(get_parent_table_ptr(column_ndx_out)); -} - -inline TableRef Table::get_parent_table(size_t* column_ndx_out) noexcept -{ - return TableRef(get_parent_table_ptr(column_ndx_out)); -} - -inline bool Table::is_group_level() const noexcept -{ - return bool(get_parent_group()); -} - -inline bool Table::operator==(const Table& t) const -{ - return m_spec == t.m_spec && compare_rows(t); // Throws -} - -inline bool Table::operator!=(const Table& t) const -{ - return !(*this == t); // Throws -} - -inline bool Table::is_degenerate() const noexcept -{ - return !m_columns.is_attached(); -} - -inline void Table::set_into_mixed(Table* parent, size_t col_ndx, size_t row_ndx) const -{ - parent->set_mixed_subtable(col_ndx, row_ndx, this); -} - -inline size_t Table::get_size_from_ref(ref_type top_ref, Allocator& alloc) noexcept -{ - const char* top_header = alloc.translate(top_ref); - std::pair p = Array::get_two(top_header, 0); - ref_type spec_ref = to_ref(p.first), columns_ref = to_ref(p.second); - return get_size_from_ref(spec_ref, columns_ref, alloc); -} - -inline Table* Table::get_parent_table_ptr(size_t* column_ndx_out) noexcept -{ - const Table* parent = const_cast(this)->get_parent_table_ptr(column_ndx_out); - return const_cast(parent); -} - -inline bool Table::is_link_type(ColumnType col_type) noexcept -{ - return col_type == col_type_Link || col_type == col_type_LinkList; -} - -inline size_t* Table::record_subtable_path(size_t* begin, size_t* end) const noexcept -{ - const Array& real_top = m_top.is_attached() ? m_top : m_columns; - size_t index_in_parent = real_top.get_ndx_in_parent(); - REALM_ASSERT_3(begin, <, end); - *begin++ = index_in_parent; - ArrayParent* parent = real_top.get_parent(); - REALM_ASSERT(parent); - REALM_ASSERT(dynamic_cast(parent)); - return static_cast(parent)->record_subtable_path(begin, end); -} - -inline size_t* Table::Parent::record_subtable_path(size_t* begin, size_t*) noexcept -{ - return begin; -} - -template -typename T::RowAccessor Table::get_link_accessor(size_t column_ndx, size_t row_ndx) -{ - size_t row_pos_in_target = get_link(column_ndx, row_ndx); - TableRef target_table = get_link_target(column_ndx); - - Table* table = &*target_table; - T* typed_table = reinterpret_cast(table); - return (*typed_table)[row_pos_in_target]; -} - -inline bool Table::is_marked() const noexcept -{ - return m_mark; -} - -inline void Table::mark() noexcept -{ - m_mark = true; -} - -inline void Table::unmark() noexcept -{ - m_mark = false; -} - -inline Replication* Table::get_repl() noexcept -{ - return m_top.get_alloc().get_replication(); -} - -inline void Table::set_ndx_in_parent(size_t ndx_in_parent) noexcept -{ - if (m_top.is_attached()) { - // Root table (independent descriptor) - m_top.set_ndx_in_parent(ndx_in_parent); - } - else { - // Subtable with shared descriptor - m_columns.set_ndx_in_parent(ndx_in_parent); - } -} - -// This class groups together information about the target of a link column -// This is not a valid link if the target table == nullptr -struct LinkTargetInfo { - LinkTargetInfo(Table* target = nullptr, size_t backlink_ndx = realm::npos) - : m_target_table(target) - , m_backlink_col_ndx(backlink_ndx) - { - } - bool is_valid() const - { - return (m_target_table != nullptr); - } - Table* m_target_table; - size_t m_backlink_col_ndx; // a value of npos indicates the backlink should be appended -}; - -// The purpose of this class is to give internal access to some, but -// not all of the non-public parts of the Table class. -class _impl::TableFriend { -public: - typedef Table::UnbindGuard UnbindGuard; - - static ref_type create_empty_table(Allocator& alloc) - { - return Table::create_empty_table(alloc); // Throws - } - - static ref_type clone(const Table& table, Allocator& alloc) - { - return table.clone(alloc); // Throws - } - - static ref_type clone_columns(const Table& table, Allocator& alloc) - { - return table.clone_columns(alloc); // Throws - } - - static Table* create_accessor(Allocator& alloc, ref_type top_ref, Table::Parent* parent, size_t ndx_in_parent) - { - std::unique_ptr
table(new Table(Table::ref_count_tag(), alloc)); // Throws - table->init(top_ref, parent, ndx_in_parent); // Throws - return table.release(); - } - - static Table* create_accessor(ConstSubspecRef shared_spec, Table::Parent* parent_column, size_t parent_row_ndx) - { - Allocator& alloc = shared_spec.get_alloc(); - std::unique_ptr
table(new Table(Table::ref_count_tag(), alloc)); // Throws - table->init(shared_spec, parent_column, parent_row_ndx); // Throws - return table.release(); - } - - // Intended to be used only by Group::create_table_accessor() - static Table* create_incomplete_accessor(Allocator& alloc, ref_type top_ref, Table::Parent* parent, - size_t ndx_in_parent) - { - std::unique_ptr
table(new Table(Table::ref_count_tag(), alloc)); // Throws - bool skip_create_column_accessors = true; - table->init(top_ref, parent, ndx_in_parent, skip_create_column_accessors); // Throws - return table.release(); - } - - // Intended to be used only by Group::create_table_accessor() - static void complete_accessor(Table& table) - { - table.refresh_column_accessors(); // Throws - } - - static void set_top_parent(Table& table, ArrayParent* parent, size_t ndx_in_parent) noexcept - { - table.m_top.set_parent(parent, ndx_in_parent); - } - - static void update_from_parent(Table& table, size_t old_baseline) noexcept - { - table.update_from_parent(old_baseline); - } - - static void detach(Table& table) noexcept - { - table.detach(); - } - - static void discard_row_accessors(Table& table) noexcept - { - table.discard_row_accessors(); - } - - static void discard_child_accessors(Table& table) noexcept - { - table.discard_child_accessors(); - } - - static void discard_subtable_accessor(Table& table, size_t col_ndx, size_t row_ndx) noexcept - { - table.discard_subtable_accessor(col_ndx, row_ndx); - } - - static void bind_ptr(Table& table) noexcept - { - table.bind_ptr(); - } - - static void unbind_ptr(Table& table) noexcept - { - table.unbind_ptr(); - } - - static bool compare_rows(const Table& a, const Table& b) - { - return a.compare_rows(b); // Throws - } - - static size_t get_size_from_ref(ref_type ref, Allocator& alloc) noexcept - { - return Table::get_size_from_ref(ref, alloc); - } - - static size_t get_size_from_ref(ref_type spec_ref, ref_type columns_ref, Allocator& alloc) noexcept - { - return Table::get_size_from_ref(spec_ref, columns_ref, alloc); - } - - static Spec& get_spec(Table& table) noexcept - { - return table.m_spec; - } - - static const Spec& get_spec(const Table& table) noexcept - { - return table.m_spec; - } - - static ColumnBase& get_column(const Table& table, size_t col_ndx) - { - return *table.m_cols[col_ndx]; - } - - static void do_remove(Table& table, size_t row_ndx) - { - bool broken_reciprocal_backlinks = false; - table.do_remove(row_ndx, broken_reciprocal_backlinks); // Throws - } - - static void do_move_last_over(Table& table, size_t row_ndx) - { - bool broken_reciprocal_backlinks = false; - table.do_move_last_over(row_ndx, broken_reciprocal_backlinks); // Throws - } - - static void do_swap_rows(Table& table, size_t row_ndx_1, size_t row_ndx_2) - { - table.do_swap_rows(row_ndx_1, row_ndx_2); // Throws - } - - static void do_merge_rows(Table& table, size_t row_ndx, size_t new_row_ndx) - { - table.do_merge_rows(row_ndx, new_row_ndx); // Throws - } - - static void do_clear(Table& table) - { - bool broken_reciprocal_backlinks = false; - table.do_clear(broken_reciprocal_backlinks); // Throws - } - - static void do_set_link(Table& table, size_t col_ndx, size_t row_ndx, size_t target_row_ndx) - { - table.do_set_link(col_ndx, row_ndx, target_row_ndx); // Throws - } - - static size_t get_num_strong_backlinks(const Table& table, size_t row_ndx) noexcept - { - return table.get_num_strong_backlinks(row_ndx); - } - - static void cascade_break_backlinks_to(Table& table, size_t row_ndx, CascadeState& state) - { - table.cascade_break_backlinks_to(row_ndx, state); // Throws - } - - static void remove_backlink_broken_rows(Table& table, const CascadeState& rows) - { - table.remove_backlink_broken_rows(rows); // Throws - } - - static size_t* record_subtable_path(const Table& table, size_t* begin, size_t* end) noexcept - { - return table.record_subtable_path(begin, end); - } - - static void insert_column(Descriptor& desc, size_t column_ndx, DataType type, StringData name, - LinkTargetInfo& link, bool nullable = false) - { - Table::do_insert_column(desc, column_ndx, type, name, link, nullable); // Throws - } - - static void insert_column_unless_exists(Descriptor& desc, size_t column_ndx, DataType type, StringData name, - LinkTargetInfo link, bool nullable = false, bool* was_inserted = nullptr) - { - Table::do_insert_column_unless_exists(desc, column_ndx, type, name, link, nullable, was_inserted); // Throws - } - - static void erase_column(Descriptor& desc, size_t column_ndx) - { - Table::do_erase_column(desc, column_ndx); // Throws - } - - static void rename_column(Descriptor& desc, size_t column_ndx, StringData name) - { - Table::do_rename_column(desc, column_ndx, name); // Throws - } - - static void move_column(Descriptor& desc, size_t col_ndx_1, size_t col_ndx_2) - { - Table::do_move_column(desc, col_ndx_1, col_ndx_2); // Throws - } - - static void set_link_type(Table& table, size_t column_ndx, LinkType link_type) - { - table.do_set_link_type(column_ndx, link_type); // Throws - } - - static void erase_row(Table& table, size_t row_ndx, bool is_move_last_over) - { - table.erase_row(row_ndx, is_move_last_over); // Throws - } - - static void batch_erase_rows(Table& table, const IntegerColumn& row_indexes, bool is_move_last_over) - { - table.batch_erase_rows(row_indexes, is_move_last_over); // Throws - } - - static Table* get_subtable_accessor(Table& table, size_t col_ndx, size_t row_ndx) noexcept - { - return table.get_subtable_accessor(col_ndx, row_ndx); - } - - static const Table* get_link_target_table_accessor(const Table& table, size_t col_ndx) noexcept - { - return const_cast(table).get_link_target_table_accessor(col_ndx); - } - - static Table* get_link_target_table_accessor(Table& table, size_t col_ndx) noexcept - { - return table.get_link_target_table_accessor(col_ndx); - } - - static void adj_acc_insert_rows(Table& table, size_t row_ndx, size_t num_rows) noexcept - { - table.adj_acc_insert_rows(row_ndx, num_rows); - } - - static void adj_acc_erase_row(Table& table, size_t row_ndx) noexcept - { - table.adj_acc_erase_row(row_ndx); - } - - static void adj_acc_swap_rows(Table& table, size_t row_ndx_1, size_t row_ndx_2) noexcept - { - table.adj_acc_swap_rows(row_ndx_1, row_ndx_2); - } - - static void adj_acc_merge_rows(Table& table, size_t row_ndx_1, size_t row_ndx_2) noexcept - { - table.adj_acc_merge_rows(row_ndx_1, row_ndx_2); - } - - static void adj_acc_move_over(Table& table, size_t from_row_ndx, size_t to_row_ndx) noexcept - { - table.adj_acc_move_over(from_row_ndx, to_row_ndx); - } - - static void adj_acc_clear_root_table(Table& table) noexcept - { - table.adj_acc_clear_root_table(); - } - - static void adj_acc_clear_nonroot_table(Table& table) noexcept - { - table.adj_acc_clear_nonroot_table(); - } - - static void adj_insert_column(Table& table, size_t col_ndx) - { - table.adj_insert_column(col_ndx); // Throws - } - - static void adj_add_column(Table& table) - { - size_t num_cols = table.m_cols.size(); - table.adj_insert_column(num_cols); // Throws - } - - static void adj_erase_column(Table& table, size_t col_ndx) noexcept - { - table.adj_erase_column(col_ndx); - } - - static void adj_move_column(Table& table, size_t col_ndx_1, size_t col_ndx_2) noexcept - { - table.adj_move_column(col_ndx_1, col_ndx_2); - } - - static bool is_marked(const Table& table) noexcept - { - return table.is_marked(); - } - - static void mark(Table& table) noexcept - { - table.mark(); - } - - static void unmark(Table& table) noexcept - { - table.unmark(); - } - - static void recursive_mark(Table& table) noexcept - { - table.recursive_mark(); - } - - static void mark_link_target_tables(Table& table, size_t col_ndx_begin) noexcept - { - table.mark_link_target_tables(col_ndx_begin); - } - - static void mark_opposite_link_tables(Table& table) noexcept - { - table.mark_opposite_link_tables(); - } - - static DescriptorRef get_root_table_desc_accessor(Table& root_table) noexcept - { - return root_table.m_descriptor.lock(); - } - - typedef Table::AccessorUpdater AccessorUpdater; - static void update_accessors(Table& table, const size_t* col_path_begin, const size_t* col_path_end, - AccessorUpdater& updater) - { - table.update_accessors(col_path_begin, col_path_end, updater); // Throws - } - - static void refresh_accessor_tree(Table& table) - { - table.refresh_accessor_tree(); // Throws - } - - static void set_ndx_in_parent(Table& table, size_t ndx_in_parent) noexcept - { - table.set_ndx_in_parent(ndx_in_parent); - } - - static void set_shared_subspec_ndx_in_parent(Table& table, size_t spec_ndx_in_parent) noexcept - { - table.m_spec.set_ndx_in_parent(spec_ndx_in_parent); - } - - static bool is_link_type(ColumnType type) noexcept - { - return Table::is_link_type(type); - } - - static void bump_version(Table& table, bool bump_global = true) noexcept - { - table.bump_version(bump_global); - } - - static bool is_cross_table_link_target(const Table& table) - { - return table.is_cross_table_link_target(); - } - - static Group* get_parent_group(const Table& table) noexcept - { - return table.get_parent_group(); - } - - static Replication* get_repl(Table& table) noexcept - { - return table.get_repl(); - } - - static void register_view(Table& table, const TableViewBase* view) - { - table.register_view(view); // Throws - } - - static void unregister_view(Table& table, const TableViewBase* view) noexcept - { - table.unregister_view(view); - } -}; - - -} // namespace realm - -#endif // REALM_TABLE_HPP diff --git a/Pods/Realm/include/core/realm/table_accessors.hpp b/Pods/Realm/include/core/realm/table_accessors.hpp deleted file mode 100644 index d08edee0..00000000 --- a/Pods/Realm/include/core/realm/table_accessors.hpp +++ /dev/null @@ -1,1981 +0,0 @@ -/************************************************************************* - * - * Copyright 2016 Realm Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **************************************************************************/ - -#ifndef REALM_TABLE_ACCESSORS_HPP -#define REALM_TABLE_ACCESSORS_HPP - -#include -#include - -#include -#include - -#include - -namespace realm { - - -/// A convenience base class for Spec classes that are to be used with -/// BasicTable. -/// -/// There are two reasons why you might want to derive your spec class -/// from this one. First, it offers short hand names for each of the -/// available column types. Second, it makes it easier when you do not -/// want to specify colum names or convenience methods, since suitable -/// fallbacks are defined here. -struct SpecBase { - typedef int64_t Int; - typedef bool Bool; - typedef realm::OldDateTime OldDateTime; - typedef float Float; - typedef double Double; - typedef realm::StringData String; - typedef realm::BinaryData Binary; - typedef realm::Mixed Mixed; - - template - class Enum { - public: - typedef E enum_type; - Enum(E v) - : m_value(v) - { - } - operator E() const - { - return m_value; - } - - private: - E m_value; - }; - - template - class Subtable { - public: - typedef T table_type; - Subtable(T* t) - : m_table(t) - { - } - operator T*() const - { - return m_table; - } - - private: - T* m_table; - }; - - /// By default, there are no static column names defined for a - /// BasicTable. One may define a set of column mames as follows: - /// - /// \code{.cpp} - /// - /// struct MyTableSpec: SpecBase { - /// typedef TypeAppend::type Columns1; - /// typedef TypeAppend::type Columns; - /// - /// template