Esempio n. 1
0
        public static Doc Remove(Doc doc, Guid editID, string key, DictItem before)
        {
            var id   = before.ID;
            var edit = new RemoveDictFieldEdit(editID, before, key);

            doc = doc.Apply(edit);
            return(doc);
        }
Esempio n. 2
0
        public static Doc Set(Doc doc, Guid editID, DictItem before, string key, Guid valueID)
        {
            var id   = before.ID;
            var edit = new SetDictFieldEdit(editID, before, key, valueID);

            doc = doc.Apply(edit);
            return(doc);
        }
Esempio n. 3
0
            internal RemoveDictFieldEdit(Guid editID, DictItem before, string key)
            {
                ID     = editID;
                Key    = key;
                Before = before;
                var dict = before.Value.Remove(key);

                After = new DictItem(ItemID, dict);
            }
Esempio n. 4
0
            internal SetDictFieldEdit(Guid editID, DictItem before, string key, Guid valueID)
            {
                ID      = editID;
                Key     = key;
                ValueID = valueID;
                Before  = before;
                var dict = before.Value.SetItem(key, valueID);

                After = new DictItem(ItemID, dict);
            }
Esempio n. 5
0
        public Doc DeepClone(Doc doc, out IItem clone, Dictionary <Guid, IItem>?clones = null)
        {
            clones = clones ?? new Dictionary <Guid, IItem> {
            };
            if (clones.ContainsKey(ID))
            {
                clone = clones[ID];
                return(doc);
            }
            doc = Create(doc, out var dictID);
            var dictClone = (DictItem)doc[dictID];

            clone = dictClone;
            foreach (var key in Value.Keys)
            {
                var valueID = Value[key];
                var value   = doc[valueID];
                doc = value.DeepClone(doc, out var valueClone, clones);
                doc = DictItem.Set(doc, dictClone, key, valueClone.ID);
            }
            return(doc);
        }
Esempio n. 6
0
 public static Doc Remove(Doc doc, string key, DictItem before)
 {
     doc = doc.NewID(out var editID);
     return(Remove(doc, editID, key, before));
 }
Esempio n. 7
0
 public static Doc Set(Doc doc, DictItem before, string key, Guid valueID)
 {
     doc = doc.NewID(out var editID);
     return(Set(doc, editID, before, key, valueID));
 }
Esempio n. 8
0
 public CreateDictEdit(Guid editID, Guid dictID)
 {
     ID          = editID;
     NewDictItem = new DictItem(dictID);
 }