Permalink
Browse files

The Great Renaming #2: TouchDB --> CouchbaseLite, TD --> CBL

  • Loading branch information...
1 parent 26c02df commit 986d704085c6a355649fa0644158fbd4fd60137c @snej snej committed Jan 31, 2013
Showing with 5,418 additions and 6,027 deletions.
  1. +26 −0 CouchToCBL.rb
  2. +832 −836 {TouchDB.xcodeproj → CouchbaseLite.xcodeproj}/project.pbxproj
  3. +1 −1 {TouchDB.xcodeproj → CouchbaseLite.xcodeproj}/project.xcworkspace/contents.xcworkspacedata
  4. +4 −4 Demo-Mac/DemoAppController.h
  5. +31 −31 Demo-Mac/DemoAppController.m
  6. +5 −5 Demo-Mac/DemoQuery.h
  7. +10 −10 Demo-Mac/DemoQuery.m
  8. +7 −7 Demo-Mac/EmptyGNUstepApp.m
  9. +2 −2 Demo-Mac/ShoppingItem.h
  10. +2 −2 Demo-Mac/ShoppingItem.m
  11. +6 −6 Demo-iOS/ConfigViewController.xib
  12. +2 −2 Demo-iOS/DemoAppDelegate.h
  13. +2 −2 Demo-iOS/DemoAppDelegate.m
  14. +1 −1 Demo-iOS/EmptyAppDelegate.h
  15. +4 −4 Demo-iOS/EmptyAppDelegate.m
  16. +1 −1 Demo-iOS/Entitlements.plist
  17. +8 −8 Demo-iOS/RootViewController.h
  18. +19 −19 Demo-iOS/RootViewController.m
  19. +17 −0 Listener/CBLHTTPConnection.h
  20. +18 −18 Listener/{TDHTTPConnection.m → CBLHTTPConnection.m}
  21. +8 −8 Listener/{TDHTTPResponse.h → CBLHTTPResponse.h}
  22. +32 −32 Listener/{TDHTTPResponse.m → CBLHTTPResponse.m}
  23. +24 −0 Listener/CBLHTTPServer.h
  24. +10 −10 Listener/{TDListener.h → CBLListener.h}
  25. +13 −13 Listener/{TDListener.m → CBLListener.m}
  26. 0 Listener/{TouchDBListener-Info.plist → CouchbaseLiteListener-Info.plist}
  27. +8 −0 Listener/CouchbaseLiteListener.exp
  28. +0 −17 Listener/TDHTTPConnection.h
  29. +0 −24 Listener/TDHTTPServer.h
  30. +0 −8 Listener/TouchDBListener.exp
  31. +27 −27 Listener/TouchServ.m
  32. +14 −13 README.md
  33. +83 −83 Source/API/APITests.m
  34. +9 −9 Source/API/{TDAttachment.h → CBLAttachment.h}
  35. +27 −27 Source/API/{TDAttachment.m → CBLAttachment.m}
  36. +43 −43 Source/API/{TDDatabase.h → CBLDatabase.h}
  37. +65 −65 Source/API/{TDDatabase.m → CBLDatabase.m}
  38. +21 −21 Source/API/{TDDocument.h → CBLDocument.h}
  39. +43 −43 Source/API/{TDDocument.m → CBLDocument.m}
  40. +19 −18 Source/API/{TDDatabaseManager.h → CBLManager.h}
  41. +46 −46 Source/API/{TDDatabaseManager.m → CBLManager.m}
  42. +33 −33 Source/API/{TDModel.h → CBLModel.h}
  43. +68 −68 Source/API/{TDModel.m → CBLModel.m}
  44. +18 −18 Source/API/{TDModelFactory.h → CBLModelFactory.h}
  45. +12 −12 Source/API/{TDModelFactory.m → CBLModelFactory.m}
  46. +29 −29 Source/API/{TDQuery.h → CBLQuery.h}
  47. +54 −54 Source/API/{TDQuery.m → CBLQuery.m}
  48. +15 −15 Source/API/{TDReplication.h → CBLReplication.h}
  49. +46 −46 Source/API/{TDReplication.m → CBLReplication.m}
  50. +28 −28 Source/API/{TDRevision.h → CBLRevision.h}
  51. +36 −36 Source/API/{TDRevision.m → CBLRevision.m}
  52. +24 −24 Source/API/{TDUITableSource.h → CBLUITableSource.h}
  53. +23 −23 Source/API/{TDUITableSource.m → CBLUITableSource.m}
  54. +16 −16 Source/API/{TDView.h → CBLView.h}
  55. +15 −15 Source/API/{TDView.m → CBLView.m}
  56. +12 −11 Source/API/{TouchDB.h → CouchbaseLite.h}
  57. +102 −0 Source/API/CouchbaseLitePrivate.h
  58. +0 −102 Source/API/TouchDBPrivate.h
  59. +1 −1 Source/BuildFatLibrary.sh
  60. +7 −7 Source/{TDAuthorizer.h → CBLAuthorizer.h}
  61. +17 −17 Source/{TDAuthorizer.m → CBLAuthorizer.m}
  62. +4 −4 Source/{TDBase64.h → CBLBase64.h}
  63. +5 −5 Source/{TDBase64.m → CBLBase64.m}
  64. +3 −3 Source/{TDBatcher.h → CBLBatcher.h}
  65. +4 −4 Source/{TDBatcher.m → CBLBatcher.m}
  66. +18 −18 Source/{TDBlobStore_Tests.m → CBLBlobStore_Tests.m}
  67. +4 −4 Source/{TDBrowserIDAuthorizer.h → CBLBrowserIDAuthorizer.h}
  68. +10 −10 Source/{TDBrowserIDAuthorizer.m → CBLBrowserIDAuthorizer.m}
  69. +21 −21 Source/{TDCache.h → CBLCache.h}
  70. +16 −16 Source/{TDCache.m → CBLCache.m}
  71. +5 −5 Source/{TDCanonicalJSON.h → CBLCanonicalJSON.h}
  72. +14 −14 Source/{TDCanonicalJSON.m → CBLCanonicalJSON.m}
  73. +27 −27 Source/{TDChangeTracker_Tests.m → CBLChangeTracker_Tests.m}
  74. +7 −7 Source/{TDCollateJSON.h → CBLCollateJSON.h}
  75. +31 −31 Source/{TDCollateJSON.m → CBLCollateJSON.m}
  76. +2 −2 Source/{TDGNUstep.h → CBLGNUstep.h}
  77. +4 −4 Source/{TDGNUstep.m → CBLGNUstep.m}
  78. +49 −49 Source/{TDInternal.h → CBLInternal.h}
  79. +6 −6 Source/{TDJSFunction.h → CBLJSFunction.h}
  80. +7 −7 Source/{TDJSFunction.m → CBLJSFunction.m}
  81. +16 −16 Source/{TDJSON.h → CBLJSON.h}
  82. +12 −12 Source/{TDJSON.m → CBLJSON.m}
  83. +9 −9 Source/{TDJSViewCompiler.h → CBLJSViewCompiler.h}
  84. +19 −19 Source/{TDJSViewCompiler.m → CBLJSViewCompiler.m}
  85. +21 −21 Source/{TDJSViewCompiler_Test.m → CBLJSViewCompiler_Test.m}
  86. +24 −24 Source/{TDMisc.h → CBLMisc.h}
  87. +46 −46 Source/{TDMisc.m → CBLMisc.m}
  88. +4 −4 Source/{TDMultiStreamWriter.h → CBLMultiStreamWriter.h}
  89. +32 −32 Source/{TDMultiStreamWriter.m → CBLMultiStreamWriter.m}
  90. +59 −0 Source/CBLMultipartDocumentReader.h
  91. +37 −37 Source/{TDMultipartDocumentReader.m → CBLMultipartDocumentReader.m}
  92. +9 −9 Source/{TDMultipartDownloader.h → CBLMultipartDownloader.h}
  93. +20 −20 Source/{TDMultipartDownloader.m → CBLMultipartDownloader.m}
  94. +8 −8 Source/{TDMultipartReader.h → CBLMultipartReader.h}
  95. +15 −15 Source/{TDMultipartReader.m → CBLMultipartReader.m}
  96. +24 −0 Source/CBLMultipartUploader.h
  97. +7 −7 Source/{TDMultipartUploader.m → CBLMultipartUploader.m}
  98. +4 −4 Source/{TDMultipartWriter.h → CBLMultipartWriter.h}
  99. +9 −9 Source/{TDMultipartWriter.m → CBLMultipartWriter.m}
  100. +4 −4 Source/{TDOAuth1Authorizer.h → CBLOAuth1Authorizer.h}
  101. +8 −8 Source/{TDOAuth1Authorizer.m → CBLOAuth1Authorizer.m}
  102. +7 −7 Source/{TDReachability.h → CBLReachability.h}
  103. +12 −12 Source/{TDReachability.m → CBLReachability.m}
  104. +13 −13 Source/{TDRemoteRequest.h → CBLRemoteRequest.h}
  105. +29 −29 Source/{TDRemoteRequest.m → CBLRemoteRequest.m}
  106. +73 −73 Source/{TDReplicator_Tests.m → CBLReplicator_Tests.m}
  107. +173 −173 Source/{TDRouter_Tests.m → CBLRouter_Tests.m}
  108. +4 −4 Source/{TDSequenceMap.h → CBLSequenceMap.h}
  109. +6 −6 Source/{TDSequenceMap.m → CBLSequenceMap.m}
  110. +51 −0 Source/CBLStatus.h
  111. +71 −0 Source/CBLStatus.m
  112. +7 −7 Source/{TD_Attachment.h → CBL_Attachment.h}
  113. +5 −5 Source/{TD_Attachment.m → CBL_Attachment.m}
  114. +19 −19 Source/{TDBlobStore.h → CBL_BlobStore.h}
  115. +26 −26 Source/{TDBlobStore.m → CBL_BlobStore.m}
  116. +5 −5 Source/{TD_Body.h → CBL_Body.h}
  117. +14 −14 Source/{TD_Body.m → CBL_Body.m}
  118. +23 −23 Source/{TDC.h → CBL_CAPI.h}
  119. +38 −38 Source/{TDC.m → CBL_CAPI.m}
  120. +28 −28 Source/{TD_Database+Attachments.h → CBL_Database+Attachments.h}
  121. +114 −114 Source/{TD_Database+Attachments.m → CBL_Database+Attachments.m}
  122. +19 −19 Source/{TD_Database+Insertion.h → CBL_Database+Insertion.h}
  123. +121 −121 Source/{TD_Database+Insertion.m → CBL_Database+Insertion.m}
  124. +24 −0 Source/CBL_Database+LocalDocs.h
  125. +28 −28 Source/{TD_Database+LocalDocs.m → CBL_Database+LocalDocs.m}
  126. +23 −0 Source/CBL_Database+Replication.h
  127. +16 −16 Source/{TD_Database+Replication.m → CBL_Database+Replication.m}
  128. +62 −62 Source/{TD_Database.h → CBL_Database.h}
  129. +150 −150 Source/{TD_Database.m → CBL_Database.m}
  130. +8 −8 Source/{TD_DatabaseChange.h → CBL_DatabaseChange.h}
  131. +10 −10 Source/{TD_DatabaseChange.m → CBL_DatabaseChange.m}
  132. +56 −0 Source/CBL_DatabaseManager.h
  133. +66 −66 Source/{TD_DatabaseManager.m → CBL_DatabaseManager.m}
  134. +255 −255 Source/{TD_Database_Tests.m → CBL_Database_Tests.m}
  135. +13 −13 Source/{TDPuller.h → CBL_Puller.h}
  136. +50 −50 Source/{TDPuller.m → CBL_Puller.m}
  137. +5 −5 Source/{TDPusher.h → CBL_Pusher.h}
  138. +57 −57 Source/{TDPusher.m → CBL_Pusher.m}
  139. +16 −16 Source/{TDReplicator.h → CBL_Replicator.h}
  140. +53 −53 Source/{TDReplicator.m → CBL_Replicator.m}
  141. +11 −11 Source/{TDReplicatorManager.h → CBL_ReplicatorManager.h}
  142. +63 −63 Source/{TDReplicatorManager.m → CBL_ReplicatorManager.m}
  143. +19 −19 Source/{TD_Revision.h → CBL_Revision.h}
  144. +30 −30 Source/{TD_Revision.m → CBL_Revision.m}
  145. +223 −223 Source/{TDRouter+Handlers.m → CBL_Router+Handlers.m}
  146. +25 −25 Source/{TDRouter.h → CBL_Router.h}
  147. +83 −83 Source/{TDRouter.m → CBL_Router.m}
  148. +38 −0 Source/CBL_Server.h
  149. +30 −30 Source/{TD_Server.m → CBL_Server.m}
  150. +56 −0 Source/CBL_URLProtocol.h
  151. +51 −50 Source/{TDURLProtocol.m → CBL_URLProtocol.m}
  152. +36 −36 Source/{TD_View.h → CBL_View.h}
  153. +62 −62 Source/{TD_View.m → CBL_View.m}
  154. +150 −150 Source/{TD_View_Tests.m → CBL_View_Tests.m}
  155. +17 −17 Source/ChangeTracker/{TDChangeTracker.h → CBLChangeTracker.h}
  156. +26 −26 Source/ChangeTracker/{TDChangeTracker.m → CBLChangeTracker.m}
  157. +5 −5 Source/ChangeTracker/{TDSocketChangeTracker.h → CBLSocketChangeTracker.h}
  158. +13 −13 Source/ChangeTracker/{TDSocketChangeTracker.m → CBLSocketChangeTracker.m}
  159. +0 −23 Source/ChangeTracker/TDConnectionChangeTracker.h
  160. +0 −346 Source/ChangeTracker/TDConnectionChangeTracker.m
  161. 0 Source/{TouchDB-Info.plist → CouchbaseLite-Info.plist}
  162. +53 −0 Source/CouchbaseLite.exp
  163. +4 −4 Source/{TouchDBPrefix.h → CouchbaseLitePrefix.h}
  164. +0 −59 Source/TDMultipartDocumentReader.h
  165. +0 −24 Source/TDMultipartUploader.h
  166. +0 −51 Source/TDStatus.h
  167. +0 −71 Source/TDStatus.m
  168. +0 −266 Source/TDUITableSource.m
  169. +0 −56 Source/TDURLProtocol.h
  170. +0 −24 Source/TD_Database+LocalDocs.h
  171. +0 −23 Source/TD_Database+Replication.h
  172. +0 −56 Source/TD_DatabaseManager.h
  173. +0 −38 Source/TD_Server.h
  174. +0 −53 Source/TouchDB.exp
  175. +2 −2 CouchToTD.rb → TDToCBL.rb
  176. +1 −1 vendor/MYUtilities
