Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update class names from TouchDB that were renamed

TouchDB renamed classes from TD* to TD_* in commit 677ba7c.
  • Loading branch information...
commit 46ede5dfc0351c36c5fa6417c0021ada8a5ade79 1 parent d445e61
@snej snej authored
View
16 Couch/CouchDesignDocument_Embedded.h
@@ -10,19 +10,19 @@
#ifdef COUCHCOCOA_IMPL
typedef id TDMapBlock;
typedef id TDReduceBlock;
-typedef id TDFilterBlock;
-typedef id TDValidationBlock;
+typedef id TD_FilterBlock;
+typedef id TD_ValidationBlock;
#else
-#import <TouchDB/TDDatabase+Insertion.h>
-#import <TouchDB/TDView.h>
+#import <TouchDB/TD_Database+Insertion.h>
+#import <TouchDB/TD_View.h>
#endif
#define MAPBLOCK(BLOCK) ^(NSDictionary* doc, void (^emit)(id key, id value)){BLOCK}
#define REDUCEBLOCK(BLOCK) ^id(NSArray* keys, NSArray* values, BOOL rereduce){BLOCK}
-#define VALIDATIONBLOCK(BLOCK) ^BOOL(TDRevision* newRevision, id<TDValidationContext> context)\
+#define VALIDATIONBLOCK(BLOCK) ^BOOL(TD_Revision* newRevision, id<TD_ValidationContext> context)\
{BLOCK}
-#define FILTERBLOCK(BLOCK) ^BOOL(TDRevision* revision, NSDictionary* params) {BLOCK}
+#define FILTERBLOCK(BLOCK) ^BOOL(TD_Revision* revision, NSDictionary* params) {BLOCK}
/** Optional support for native Objective-C map/reduce functions.
@@ -46,9 +46,9 @@ typedef id TDValidationBlock;
version: (NSString*)version;
- (void) defineFilterNamed: (NSString*)filterName
- block: (TDFilterBlock)filterBlock;
+ block: (TD_FilterBlock)filterBlock;
/** An Objective-C block that can validate any document being added/updated/deleted in this database. */
-- (void) setValidationBlock: (TDValidationBlock)validationBlock;
+- (void) setValidationBlock: (TD_ValidationBlock)validationBlock;
@end
View
34 Couch/CouchDesignDocument_Embedded.m
@@ -17,21 +17,21 @@
kTDIncludeLocalSeq = 16 // adds '_local_seq' property
};
-@class TDDatabase, TDRevision, TDView;
+@class TD_Database, TD_Revision, TD_View;
-@interface TDServer : NSObject
-- (TDDatabase*) databaseNamed: (NSString*)name;
+@interface TD_Server : NSObject
+- (TD_Database*) databaseNamed: (NSString*)name;
@end
-@interface TDDatabase : NSObject
-- (TDView*) viewNamed: (NSString*)name;
-- (TDView*) existingViewNamed: (NSString*)name;
-- (void) defineFilter: (NSString*)filterName asBlock: (TDFilterBlock)filterBlock;
-- (void) defineValidation: (NSString*)validationName asBlock: (TDValidationBlock)validationBlock;
-- (TDValidationBlock) validationNamed: (NSString*)validationName;
+@interface TD_Database : NSObject
+- (TD_View*) viewNamed: (NSString*)name;
+- (TD_View*) existingViewNamed: (NSString*)name;
+- (void) defineFilter: (NSString*)filterName asBlock: (TD_FilterBlock)filterBlock;
+- (void) defineValidation: (NSString*)validationName asBlock: (TD_ValidationBlock)validationBlock;
+- (TD_ValidationBlock) validationNamed: (NSString*)validationName;
@end
-@interface TDView : NSObject
+@interface TD_View : NSObject
- (BOOL) setMapBlock: (TDMapBlock)mapBlock
reduceBlock: (TDReduceBlock)reduceBlock
version: (NSString*)version;
@@ -44,7 +44,7 @@ - (void) deleteView;
@implementation CouchDesignDocument (Embedded)
-- (void) tellTDDatabase: (void(^)(TDDatabase*))block {
+- (void) tellTDDatabase: (void(^)(TD_Database*))block {
[(CouchTouchDBServer*)self.database.server tellTDDatabaseNamed: self.database.relativePath
to: block];
}
@@ -73,9 +73,9 @@ - (void) defineViewNamed: (NSString*)viewName
mapBlock = [mapBlock copy];
reduceBlock = [reduceBlock copy];
TDContentOptions mapContentOptions = self.includeLocalSequence ? kTDIncludeLocalSeq : 0;
- [self tellTDDatabase: ^(TDDatabase* tddb) {
+ [self tellTDDatabase: ^(TD_Database* tddb) {
if (mapBlock) {
- TDView* view = [tddb viewNamed: viewName];
+ TD_View* view = [tddb viewNamed: viewName];
[view setMapBlock: mapBlock reduceBlock: reduceBlock version: version];
view.mapContentOptions = mapContentOptions;
} else {
@@ -88,20 +88,20 @@ - (void) defineViewNamed: (NSString*)viewName
- (void) defineFilterNamed: (NSString*)filterName
- block: (TDFilterBlock)filterBlock
+ block: (TD_FilterBlock)filterBlock
{
filterName = [self qualifiedName: filterName];
filterBlock = [filterBlock copy];
- [self tellTDDatabase: ^(TDDatabase* tddb) {
+ [self tellTDDatabase: ^(TD_Database* tddb) {
[tddb defineFilter: filterName asBlock: filterBlock];
}];
[filterBlock release];
}
-- (void) setValidationBlock: (TDValidationBlock)validateBlock {
+- (void) setValidationBlock: (TD_ValidationBlock)validateBlock {
validateBlock = [validateBlock copy];
- [self tellTDDatabase: ^(TDDatabase* tddb) {
+ [self tellTDDatabase: ^(TD_Database* tddb) {
[tddb defineValidation: self.relativePath asBlock: validateBlock];
}];
[validateBlock release];
View
14 Couch/CouchTouchDBDatabase.m
@@ -11,10 +11,10 @@
#import "CouchInternal.h"
-// Declared in TDDatabase.h and TDRevision.h; redeclare here to avoid linking against TouchDB:
-static NSString* const TDDatabaseChangeNotification = @"TDDatabaseChange";
+// Declared in TD_Database.h and TD_Revision.h; redeclare here to avoid linking against TouchDB:
+static NSString* const TD_DatabaseChangeNotification = @"TD_DatabaseChange";
-@interface TDRevision : NSObject
+@interface TD_Revision : NSObject
@property (readonly) NSString* docID;
@property (readonly) NSString* revID;
@property (readonly) BOOL deleted;
@@ -36,15 +36,15 @@ - (void) setTracksChanges: (BOOL)track {
if (track) {
[(CouchTouchDBServer*)self.parent tellTDDatabaseNamed: self.relativePath
- to: ^(TDDatabase* tddb) {
+ to: ^(TD_Database* tddb) {
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(tdDatabaseChanged:)
- name: TDDatabaseChangeNotification
+ name: TD_DatabaseChangeNotification
object: tddb];
}];
} else {
[[NSNotificationCenter defaultCenter] removeObserver: self
- name: TDDatabaseChangeNotification
+ name: TD_DatabaseChangeNotification
object: nil];
}
}
@@ -56,7 +56,7 @@ - (void) tdDatabaseChanged: (NSNotification*)n {
return;
NSDictionary* userInfo = n.userInfo;
- TDRevision* rev = [userInfo objectForKey: @"winner"]; // I want winning rev, not newest one
+ TD_Revision* rev = [userInfo objectForKey: @"winner"]; // I want winning rev, not newest one
if (!rev)
return;
SInt64 sequence = [[userInfo objectForKey: @"rev"] sequence];
View
22 Couch/CouchTouchDBServer.h
@@ -7,17 +7,17 @@
//
#import "CouchServer.h"
-@class TDServer, TDDatabase;
-struct TDDatabaseManagerOptions;
+@class TD_Server, TD_Database;
+struct TD_DatabaseManagerOptions;
/** A convenience class that glues TouchDB into CouchCocoa.
- On creation, starts up an instance of TDServer and sets up TDURLProtocol to serve it.
+ On creation, starts up an instance of TD_Server and sets up TDURLProtocol to serve it.
The CouchServer URL is set to the root URL served by the protocol, so you can treat it just like a normal remote server instance. */
@interface CouchTouchDBServer : CouchServer
{
@private
- TDServer* _touchServer;
+ TD_Server* _touchServer;
NSError* _error;
BOOL _observing;
}
@@ -37,7 +37,7 @@ struct TDDatabaseManagerOptions;
@param serverPath The filesystem path to the server directory. If it doesn't already exist it will be created.
@param options Option settings; can be used to open in read-only mode or to disable the replicator. */
- (id) initWithServerPath: (NSString*)serverPath
- options: (const struct TDDatabaseManagerOptions*)options;
+ options: (const struct TD_DatabaseManagerOptions*)options;
/** Inherited initializer, if you want to connect to a remote server for debugging purposes. */
- (id) initWithURL: (NSURL*)url;
@@ -48,14 +48,14 @@ struct TDDatabaseManagerOptions;
/** If this is non-nil, the server failed to initialize. */
@property (readonly) NSError* error;
-/** Invokes the given block on the TouchDB server thread, passing it a pointer to the TDServer.
- You can use this to (carefully!) access the TDServer API.
+/** Invokes the given block on the TouchDB server thread, passing it a pointer to the TD_Server.
+ You can use this to (carefully!) access the TD_Server API.
Be aware that the block may not run immediately; it's queued and will be called immediately before the server handles the next REST call. */
-- (void) tellTDServer: (void (^)(TDServer*))block;
+- (void) tellTDServer: (void (^)(TD_Server*))block;
-/** Invokes the given block on the TouchDB server thread, passing it a pointer to a TDDatabase.
- You can use this to (carefully!) access the TDDatabase API.
+/** Invokes the given block on the TouchDB server thread, passing it a pointer to a TD_Database.
+ You can use this to (carefully!) access the TD_Database API.
Be aware that the block may not run immediately; it's queued and will be called immediately before the server handles the next REST call. */
-- (void) tellTDDatabaseNamed: (NSString*)dbName to: (void (^)(TDDatabase*))block;
+- (void) tellTDDatabaseNamed: (NSString*)dbName to: (void (^)(TD_Database*))block;
@end
View
28 Couch/CouchTouchDBServer.m
@@ -11,22 +11,22 @@
#import "CouchInternal.h"
-// Declare essential bits of TDServer and TDURLProtocol to avoid having to #import TouchDB:
-@interface TDServer : NSObject
+// Declare essential bits of TD_Server and TDURLProtocol to avoid having to #import TouchDB:
+@interface TD_Server : NSObject
- (id) initWithDirectory: (NSString*)dirPath
error: (NSError**)outError;
- (id) initWithDirectory: (NSString*)dirPath
- options: (const struct TDDatabaseManagerOptions*)options
+ options: (const struct TD_DatabaseManagerOptions*)options
error: (NSError**)outError;
- (void) queue: (void(^)())block;
-- (void) tellDatabaseNamed: (NSString*)dbName to: (void (^)(TDDatabase*))block;
+- (void) tellDatabaseNamed: (NSString*)dbName to: (void (^)(TD_Database*))block;
- (void) close;
@end
@interface TDURLProtocol : NSURLProtocol
+ (NSURL*) rootURL;
-+ (void) setServer: (TDServer*)server;
-+ (NSURL*) registerServer: (TDServer*)server;
++ (void) setServer: (TD_Server*)server;
++ (NSURL*) registerServer: (TD_Server*)server;
@end
@interface TDReplicator
@@ -51,7 +51,7 @@ + (CouchTouchDBServer*) sharedInstance {
- (id)init {
// Avoid link-time dependency on TouchDB; look up classes dynamically:
Class classTDURLProtocol = NSClassFromString(@"TDURLProtocol");
- Class classTDServer = NSClassFromString(@"TDServer");
+ Class classTDServer = NSClassFromString(@"TD_Server");
NSAssert(classTDURLProtocol && classTDServer,
@"Not linked with TouchDB framework (or you didn't use the -ObjC linker flag)");
@@ -82,23 +82,23 @@ - (id)init {
- (id) initWithServerPath: (NSString*)serverPath
- options: (const struct TDDatabaseManagerOptions*)options
+ options: (const struct TD_DatabaseManagerOptions*)options
{
// On Mac OS TouchDB.framework is linked dynamically, so avoid explicit references to its
// classes because they'd create link errors building CouchCocoa.
Class classTDURLProtocol = NSClassFromString(@"TDURLProtocol");
- Class classTDServer = NSClassFromString(@"TDServer");
+ Class classTDServer = NSClassFromString(@"TD_Server");
NSAssert(classTDURLProtocol && classTDServer,
@"Not linked with TouchDB framework (or you didn't use the -ObjC linker flag)");
NSError* error;
- TDServer* server;
+ TD_Server* server;
if ([classTDServer instancesRespondToSelector: @selector(initWithDirectory:options:error:)]) {
server = [[classTDServer alloc] initWithDirectory: serverPath
options: options
error: &error];
} else {
- NSAssert(!options, @"TDServer initializer with options is unavailable in TouchDB");
+ NSAssert(!options, @"TD_Server initializer with options is unavailable in TouchDB");
server = [[classTDServer alloc] initWithDirectory: serverPath
error: &error];
}
@@ -145,13 +145,13 @@ - (Class) databaseClass {
}
-- (void) tellTDServer: (void (^)(TDServer*))block {
- TDServer* server = _touchServer;
+- (void) tellTDServer: (void (^)(TD_Server*))block {
+ TD_Server* server = _touchServer;
[_touchServer queue: ^{ block(server); }];
}
-- (void) tellTDDatabaseNamed: (NSString*)dbName to: (void (^)(TDDatabase*))block {
+- (void) tellTDDatabaseNamed: (NSString*)dbName to: (void (^)(TD_Database*))block {
[_touchServer tellDatabaseNamed: dbName to: block];
}
Please sign in to comment.
Something went wrong with that request. Please try again.