Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chris Anderson
committed
Jul 15, 2013
1 parent
93ff323
commit c1b5e39
Showing
135 changed files
with
11,499 additions
and
81 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
CordovaLib/CordovaLib.xcodeproj/xcuserdata/jchris.xcuserdatad/xcschemes/CordovaLib.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0460" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "D2AAC07D0554694100DB518D" | ||
BuildableName = "libCordova.a" | ||
BlueprintName = "CordovaLib" | ||
ReferencedContainer = "container:CordovaLib.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
buildConfiguration = "Debug"> | ||
<Testables> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Debug" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
allowLocationSimulation = "YES"> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Release" | ||
debugDocumentVersioning = "YES"> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
22 changes: 22 additions & 0 deletions
22
...Lib/CordovaLib.xcodeproj/xcuserdata/jchris.xcuserdatad/xcschemes/xcschememanagement.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SchemeUserState</key> | ||
<dict> | ||
<key>CordovaLib.xcscheme</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>1</integer> | ||
</dict> | ||
</dict> | ||
<key>SuppressBuildableAutocreation</key> | ||
<dict> | ||
<key>D2AAC07D0554694100DB518D</key> | ||
<dict> | ||
<key>primary</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
LiteGap.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file added
BIN
+8.51 KB
...codeproj/project.xcworkspace/xcuserdata/jchris.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
86 changes: 86 additions & 0 deletions
86
LiteGap.xcodeproj/xcuserdata/jchris.xcuserdatad/xcschemes/LiteGap.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0460" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "1D6058900D05DD3D006BFB54" | ||
BuildableName = "LiteGap.app" | ||
BlueprintName = "LiteGap" | ||
ReferencedContainer = "container:LiteGap.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
buildConfiguration = "Debug"> | ||
<Testables> | ||
</Testables> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "1D6058900D05DD3D006BFB54" | ||
BuildableName = "LiteGap.app" | ||
BlueprintName = "LiteGap" | ||
ReferencedContainer = "container:LiteGap.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
</TestAction> | ||
<LaunchAction | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Debug" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "1D6058900D05DD3D006BFB54" | ||
BuildableName = "LiteGap.app" | ||
BlueprintName = "LiteGap" | ||
ReferencedContainer = "container:LiteGap.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
buildConfiguration = "Release" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "1D6058900D05DD3D006BFB54" | ||
BuildableName = "LiteGap.app" | ||
BlueprintName = "LiteGap" | ||
ReferencedContainer = "container:LiteGap.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
22 changes: 22 additions & 0 deletions
22
LiteGap.xcodeproj/xcuserdata/jchris.xcuserdatad/xcschemes/xcschememanagement.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SchemeUserState</key> | ||
<dict> | ||
<key>LiteGap.xcscheme</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>0</integer> | ||
</dict> | ||
</dict> | ||
<key>SuppressBuildableAutocreation</key> | ||
<dict> | ||
<key>1D6058900D05DD3D006BFB54</key> | ||
<dict> | ||
<key>primary</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// CBLAttachment.h | ||
// CouchbaseLite | ||
// | ||
// Created by Jens Alfke on 6/21/12. | ||
// Copyright (c) 2012 Couchbase, Inc. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
@class CBLDocument, CBLRevisionBase, CBLRevision; | ||
|
||
|
||
/** A binary attachment to a document revision. | ||
Existing attachments can be gotten from -[CBLRevision attachmentNamed:]. | ||
To add a new attachment, call -initWithContentType:body: and then put the attachment object as a value in the "_attachments" dictionary of the properties when you create a new revision. */ | ||
@interface CBLAttachment : NSObject | ||
|
||
/** Creates a new attachment that doesn't belong to any revision. | ||
This object can then be added as a value in a new revision's _attachments dictionary; it will be converted to JSON when saved. | ||
@param contentType The MIME type | ||
@param body The attachment body; this can either be an NSData object, or an NSURL pointing to a (local) file. */ | ||
- (instancetype) initWithContentType: (NSString*)contentType | ||
body: (id)body __attribute__((nonnull)); | ||
|
||
/** The owning document revision. */ | ||
@property (readonly, retain) CBLRevisionBase* revision; | ||
|
||
/** The owning document. */ | ||
@property (readonly) CBLDocument* document; | ||
|
||
/** The filename. */ | ||
@property (readonly, copy) NSString* name; | ||
|
||
/** The MIME type of the contents. */ | ||
@property (readonly) NSString* contentType; | ||
|
||
/** The length in bytes of the contents. */ | ||
@property (readonly) UInt64 length; | ||
|
||
/** The CouchbaseLite metadata about the attachment, that lives in the document. */ | ||
@property (readonly) NSDictionary* metadata; | ||
|
||
/** The body data. */ | ||
@property (readonly) NSData* body; | ||
|
||
/** The URL of the file containing the body. | ||
This is read-only! DO NOT MODIFY OR DELETE THIS FILE. */ | ||
@property (readonly) NSURL* bodyURL; | ||
|
||
/** Updates the body, creating a new document revision in the process. | ||
If all you need to do to a document is update a single attachment this is an easy way to do it; but if you need to change multiple attachments, or change other body properties, do them in one step by calling -putProperties:error: on the revision or document. | ||
@param body The new body, or nil to delete the attachment. | ||
@param contentType The new content type, or nil to leave it the same. | ||
@param outError On return, the error (if any). */ | ||
- (CBLRevision*) updateBody: (NSData*)body | ||
contentType: (NSString*)contentType | ||
error: (NSError**)outError; | ||
|
||
@end |
79 changes: 79 additions & 0 deletions
79
LiteGap/Plugins/com.couchbase.litegap/CBLDatabase+Attachments.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// CBLDatabase+Attachments.h | ||
// CouchbaseLite | ||
// | ||
// Created by Jens Alfke on 1/18/12. | ||
// Copyright (c) 2012 Couchbase, Inc. All rights reserved. | ||
// | ||
|
||
#import "CBLDatabase+Internal.h" | ||
@class CBL_BlobStoreWriter, CBL_Revision, CBLMultipartWriter; | ||
|
||
|
||
/** Types of encoding/compression of stored attachments. */ | ||
typedef enum { | ||
kCBLAttachmentEncodingNone, | ||
kCBLAttachmentEncodingGZIP | ||
} CBLAttachmentEncoding; | ||
|
||
|
||
@interface CBLDatabase (Attachments) | ||
|
||
@property (readonly) NSString* attachmentStorePath; | ||
|
||
/** Creates a CBL_BlobStoreWriter object that can be used to stream an attachment to the store. */ | ||
- (CBL_BlobStoreWriter*) attachmentWriter; | ||
|
||
/** Creates CBL_Attachment objects from the revision's '_attachments' property. */ | ||
- (NSDictionary*) attachmentsFromRevision: (CBL_Revision*)rev | ||
status: (CBLStatus*)outStatus; | ||
|
||
/** Given a newly-added revision, adds the necessary attachment rows to the database and stores inline attachments into the blob store. */ | ||
- (CBLStatus) processAttachments: (NSDictionary*)attachments | ||
forRevision: (CBL_Revision*)rev | ||
withParentSequence: (SequenceNumber)parentSequence; | ||
|
||
/** Constructs an "_attachments" dictionary for a revision, to be inserted in its JSON body. */ | ||
- (NSDictionary*) getAttachmentDictForSequence: (SequenceNumber)sequence | ||
options: (CBLContentOptions)options; | ||
|
||
/** Modifies a CBL_Revision's _attachments dictionary by changing all attachments with revpos < minRevPos into stubs; and if 'attachmentsFollow' is true, the remaining attachments will be modified to _not_ be stubs but include a "follows" key instead of a body. */ | ||
+ (void) stubOutAttachmentsIn: (CBL_Revision*)rev | ||
beforeRevPos: (int)minRevPos | ||
attachmentsFollow: (BOOL)attachmentsFollow; | ||
|
||
/** Generates a MIME multipart writer for a revision, with separate body parts for each attachment whose "follows" property is set. */ | ||
- (CBLMultipartWriter*) multipartWriterForRevision: (CBL_Revision*)rev | ||
contentType: (NSString*)contentType; | ||
|
||
/** Returns the content and metadata of an attachment. | ||
If you pass NULL for the 'outEncoding' parameter, it signifies that you don't care about encodings and just want the 'real' data, so it'll be decoded for you. */ | ||
- (NSData*) getAttachmentForSequence: (SequenceNumber)sequence | ||
named: (NSString*)filename | ||
type: (NSString**)outType | ||
encoding: (CBLAttachmentEncoding*)outEncoding | ||
status: (CBLStatus*)outStatus; | ||
|
||
/** Returns the location of an attachment's file in the blob store. */ | ||
- (NSString*) getAttachmentPathForSequence: (SequenceNumber)sequence | ||
named: (NSString*)filename | ||
type: (NSString**)outType | ||
encoding: (CBLAttachmentEncoding*)outEncoding | ||
status: (CBLStatus*)outStatus; | ||
|
||
/** Uses the "digest" field of the attachment dict to look up the attachment in the store and return a file URL to it. DO NOT MODIFY THIS FILE! */ | ||
- (NSURL*) fileForAttachmentDict: (NSDictionary*)attachmentDict; | ||
|
||
/** Deletes obsolete attachments from the database and blob store. */ | ||
- (CBLStatus) garbageCollectAttachments; | ||
|
||
/** Updates or deletes an attachment, creating a new document revision in the process. | ||
Used by the PUT / DELETE methods called on attachment URLs. */ | ||
- (CBL_Revision*) updateAttachment: (NSString*)filename | ||
body: (CBL_BlobStoreWriter*)body | ||
type: (NSString*)contentType | ||
encoding: (CBLAttachmentEncoding)encoding | ||
ofDocID: (NSString*)docID | ||
revID: (NSString*)oldRevID | ||
status: (CBLStatus*)outStatus; | ||
@end |
47 changes: 47 additions & 0 deletions
47
LiteGap/Plugins/com.couchbase.litegap/CBLDatabase+Insertion.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// CBLDatabase+Insertion.h | ||
// CouchbaseLite | ||
// | ||
// Created by Jens Alfke on 1/18/12. | ||
// Copyright (c) 2012 Couchbase, Inc. All rights reserved. | ||
// | ||
|
||
#import "CBLDatabase+Internal.h" | ||
#import "CBLDatabase.h" | ||
|
||
|
||
@interface CBLDatabase (Insertion) | ||
|
||
+ (BOOL) isValidDocumentID: (NSString*)str; | ||
|
||
+ (NSString*) generateDocumentID; | ||
|
||
/** Stores a new (or initial) revision of a document. This is what's invoked by a PUT or POST. As with those, the previous revision ID must be supplied when necessary and the call will fail if it doesn't match. | ||
@param revision The revision to add. If the docID is nil, a new UUID will be assigned. Its revID must be nil. It must have a JSON body. | ||
@param prevRevID The ID of the revision to replace (same as the "?rev=" parameter to a PUT), or nil if this is a new document. | ||
@param allowConflict If NO, an error status kCBLStatusConflict will be returned if the insertion would create a conflict, i.e. if the previous revision already has a child. | ||
@param outStatus On return, an HTTP status code indicating success or failure. | ||
@return A new CBL_Revision with the docID, revID and sequence filled in (but no body). */ | ||
- (CBL_Revision*) putRevision: (CBL_Revision*)revision | ||
prevRevisionID: (NSString*)prevRevID | ||
allowConflict: (BOOL)allowConflict | ||
status: (CBLStatus*)outStatus; | ||
|
||
/** Inserts an already-existing revision replicated from a remote database. It must already have a revision ID. This may create a conflict! The revision's history must be given; ancestor revision IDs that don't already exist locally will create phantom revisions with no content. */ | ||
- (CBLStatus) forceInsert: (CBL_Revision*)rev | ||
revisionHistory: (NSArray*)history | ||
source: (NSURL*)source; | ||
|
||
/** Parses the _revisions dict from a document into an array of revision ID strings */ | ||
+ (NSArray*) parseCouchDBRevisionHistory: (NSDictionary*)docProperties; | ||
|
||
/** Compacts the database storage by removing the bodies and attachments of obsolete revisions. */ | ||
- (CBLStatus) compact; | ||
|
||
/** Purges specific revisions, which deletes them completely from the local database _without_ adding a "tombstone" revision. It's as though they were never there. | ||
@param docsToRevs A dictionary mapping document IDs to arrays of revision IDs. | ||
@param outResult On success will point to an NSDictionary with the same form as docsToRev, containing the doc/revision IDs that were actually removed. */ | ||
- (CBLStatus) purgeRevisions: (NSDictionary*)docsToRevs | ||
result: (NSDictionary**)outResult; | ||
|
||
@end |
Oops, something went wrong.