View
@@ -0,0 +1,26 @@
+#! /usr/bin/env ruby
+
+if ARGV.length == 0
+ puts "Usage: CouchToCBL sourcefile ..."
+ puts ""
+ puts "Modifies input files in-place, converting 'Couch*' identifiers to 'CBL*'."
+ puts "This takes care of most of the busy-work of converting from TouchDB 1.0."
+ puts "You will need to do some more conversion work by hand, but a lot less"
+ puts "than you would have without this script."
+ puts "NOTE: This directly modifies the named files; please make sure the files"
+ puts "are checked into source control or that you at least have backups of them!"
+ exit 0
+end
+
+ARGV.each do |filename|
+ puts "#{filename} ..."
+ outfilename = filename + ".temp"
+ File.open(outfilename, "w") do |out|
+ IO.foreach(filename) do |line|
+ line.gsub!(/\bCouchCocoa\b/, 'CouchbaseLite')
+ line.gsub!(/\b(k?)Couch([A-Z])/, '\1CBL\2')
+ out.puts line
+ end
+ end
+ File.rename(outfilename, filename)
+end

Large diffs are not rendered by default.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -14,10 +14,10 @@
// and limitations under the License.
#import <Cocoa/Cocoa.h>
-@class TDDatabase, TDReplication, DemoQuery;
+@class CBLDatabase, CBLReplication, DemoQuery;
-/** Generic application delegate for simple Mac OS TouchDB demo apps.
+/** Generic application delegate for simple Mac OS CouchbaseLite demo apps.
The name of the (local) database to use should be added to the app's Info.plist
under the 'DemoDatabase' key. */
@interface DemoAppController : NSObject
@@ -33,10 +33,10 @@
IBOutlet NSTextField* _syncURLField;
IBOutlet NSButtonCell* _syncPushCheckbox, *_syncPullCheckbox;
- TDDatabase* _database;
+ CBLDatabase* _database;
DemoQuery* _query;
BOOL _syncConfiguringDefault;
- TDReplication *_pull, *_push;
+ CBLReplication *_pull, *_push;
BOOL _glowing;
}
@@ -15,17 +15,17 @@
#import "DemoAppController.h"
#import "DemoQuery.h"
-#import "TDJSON.h"
+#import "CBLJSON.h"
#import "Test.h"
#import "MYBlockUtils.h"
-#import <TouchDB/TouchDB.h>
+#import <CouchbaseLite/CouchbaseLite.h>
#undef FOR_TESTING_PURPOSES
#ifdef FOR_TESTING_PURPOSES
-#import <TouchDBListener/TDListener.h>
-@interface DemoAppController () <TDViewCompiler>
+#import <CouchbaseLiteListener/CBLListener.h>
+@interface DemoAppController () <CBLViewCompiler>
@end
-static TDListener* sListener;
+static CBLListener* sListener;
#endif
#define ENABLE_REPLICATION
@@ -50,12 +50,12 @@ - (void) applicationDidFinishLaunching: (NSNotification*)n {
NSDictionary* bundleInfo = [[NSBundle mainBundle] infoDictionary];
NSString* dbName = bundleInfo[@"DemoDatabase"];
if (!dbName) {
- NSLog(@"FATAL: Please specify a TouchDB database name in the app's Info.plist under the 'DemoDatabase' key");
+ NSLog(@"FATAL: Please specify a CouchbaseLite database name in the app's Info.plist under the 'DemoDatabase' key");
exit(1);
}
NSError* error;
- _database = [[TDDatabaseManager sharedInstance] createDatabaseNamed: dbName
+ _database = [[CBLManager sharedInstance] createDatabaseNamed: dbName
error: &error];
if (!_database) {
NSAssert(NO, @"Error creating db: %@", error);
@@ -72,7 +72,7 @@ - (void) applicationDidFinishLaunching: (NSNotification*)n {
if (newRevision.isDeleted)
return YES;
id date = newRevision[@"created_at"];
- if (date && ! [TDJSON dateWithJSONObject: date]) {
+ if (date && ! [CBLJSON dateWithJSONObject: date]) {
context.errorMessage = [@"invalid date " stringByAppendingString: date];
return NO;
}
@@ -86,7 +86,7 @@ - (void) applicationDidFinishLaunching: (NSNotification*)n {
})];
- TDQuery* q = [[_database viewNamed: @"byDate"] query];
+ CBLQuery* q = [[_database viewNamed: @"byDate"] query];
q.descending = YES;
self.query = [[DemoQuery alloc] initWithQuery: q
modelClass: _tableController.objectClass];
@@ -96,11 +96,11 @@ - (void) applicationDidFinishLaunching: (NSNotification*)n {
#ifdef FOR_TESTING_PURPOSES
// Start a listener socket:
- [server tellTDServer: ^(TD_Server* tdServer) {
- // Register support for handling certain JS functions used in the TouchDB unit tests:
- [TD_View setCompiler: self];
+ [server tellCBLServer: ^(CBL_Server* tdServer) {
+ // Register support for handling certain JS functions used in the CouchbaseLite unit tests:
+ [CBL_View setCompiler: self];
- sListener = [[TDListener alloc] initWithTDServer: tdServer port: 8888];
+ sListener = [[CBLListener alloc] initWithCBLServer: tdServer port: 8888];
[sListener start];
}];
@@ -190,13 +190,13 @@ - (void) configureSyncFinished:(NSWindow *)sheet returnCode:(NSInteger)returnCod
}
-- (void) resetReplication: (TDReplication*)repl {
+- (void) resetReplication: (CBLReplication*)repl {
[repl setValue: @YES ofProperty: @"reset"];
[repl restart];
}
- (IBAction) resetSync: (id)sender {
- for (TDReplication* repl in _database.allReplications)
+ for (CBLReplication* repl in _database.allReplications)
[self resetReplication: repl];
}
@@ -219,14 +219,14 @@ - (void) setSyncURL:(NSURL *)url {
}
-- (void) observeReplication: (TDReplication*)repl {
+- (void) observeReplication: (CBLReplication*)repl {
[repl addObserver: self forKeyPath: @"completed" options: 0 context: NULL];
[repl addObserver: self forKeyPath: @"total" options: 0 context: NULL];
[repl addObserver: self forKeyPath: @"error" options: 0 context: NULL];
[repl addObserver: self forKeyPath: @"mode" options: 0 context: NULL];
}
-- (void) stopObservingReplication: (TDReplication*)repl {
+- (void) stopObservingReplication: (CBLReplication*)repl {
[repl removeObserver: self forKeyPath: @"completed"];
[repl removeObserver: self forKeyPath: @"total"];
[repl removeObserver: self forKeyPath: @"error"];
@@ -262,19 +262,19 @@ - (void) updateSyncStatusView {
value = 3; // red
tooltip = _push.error.localizedDescription;
} else switch(MAX(_pull.mode, _push.mode)) {
- case kTDReplicationStopped:
+ case kCBLReplicationStopped:
value = 3;
tooltip = @"Sync stopped";
break; // red
- case kTDReplicationOffline:
+ case kCBLReplicationOffline:
value = 2; // yellow
tooltip = @"Offline";
break;
- case kTDReplicationIdle:
+ case kCBLReplicationIdle:
value = 0;
tooltip = @"Everything's in sync!";
break;
- case kTDReplicationActive:
+ case kCBLReplicationActive:
value = 1;
tooltip = @"Syncing data...";
break;
@@ -293,7 +293,7 @@ - (void) updateSyncStatusView {
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context
{
- TDReplication* repl = object;
+ CBLReplication* repl = object;
NSLog(@"SYNC mode=%d", repl.mode);
if ([keyPath isEqualToString: @"completed"] || [keyPath isEqualToString: @"total"]) {
if (repl == _pull || repl == _push) {
@@ -335,35 +335,35 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
#ifdef FOR_TESTING_PURPOSES
-// These map/reduce functions are used in the TouchDB 'basics.js' unit tests. By recognizing them
+// These map/reduce functions are used in the CouchbaseLite 'basics.js' unit tests. By recognizing them
// here and returning equivalent native blocks, we can run those tests.
-- (TDMapBlock) compileMapFunction: (NSString*)mapSource language:(NSString *)language {
+- (CBLMapBlock) compileMapFunction: (NSString*)mapSource language:(NSString *)language {
if (![language isEqualToString: @"javascript"])
return NULL;
- TDMapBlock mapBlock = NULL;
+ CBLMapBlock mapBlock = NULL;
if ([mapSource isEqualToString: @"(function (doc) {if (doc.a == 4) {emit(null, doc.b);}})"]) {
- mapBlock = ^(NSDictionary* doc, TDMapEmitBlock emit) {
+ mapBlock = ^(NSDictionary* doc, CBLMapEmitBlock emit) {
if ([doc[@"a"] isEqual: @4])
emit(nil, doc[@"b"]);
};
} else if ([mapSource isEqualToString: @"(function (doc) {emit(doc.foo, null);})"] ||
[mapSource isEqualToString: @"function(doc) { emit(doc.foo, null); }"]) {
- mapBlock = ^(NSDictionary* doc, TDMapEmitBlock emit) {
+ mapBlock = ^(NSDictionary* doc, CBLMapEmitBlock emit) {
emit(doc[@"foo"], nil);
};
}
return [mapBlock copy];
}
-- (TDReduceBlock) compileReduceFunction: (NSString*)reduceSource language:(NSString *)language {
+- (CBLReduceBlock) compileReduceFunction: (NSString*)reduceSource language:(NSString *)language {
if (![language isEqualToString: @"javascript"])
return NULL;
- TDReduceBlock reduceBlock = NULL;
+ CBLReduceBlock reduceBlock = NULL;
if ([reduceSource isEqualToString: @"(function (keys, values) {return sum(values);})"]) {
reduceBlock = ^(NSArray* keys, NSArray* values, BOOL rereduce) {
- return [TD_View totalValues: values];
+ return [CBL_View totalValues: values];
};
}
return [reduceBlock copy];
@@ -385,7 +385,7 @@ - (void)tableView:(NSTableView *)tableView
NSArray* items = _tableController.arrangedObjects;
if (row >= (NSInteger)items.count)
return; // Don't know why I get called on illegal rows, but it happens...
- TDModel* item = items[row];
+ CBLModel* item = items[row];
NSTimeInterval changedFor = item.timeSinceExternallyChanged;
if (changedFor > 0 && changedFor < kChangeGlowDuration) {
float fraction = (float)(1.0 - changedFor / kChangeGlowDuration);
View
@@ -14,22 +14,22 @@
// and limitations under the License.
#import <Cocoa/Cocoa.h>
-@class TDQuery, TDLiveQuery, RESTOperation;
+@class CBLQuery, CBLLiveQuery, RESTOperation;
-/** Simple controller for TouchDB demo apps.
- This class acts as glue between a TDQuery (a TouchDB view) and an NSArrayController.
+/** Simple controller for CouchbaseLite demo apps.
+ This class acts as glue between a CBLQuery (a CouchbaseLite view) and an NSArrayController.
The app can then bind its UI controls to the NSArrayController and get basic CRUD operations
without needing any code. */
@interface DemoQuery : NSObject
{
- TDLiveQuery* _query;
+ CBLLiveQuery* _query;
RESTOperation* _op;
NSMutableArray* _entries;
Class _modelClass;
}
-- (id) initWithQuery: (TDQuery*)query modelClass: (Class)modelClass;
+- (id) initWithQuery: (CBLQuery*)query modelClass: (Class)modelClass;
/** The documents returned by the query, wrapped in DemoItem objects.
An NSArrayController can be bound to this property. */
View
@@ -14,18 +14,18 @@
// and limitations under the License.
#import "DemoQuery.h"
-#import <TouchDB/TouchDB.h>
+#import <CouchbaseLite/CouchbaseLite.h>
@interface DemoQuery ()
-- (void) loadEntriesFrom: (TDQueryEnumerator*)rows;
+- (void) loadEntriesFrom: (CBLQueryEnumerator*)rows;
@end
@implementation DemoQuery
-- (id) initWithQuery: (TDQuery*)query modelClass: (Class)modelClass {
+- (id) initWithQuery: (CBLQuery*)query modelClass: (Class)modelClass {
NSParameterAssert(query);
self = [super init];
if (self != nil) {
@@ -45,21 +45,21 @@ - (void) dealloc
}
-- (void) loadEntriesFrom: (TDQueryEnumerator*)rows {
+- (void) loadEntriesFrom: (CBLQueryEnumerator*)rows {
NSLog(@"Reloading %lu rows from sequence #%lu...",
(unsigned long)rows.count, (unsigned long)rows.sequenceNumber);
NSMutableArray* entries = [NSMutableArray array];
- for (TDQueryRow* row in rows) {
- TDModel* item = [_modelClass modelForDocument: row.document];
+ for (CBLQueryRow* row in rows) {
+ CBLModel* item = [_modelClass modelForDocument: row.document];
item.autosaves = YES;
[entries addObject: item];
// If this item isn't in the prior _entries, it's an external insertion:
if (_entries && [_entries indexOfObjectIdenticalTo: item] == NSNotFound)
[item markExternallyChanged];
}
- for (TDModel* item in _entries) {
+ for (CBLModel* item in _entries) {
if ([item isNew])
[entries addObject: item];
}
@@ -99,20 +99,20 @@ - (NSUInteger) countOfEntries {
}
-- (TDModel*)objectInEntriesAtIndex: (NSUInteger)index {
+- (CBLModel*)objectInEntriesAtIndex: (NSUInteger)index {
return self._entries[index];
}
-- (void) insertObject: (TDModel*)object inEntriesAtIndex: (NSUInteger)index {
+- (void) insertObject: (CBLModel*)object inEntriesAtIndex: (NSUInteger)index {
[self._entries insertObject: object atIndex: index];
object.autosaves = YES;
object.database = _query.database;
}
- (void) removeObjectFromEntriesAtIndex: (NSUInteger)index {
- TDModel* item = self._entries[index];
+ CBLModel* item = self._entries[index];
item.database = nil;
[_entries removeObjectAtIndex: index];
}
View
@@ -1,14 +1,14 @@
//
// EmptyGNUstepApp.m
-// TouchDB
+// CouchbaseLite
//
// Created by Jens Alfke on 2/27/12.
// Copyright (c) 2012 Couchbase, Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
-#import <TouchDB/TouchDB.h>
-#import <TouchDB/TDRouter.h>
+#import <CouchbaseLite/CouchbaseLite.h>
+#import <CouchbaseLite/CBLRouter.h>
#if DEBUG
#import "Logging.h"
@@ -24,15 +24,15 @@ int main (int argc, const char * argv[])
@autoreleasepool {
#if DEBUG
EnableLog(YES);
- //EnableLogTo(TDDatabase, YES);
- //EnableLogTo(TDDatabaseVerbose, YES);
+ //EnableLogTo(CBLDatabase, YES);
+ //EnableLogTo(CBLDatabaseVerbose, YES);
RunTestCases(argc, argv);
#endif
/*
NSError* error;
- TDServer* server = [[TDServer alloc] initWithDirectory: @"/tmp/touchdbserver" error: &error];
+ CBLServer* server = [[CBLServer alloc] initWithDirectory: @"/tmp/touchdbserver" error: &error];
if (!server) {
- Warn(@"FATAL: Error initializing TDServer: %@", error);
+ Warn(@"FATAL: Error initializing CBLServer: %@", error);
exit(1);
}
NSLog(@"Started server %@", server);
Oops, something went wrong.

0 comments on commit 986d704

Please sign in to comment.