Permalink
Browse files

Mass renaming of "TD" classes to "TD_"

Preparing for the public API which will have non-underscored names;
for instance, TDDatabase will be the public class, while the existing internal
class is TD_Database.
  • Loading branch information...
1 parent 9b4fa47 commit 677ba7c11aecdbe9fe01cff9d42bc349f496b99e @snej snej committed Nov 7, 2012
Showing with 1,232 additions and 1,091 deletions.
  1. +3 −3 Demo-Mac/DemoAppController.m
  2. +1 −1 Demo-iOS/EmptyAppDelegate.m
  3. +1 −1 Listener/TDHTTPConnection.m
  4. +2 −2 Listener/TDHTTPResponse.m
  5. +3 −3 Listener/TDHTTPServer.h
  6. +4 −4 Listener/TDListener.h
  7. +2 −2 Listener/TDListener.m
  8. +7 −7 Listener/TouchServ.m
  9. +5 −5 Source/TDC.m
  10. +27 −27 Source/TDInternal.h
  11. +1 −1 Source/TDMisc.h
  12. +5 −5 Source/TDMultipartDocumentReader.h
  13. +4 −4 Source/TDMultipartDocumentReader.m
  14. +2 −2 Source/TDMultipartDownloader.h
  15. +2 −2 Source/TDMultipartDownloader.m
  16. +2 −2 Source/TDPuller.h
  17. +13 −13 Source/TDPuller.m
  18. +1 −1 Source/TDPusher.h
  19. +22 −22 Source/TDPusher.m
  20. +1 −1 Source/TDRemoteRequest.m
  21. +4 −4 Source/TDReplicator.h
  22. +5 −5 Source/TDReplicator.m
  23. +7 −7 Source/TDReplicatorManager.h
  24. +29 −29 Source/TDReplicatorManager.m
  25. +28 −28 Source/TDReplicator_Tests.m
  26. +86 −86 Source/TDRouter+Handlers.m
  27. +10 −10 Source/TDRouter.h
  28. +14 −14 Source/TDRouter.m
  29. +30 −30 Source/TDRouter_Tests.m
  30. +1 −1 Source/TDSequenceMap.h
  31. +11 −11 Source/TDURLProtocol.h
  32. +11 −11 Source/TDURLProtocol.m
  33. +3 −3 Source/{TDAttachment.h → TD_Attachment.h}
  34. +3 −3 Source/{TDAttachment.m → TD_Attachment.m}
  35. +4 −4 Source/{TDBody.h → TD_Body.h}
  36. +7 −7 Source/{TDBody.m → TD_Body.m}
  37. +10 −10 Source/{TDDatabase+Attachments.h → TD_Database+Attachments.h}
  38. +22 −22 Source/{TDDatabase+Attachments.m → TD_Database+Attachments.m}
  39. +13 −13 Source/{TDDatabase+Insertion.h → TD_Database+Insertion.h}
  40. +54 −54 Source/{TDDatabase+Insertion.m → TD_Database+Insertion.m}
  41. +5 −5 Source/{TDDatabase+LocalDocs.h → TD_Database+LocalDocs.h}
  42. +10 −10 Source/{TDDatabase+LocalDocs.m → TD_Database+LocalDocs.m}
  43. +4 −4 Source/{TDDatabase+Replication.h → TD_Database+Replication.h}
  44. +7 −7 Source/{TDDatabase+Replication.m → TD_Database+Replication.m}
  45. +27 −27 Source/{TDDatabase.h → TD_Database.h}
  46. +65 −65 Source/{TDDatabase.m → TD_Database.m}
  47. +11 −11 Source/{TDDatabaseManager.h → TD_DatabaseManager.h}
  48. +25 −25 Source/{TDDatabaseManager.m → TD_DatabaseManager.m}
  49. +151 −151 Source/{TDDatabase_Tests.m → TD_Database_Tests.m}
  50. +14 −14 Source/{TDRevision.h → TD_Revision.h}
  51. +21 −21 Source/{TDRevision.m → TD_Revision.m}
  52. +9 −9 Source/{TDServer.h → TD_Server.h}
  53. +21 −21 Source/{TDServer.m → TD_Server.m}
  54. +5 −5 Source/{TDView.h → TD_View.h}
  55. +5 −5 Source/{TDView.m → TD_View.m}
  56. +85 −85 Source/{TDView_Tests.m → TD_View_Tests.m}
  57. +10 −10 Source/TouchDB.exp
  58. +4 −4 Source/TouchDB.h
  59. +293 −152 TouchDB.xcodeproj/project.pbxproj
