Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added public headers.

  • Loading branch information...
commit 42e9cbd38bbf40cca5aa8e3b4298509115f70537 1 parent 5c00e6c
@timburks authored
Showing with 164 additions and 0 deletions.
  1. +1 −0  Nukefile
  2. +67 −0 headers/NuBSON.h
  3. +96 −0 headers/NuMongoDB.h
View
1  Nukefile
@@ -21,6 +21,7 @@
(set @framework "NuMongoDB")
(set @framework_identifier "nu.programming.numongodb")
(set @framework_creator_code "????")
+(set @public_headers (filelist "^headers/.*\.h$"))
(compilation-tasks)
(framework-tasks)
View
67 headers/NuBSON.h
@@ -0,0 +1,67 @@
+/*!
+@header NuBSON.h
+@discussion Declarations for the NuBSON component.
+@copyright Copyright (c) 2010 Neon Design Technology, 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 <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#import <Foundation/Foundation.h>
+
+/*!
+ @class NuBSON
+ @abstract A BSON serializer and deserializer.
+ @discussion BSON is the wire format used to communicate with MongoDB.
+ */
+@interface NuBSON : NSObject
+{
+}
+
+/*! Create a BSON representation of a dictionary object. */
+- (NuBSON *) initWithDictionary:(NSDictionary *) dict;
+/*! Return a dictionary equivalent of a BSON object. */
+- (NSMutableDictionary *) dictionaryValue;
+/*! Return an NSData representation of the BSON object. */
+- (NSData *) data;
+@end
+
+@interface NuBSONObjectID : NSObject
+{
+}
+
+/*! Create a new and unique object ID. */
++ (NuBSONObjectID *) objectID;
+
+@end
+
+@interface NSData (NuBSON)
+- (NSMutableDictionary *) BSONValue;
+@end
+
+@interface NSDictionary (NuBSON)
+- (NSData *) BSONRepresentation;
+@end
+
+@interface NuBSONBuffer : NSObject
+{
+}
+
+- (id) init;
+- (NuBSON *) bsonValue;
+- (void) addObject:(id) object withKey:(id) key;
+
+@end
View
96 headers/NuMongoDB.h
@@ -0,0 +1,96 @@
+/*!
+@header NuMongoDB.h
+@discussion Declarations for the NuMongoDB component.
+@copyright Copyright (c) 2010 Neon Design Technology, 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 <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#import <Foundation/Foundation.h>
+
+#import "NuBSON.h"
+
+/*!
+ @class NuMongoDBCursor
+ @abstract A cursor used to iterate results returned by MongoDB database queries.
+ @discussion We typically receive cursors when we use the MongoDB find command.
+ Cursors are recommended for iterating over large result sets.
+ */
+@interface NuMongoDBCursor : NSObject
+{
+}
+
+/*! Step the cursor to the next object. */
+- (BOOL) next;
+/*! Get the NuBSON representation of the current object. */
+- (NuBSON *) currentBSON;
+/*! Get the native representation of the current object. */
+- (NSDictionary *) currentObject;
+/*! Return the remaining elements in an array. */
+- (NSMutableArray *) arrayValue;
+
+@end
+
+/*!
+ @class NuMongoDB
+ @abstract A connection to a MongoDB database.
+ @discussion NuMongoDB instances are used to connect to, update, and query MongoDB databases.
+ */
+@interface NuMongoDB : NSObject
+{
+}
+
+/*! Connect to a MongoDB database. Options can include @"host" and @"port". */
+- (int) connectWithOptions:(NSDictionary *) options;
+/*! Connect to a local MongoDB database on the default port (27017). */
+- (int) connect;
+/*! Add user to named database. */
+- (void) addUser:(NSString *) user withPassword:(NSString *) password forDatabase:(NSString *) database;
+/*! Authenticate to named database. */
+- (BOOL) authenticateUser:(NSString *) user withPassword:(NSString *) password forDatabase:(NSString *) database;
+/*! Convenience method for database searches. Query should be a dictionary. */
+- (NuMongoDBCursor *) find:(id) query inCollection:(NSString *) collection;
+/*! Main search method. Query and fields specifiers are dictionaries or nil. */
+- (NuMongoDBCursor *) find:(id) query inCollection:(NSString *) collection returningFields:(id) fields numberToReturn:(int) nToReturn numberToSkip:(int) nToSkip;
+/*! Convenience method that returns search results as an array. */
+- (NSMutableArray *) findArray:(id) query inCollection:(NSString *) collection;
+/*! Convenience method that returns search results as an array. */
+- (NSMutableArray *) findArray:(id) query inCollection:(NSString *) collection returningFields:(id) fields numberToReturn:(int) nToReturn numberToSkip:(int) nToSkip;
+/*! Convenience method that returns search results as a single object. */
+- (NSMutableDictionary *) findOne:(id) query inCollection:(NSString *) collection;
+/*! Add an object to a collection, returning the _id of the new object. */
+- (id) insertObject:(id) insert intoCollection:(NSString *) collection;
+/*! Update an object in a collection. insertIfNecessary triggers an "upsert". */
+- (void) updateObject:(id) update inCollection:(NSString *) collection withCondition:(id) condition insertIfNecessary:(BOOL) insertIfNecessary updateMultipleEntries:(BOOL) updateMultipleEntries;
+/*! Remove an object or objects matching a specified condition. */
+- (void) removeWithCondition:(id) condition fromCollection:(NSString *) collection;
+/*! Count objects with a specified condition. */
+- (int) countWithCondition:(id) condition inCollection:(NSString *) collection inDatabase:(NSString *) database;
+/*! Run an arbitrary database command. */
+- (id) runCommand:(id) command inDatabase:(NSString *) database;
+/*! Get the names of the collections in a database. */
+- (id) collectionNamesInDatabase:(NSString *) database;
+/*! Remove a database. */
+- (BOOL) dropDatabase:(NSString *) database;
+/*! Remove a collection. */
+- (BOOL) dropCollection:(NSString *) collection inDatabase:(NSString *) database;
+/*! Create a collection if it doesn't already exist. */
+- (BOOL) ensureCollection:(NSString *) collection hasIndex:(NSObject *) key withOptions:(int) options;
+/*! Close a database connection. */
+- (void) close;
+
+@end
Please sign in to comment.
Something went wrong with that request. Please try again.