Exemplo n.º 1
0
 public static extern void c4key_beginArray(C4Key *key);
Exemplo n.º 2
0
 public static extern void c4key_endArray(C4Key *key);
Exemplo n.º 3
0
 private static extern void c4key_addMapKey(C4Key *key, C4Slice s);
Exemplo n.º 4
0
 /// <summary>
 /// Adds a map key, before the next value. When adding to a map, every value must be
 /// preceded by a key.
 /// </summary>
 /// <param name="key">The key to operate on</param>
 /// <param name="s">The value to store</param>
 public static void c4key_addMapKey(C4Key *key, string s)
 {
     using(var s_ = new C4String(s)) {
         c4key_addMapKey(key, s_.AsC4Slice());   
     }
 }
 public JsonC4KeyWriter(C4Key *key) 
 {
     _c4key = key;
 }
Exemplo n.º 6
0
 public static extern void c4key_addString(C4Key *key, C4Slice s);
Exemplo n.º 7
0
 public static extern void c4key_addNull(C4Key *key);
Exemplo n.º 8
0
 public static extern C4KeyReader c4key_read(C4Key *key);
Exemplo n.º 9
0
 private static extern void _c4key_free(C4Key *key);
Exemplo n.º 10
0
 /// <summary>
 /// Frees a C4Key.
 /// </summary>
 /// <param name="key">The key to free</param>
 public static void c4key_free(C4Key *key)
 {
     #if DEBUG
     var ptr = (IntPtr)key;
     #if ENABLE_LOGGING
     if(ptr != IntPtr.Zero && !_AllocatedObjects.ContainsKey(ptr)) {
         Console.WriteLine("WARNING: [c4key_free] freeing object 0x{0} that was not found in allocated list", ptr.ToString("X"));
     } else {
     #endif
         _AllocatedObjects.Remove(ptr);
     #if ENABLE_LOGGING
     }
     #endif
     #endif
     _c4key_free(key);
 }
Exemplo n.º 11
0
     public static bool c4indexer_emit(C4Indexer *indexer, C4Document *document, uint viewNumber,
         C4Key*[] emittedKeys, string[] emittedValues, C4Error *outError)
     {
         var c4StringArr = emittedValues.Select(x => new C4String(x)).ToArray();
         var sliceArr = c4StringArr.Select(x => x.AsC4Slice()).ToArray();
         var retVal = c4indexer_emit(indexer, document, viewNumber, emittedKeys, sliceArr, outError);
         foreach(var c4str in c4StringArr) {
             c4str.Dispose();
         }
 
         return retVal;
     }
Exemplo n.º 12
0
 /// <summary>
 /// Emits new keys/values derived from one document, for one view.
 /// This function needs to be called once for each(document, view) pair.Even if the view's map
 /// function didn't emit anything, the old keys/values need to be cleaned up.
 ///      
 /// Values are uninterpreted by CBForest, but by convention are JSON. A special value "*"
 /// (a single asterisk) is used as a placeholder for the entire document.
 ///
 /// </summary>
 /// <param name="indexer">The indexer to operate on</param>
 /// <param name="document">The document being indexed</param>
 /// <param name="viewNumber">The position of the view in the indexer's views[] array</param>
 /// <param name="emittedKeys">Array of keys being emitted</param>
 /// <param name="emittedValues">Array of values being emitted. (JSON by convention.)</param>
 /// <param name="outError">The error that occurred if the operation doesn't succeed</param>
 /// <returns>true on success, false otherwise</returns>
 public static bool c4indexer_emit(C4Indexer *indexer, C4Document *document, uint viewNumber,
     C4Key*[] emittedKeys, C4Slice[] emittedValues, C4Error *outError)
 {
     fixed(C4Key** keysPtr = emittedKeys)
     fixed(C4Slice* valuesPtr = emittedValues)
     {
         return c4indexer_emit(indexer, document, viewNumber, (uint)emittedKeys.Length, keysPtr, valuesPtr, outError);
     }
 }
Exemplo n.º 13
0
 public static extern bool c4indexer_emit(C4Indexer *indexer, C4Document *document, uint viewNumber, uint emitCount,
     C4Key** emittedKeys, C4Slice* emittedValues, C4Error *outError);
Exemplo n.º 14
0
 public static extern void c4key_beginMap(C4Key *key);
Exemplo n.º 15
0
 public static extern void c4key_addBool(C4Key *key, [MarshalAs(UnmanagedType.U1)]bool b);
Exemplo n.º 16
0
 public static extern void c4key_endMap(C4Key *key);
Exemplo n.º 17
0
 public static extern void c4key_addNumber(C4Key *key, double d);
Exemplo n.º 18
0
 public string ToJSON(C4Key *key)
 {
     return ToJSON(Native.c4key_read(key));
 }
Exemplo n.º 19
0
 public static extern void c4key_addMapKey(C4Key *key, C4Slice s);