Example #1
0
 internal unsafe CBForestQueryStatus(C4QueryEnumerator *e)
 {
     Key               = e->key;
     Value             = e->value;
     DocSequence       = (long)e->docSequence;
     _docIDSlice       = e->docID;
     _fullTextTerms    = e->fullTextTerms;
     FullTextTermCount = e->fullTextTermCount;
     BoundingBox       = e->geoBBox;
     GeoJSONRaw        = e->geoJSON;
 }
        internal unsafe CBForestQueryStatus(C4Slice docID, C4KeyReader key, C4Slice value, long docSequence)
        {
            _docID      = new Lazy <string>(() => (string)docID);
            Key         = key;
            Value       = value;
            DocSequence = docSequence;
            _keyJSON    = new Lazy <string>(() =>
            {
                var localKey = key;
                return(Native.c4key_toJSON(&localKey));
            });

            _valueJSON = new Lazy <string>(() => (string)value);
        }
Example #3
0
        internal unsafe void AsInternalObject(Action <C4DocPutRequest_Internal> logic)
        {
            if (logic == null)
            {
                return;
            }

            var internalObject = new C4DocPutRequest_Internal();

            internalObject.deletion         = Convert.ToByte(deletion);
            internalObject.hasAttachments   = Convert.ToByte(hasAttachments);
            internalObject.existingRevision = Convert.ToByte(existingRevision);
            internalObject.allowConflict    = Convert.ToByte(allowConflict);
            var length = history == null ? 0 : history.LongLength;

            internalObject.historyCount = (UIntPtr)length;
            internalObject.save         = Convert.ToByte(save);
            using (var body_ = new C4String(body))
                using (var docID_ = new C4String(docID)) {
                    internalObject.body  = body_.AsC4Slice();
                    internalObject.docID = docID_.AsC4Slice();
                    var c4StringArray = new C4String[length];
                    var nativeArray   = new C4Slice[length];
                    for (int i = 0; i < length; i++)
                    {
                        c4StringArray[i] = new C4String(history[i]);
                        nativeArray[i]   = c4StringArray[i].AsC4Slice();
                    }

                    fixed(C4Slice *history_ = nativeArray)
                    {
                        internalObject.history = history_;
                        try {
                            logic(internalObject);
                        } finally {
                            foreach (var c4str in c4StringArray)
                            {
                                c4str.Dispose();
                            }
                        }
                    }
                }
        }
Example #4
0
 private bool Equals(C4Slice other)
 {
     return(Native.c4SliceEqual(this, other));
 }
Example #5
0
 private bool Equals(C4Slice other)
 {
     return(size == other.size && Native.memcmp(buf, other.buf, _size) == 0);
 }