@@ -102,9 +102,9 @@ - (void) applicationDidFinishLaunching: (NSNotification*)n {
#ifdef FOR_TESTING_PURPOSES
// Start a listener socket:
- [server tellTDServer: ^(TDServer* tdServer) {
+ [server tellTDServer: ^(TD_Server* tdServer) {
// Register support for handling certain JS functions used in the CouchDB unit tests:
- [TDView setCompiler: self];
+ [TD_View setCompiler: self];
sListener = [[TDListener alloc] initWithTDServer: tdServer port: 8888];
[sListener start];
@@ -344,7 +344,7 @@ - (TDReduceBlock) compileReduceFunction: (NSString*)reduceSource language:(NSStr
TDReduceBlock reduceBlock = NULL;
if ([reduceSource isEqualToString: @"(function (keys, values) {return sum(values);})"]) {
reduceBlock = ^(NSArray* keys, NSArray* values, BOOL rereduce) {
- return [TDView totalValues: values];
+ return [TD_View totalValues: values];
};
}
return [reduceBlock copy];
@@ -15,7 +15,7 @@ @implementation EmptyAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSError* error;
- TDServer* tdServer = [[TDServer alloc] initWithDirectory: @"/tmp/touchdb_empty_app"
+ TD_Server* tdServer = [[TD_Server alloc] initWithDirectory: @"/tmp/touchdb_empty_app"
error: &error];
NSAssert(tdServer, @"Couldn't create server: %@", error);
[TDURLProtocol setServer: tdServer];
@@ -19,7 +19,7 @@
#import "TDHTTPServer.h"
#import "TDHTTPResponse.h"
#import "TDListener.h"
-#import "TDServer.h"
+#import "TD_Server.h"
#import "TDRouter.h"
#import "HTTPMessage.h"
@@ -17,7 +17,7 @@
#import "TDHTTPConnection.h"
#import "TDListener.h"
#import "TDRouter.h"
-#import "TDBody.h"
+#import "TD_Body.h"
#import "Logging.h"
@@ -51,7 +51,7 @@ - (id) initWithRouter: (TDRouter*)router forConnection:(TDHTTPConnection*)connec
};
if (connection.listener.readOnly) {
- router.onAccessCheck = ^TDStatus(TDDatabase* db, NSString* docID, SEL action) {
+ router.onAccessCheck = ^TDStatus(TD_Database* db, NSString* docID, SEL action) {
NSString* method = router.request.HTTPMethod;
if ([method isEqualToString: @"GET"] || [method isEqualToString: @"HEAD"])
return kTDStatusOK;
View
@@ -7,17 +7,17 @@
//
#import "HTTPServer.h"
-@class TDListener, TDServer;
+@class TDListener, TD_Server;
@interface TDHTTPServer : HTTPServer {
@private
TDListener* _listener;
- TDServer* _tdServer;
+ TD_Server* _tdServer;
}
@property (retain) TDListener* listener;
-@property (retain) TDServer* tdServer;
+@property (retain) TD_Server* tdServer;
@end
View
@@ -7,24 +7,24 @@
//
#import <Foundation/Foundation.h>
-@class TDHTTPServer, TDServer;
+@class TDHTTPServer, TD_Server;
/** A simple HTTP server that provides remote access to the TouchDB REST API. */
@interface TDListener : NSObject
{
TDHTTPServer* _httpServer;
- TDServer* _tdServer;
+ TD_Server* _tdServer;
NSString* _realm;
BOOL _readOnly;
BOOL _requiresAuth;
NSDictionary* _passwords;
}
/** Initializes a TDListener.
- @param server The TDServer whose databases to serve.
+ @param server The TD_Server whose databases to serve.
@param port The TCP port number to listen on. Use 0 to automatically pick an available port (you can get the port number after the server starts by getting the .port property.) */
-- (id) initWithTDServer: (TDServer*)server port: (UInt16)port;
+- (id) initWithTDServer: (TD_Server*)server port: (UInt16)port;
/** The TCP port number that the listener is listening on.
If the listener has not yet started, this will return 0. */
View
@@ -16,7 +16,7 @@
#import "TDListener.h"
#import "TDHTTPServer.h"
#import "TDHTTPConnection.h"
-#import "TDServer.h"
+#import "TD_Server.h"
#import "HTTPServer.h"
@@ -27,7 +27,7 @@ @implementation TDListener
@synthesize readOnly=_readOnly, requiresAuth=_requiresAuth, realm=_realm;
-- (id) initWithTDServer: (TDServer*)server port: (UInt16)port {
+- (id) initWithTDServer: (TD_Server*)server port: (UInt16)port {
self = [super init];
if (self) {
_tdServer = server;
View
@@ -18,8 +18,8 @@
#import <TouchDB/TDRouter.h>
#import <TouchDBListener/TDListener.h>
#import <TouchDB/TDPusher.h>
-#import <TouchDB/TDDatabaseManager.h>
-#import <TouchDB/TDDatabase+Replication.h>
+#import <TouchDB/TD_DatabaseManager.h>
+#import <TouchDB/TD_Database+Replication.h>
#if DEBUG
#import "Logging.h"
@@ -53,7 +53,7 @@
}
-static bool doReplicate( TDServer* server, const char* replArg,
+static bool doReplicate( TD_Server* server, const char* replArg,
BOOL pull, BOOL createTarget, BOOL continuous,
const char *user, const char *password)
{
@@ -96,9 +96,9 @@ static bool doReplicate( TDServer* server, const char* replArg,
else
Log(@"Pushing %@ --> <%@> ...", dbName, remote);
- [server tellDatabaseManager: ^(TDDatabaseManager *dbm) {
+ [server tellDatabaseManager: ^(TD_DatabaseManager *dbm) {
TDReplicator* repl = nil;
- TDDatabase* db = [dbm existingDatabaseNamed: dbName];
+ TD_Database* db = [dbm existingDatabaseNamed: dbName];
if (pull) {
if (db) {
if (![db deleteDatabase: nil]) {
@@ -133,7 +133,7 @@ int main (int argc, const char * argv[])
EnableLogTo(TDListener, YES);
#endif
- TDDatabaseManagerOptions options = kTDDatabaseManagerDefaultOptions;
+ TD_DatabaseManagerOptions options = kTD_DatabaseManagerDefaultOptions;
const char* replArg = NULL, *user = NULL, *password = NULL;
BOOL auth = NO, pull = NO, createTarget = NO, continuous = NO;
@@ -159,7 +159,7 @@ int main (int argc, const char * argv[])
}
NSError* error;
- TDServer* server = [[TDServer alloc] initWithDirectory: GetServerPath()
+ TD_Server* server = [[TD_Server alloc] initWithDirectory: GetServerPath()
options: &options
error: &error];
if (error) {
View
@@ -7,16 +7,16 @@
//
#import "TDC.h"
-#import "TDBody.h"
+#import "TD_Body.h"
#import "TDRouter.h"
-#import "TDServer.h"
+#import "TD_Server.h"
#import "Test.h"
#import <string.h>
static NSLock* sLock;
static NSString* sServerDir;
-static TDServer* sServer;
+static TD_Server* sServer;
static NSString* CToNSString(const char* str) {
@@ -159,11 +159,11 @@ void TDCInitialize(const char* dataDirectoryPath) {
assert(sLock);
[sLock lock];
@try {
- // Create TDServer on first call:
+ // Create TD_Server on first call:
if (!sServer) {
assert(sServerDir);
NSError* error;
- sServer = [[TDServer alloc] initWithDirectory: sServerDir error: &error];
+ sServer = [[TD_Server alloc] initWithDirectory: sServerDir error: &error];
if (!sServer) {
Warn(@"Unable to create TouchDB server: %@", error);
return nil;
View
@@ -6,24 +6,24 @@
// Copyright (c) 2011 Couchbase, Inc. All rights reserved.
//
-#import <TouchDB/TDDatabase.h>
-#import "TDDatabase+Attachments.h"
-#import "TDDatabaseManager.h"
-#import "TDView.h"
-#import "TDServer.h"
+#import <TouchDB/TD_Database.h>
+#import "TD_Database+Attachments.h"
+#import "TD_DatabaseManager.h"
+#import "TD_View.h"
+#import "TD_Server.h"
#import "TDRouter.h"
#import "TDReplicator.h"
#import "TDRemoteRequest.h"
#import "TDBlobStore.h"
-@class TDAttachment;
+@class TD_Attachment;
-@interface TDDatabase ()
+@interface TD_Database ()
@property (readwrite, copy) NSString* name; // make it settable
@property (readonly) FMDatabase* fmdb;
@property (readonly) TDBlobStore* attachmentStore;
- (SInt64) getDocNumericID: (NSString*)docID;
-- (TDRevisionList*) getAllRevisionsOfDocumentID: (NSString*)docID
+- (TD_RevisionList*) getAllRevisionsOfDocumentID: (NSString*)docID
numericID: (SInt64)docNumericID
onlyCurrent: (BOOL)onlyCurrent;
- (TDStatus) deleteViewNamed: (NSString*)name;
@@ -37,60 +37,60 @@
isDeleted: (BOOL*)outIsDeleted;
@end
-@interface TDDatabase (Insertion_Internal)
-- (NSData*) encodeDocumentJSON: (TDRevision*)rev;
-- (TDStatus) validateRevision: (TDRevision*)newRev previousRevision: (TDRevision*)oldRev;
+@interface TD_Database (Insertion_Internal)
+- (NSData*) encodeDocumentJSON: (TD_Revision*)rev;
+- (TDStatus) validateRevision: (TD_Revision*)newRev previousRevision: (TD_Revision*)oldRev;
@end
-@interface TDDatabase (Attachments_Internal)
+@interface TD_Database (Attachments_Internal)
- (void) rememberAttachmentWritersForDigests: (NSDictionary*)writersByDigests;
#if DEBUG
- (id) attachmentWriterForAttachment: (NSDictionary*)attachment;
#endif
- (BOOL) storeBlob: (NSData*)blob creatingKey: (TDBlobKey*)outKey;
-- (TDStatus) insertAttachment: (TDAttachment*)attachment
+- (TDStatus) insertAttachment: (TD_Attachment*)attachment
forSequence: (SequenceNumber)sequence;
- (TDStatus) copyAttachmentNamed: (NSString*)name
fromSequence: (SequenceNumber)fromSequence
toSequence: (SequenceNumber)toSequence;
-- (BOOL) inlineFollowingAttachmentsIn: (TDRevision*)rev error: (NSError**)outError;
+- (BOOL) inlineFollowingAttachmentsIn: (TD_Revision*)rev error: (NSError**)outError;
@end
-@interface TDDatabase (Replication_Internal)
+@interface TD_Database (Replication_Internal)
- (void) stopAndForgetReplicator: (TDReplicator*)repl;
- (NSString*) lastSequenceWithCheckpointID: (NSString*)checkpointID;
- (BOOL) setLastSequence: (NSString*)lastSequence withCheckpointID: (NSString*)checkpointID;
+ (NSString*) joinQuotedStrings: (NSArray*)strings;
@end
-@interface TDView ()
-- (id) initWithDatabase: (TDDatabase*)db name: (NSString*)name;
+@interface TD_View ()
+- (id) initWithDatabase: (TD_Database*)db name: (NSString*)name;
@property (readonly) int viewID;
- (NSArray*) dump;
- (void) databaseClosing;
@end
-@interface TDServer ()
+@interface TD_Server ()
#if DEBUG
-+ (TDServer*) createEmptyAtPath: (NSString*)path; // for testing
-+ (TDServer*) createEmptyAtTemporaryPath: (NSString*)name; // for testing
++ (TD_Server*) createEmptyAtPath: (NSString*)path; // for testing
++ (TD_Server*) createEmptyAtTemporaryPath: (NSString*)name; // for testing
#endif
@end
-@interface TDDatabaseManager ()
+@interface TD_DatabaseManager ()
@property (readonly, nonatomic) TDReplicatorManager* replicatorManager;
#if DEBUG
-+ (TDDatabaseManager*) createEmptyAtPath: (NSString*)path; // for testing
-+ (TDDatabaseManager*) createEmptyAtTemporaryPath: (NSString*)name; // for testing
++ (TD_DatabaseManager*) createEmptyAtPath: (NSString*)path; // for testing
++ (TD_DatabaseManager*) createEmptyAtTemporaryPath: (NSString*)name; // for testing
#endif
@end
@interface TDRouter ()
-- (id) initWithDatabaseManager: (TDDatabaseManager*)dbManager request: (NSURLRequest*)request;
+- (id) initWithDatabaseManager: (TD_DatabaseManager*)dbManager request: (NSURLRequest*)request;
@end
@@ -100,9 +100,9 @@
@property (readwrite, nonatomic) NSUInteger changesProcessed, changesTotal;
- (void) maybeCreateRemoteDB;
- (void) beginReplicating;
-- (void) addToInbox: (TDRevision*)rev;
-- (void) addRevsToInbox: (TDRevisionList*)revs;
-- (void) processInbox: (TDRevisionList*)inbox; // override this
+- (void) addToInbox: (TD_Revision*)rev;
+- (void) addRevsToInbox: (TD_RevisionList*)revs;
+- (void) processInbox: (TD_RevisionList*)inbox; // override this
- (TDRemoteJSONRequest*) sendAsyncRequest: (NSString*)method
path: (NSString*)relativePath
body: (id)body
View
@@ -7,7 +7,7 @@
//
#import <Foundation/Foundation.h>
-#import <TouchDB/TDRevision.h>
+#import <TouchDB/TD_Revision.h>
extern NSString* const TDHTTPErrorDomain;
@@ -8,7 +8,7 @@
#import "TDMultipartReader.h"
#import <TouchDB/TDStatus.h>
-@class TDDatabase, TDRevision, TDBlobStoreWriter, TDMultipartDocumentReader;
+@class TD_Database, TD_Revision, TDBlobStoreWriter, TDMultipartDocumentReader;
typedef void(^TDMultipartDocumentReaderCompletionBlock)(TDMultipartDocumentReader*);
@@ -17,7 +17,7 @@ typedef void(^TDMultipartDocumentReaderCompletionBlock)(TDMultipartDocumentReade
@interface TDMultipartDocumentReader : NSObject <TDMultipartReaderDelegate, NSStreamDelegate>
{
@private
- TDDatabase* _database;
+ TD_Database* _database;
TDStatus _status;
TDMultipartReader* _multipartReader;
NSMutableData* _jsonBuffer;
@@ -31,16 +31,16 @@ typedef void(^TDMultipartDocumentReaderCompletionBlock)(TDMultipartDocumentReade
// synchronous:
+ (NSDictionary*) readData: (NSData*)data
ofType: (NSString*)contentType
- toDatabase: (TDDatabase*)database
+ toDatabase: (TD_Database*)database
status: (TDStatus*)outStatus;
// asynchronous:
+ (TDStatus) readStream: (NSInputStream*)stream
ofType: (NSString*)contentType
- toDatabase: (TDDatabase*)database
+ toDatabase: (TD_Database*)database
then: (TDMultipartDocumentReaderCompletionBlock)completionBlock;
-- (id) initWithDatabase: (TDDatabase*)database;
+- (id) initWithDatabase: (TD_Database*)database;
@property (readonly, nonatomic) TDStatus status;
@property (readonly, nonatomic) NSDictionary* document;
Oops, something went wrong.

1 comment on commit 677ba7c

Good compromise.

Please sign in to comment.