public static extern void c4key_beginArray(C4Key *key);
public static extern void c4key_endArray(C4Key *key);
private static extern void c4key_addMapKey(C4Key *key, C4Slice s);
/// <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; }
public static extern void c4key_addString(C4Key *key, C4Slice s);
public static extern void c4key_addNull(C4Key *key);
public static extern C4KeyReader c4key_read(C4Key *key);
private static extern void _c4key_free(C4Key *key);
/// <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); }
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; }
/// <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); } }
public static extern bool c4indexer_emit(C4Indexer *indexer, C4Document *document, uint viewNumber, uint emitCount, C4Key** emittedKeys, C4Slice* emittedValues, C4Error *outError);
public static extern void c4key_beginMap(C4Key *key);
public static extern void c4key_addBool(C4Key *key, [MarshalAs(UnmanagedType.U1)]bool b);
public static extern void c4key_endMap(C4Key *key);
public static extern void c4key_addNumber(C4Key *key, double d);
public string ToJSON(C4Key *key) { return ToJSON(Native.c4key_read(key)); }
public static extern void c4key_addMapKey(C4Key *key, C4Slice s);