예제 #1
0
 bool WriteHorizontalDic(ref int idx, int maxkey)
 {
     if (maxkey > HorizontalThresh)
     {
         return(false);
     }
     return(WriteHorizontalCollection(ref idx, "{", "}", n => {
         string key = HorizontalDicWriter.Escape(n.Key.ToString()) + ": ";
         Write(0, key);
         return HorizontalDicWriter.WriteLeaf(n, HorizontalThresh);
     }));
 }
예제 #2
0
        int WriteValue(int idx)
        {
            var n = List[idx];

            if (VertWriter.WriteLeaf(n))
            {
                WriteAnnotation(idx, n);
                WriteLine(n.Depth, "");
                ++idx;
            }
            else
            {
                if (n.Ref != -1)
                {
                    Write(n.Depth, "*id{0}", n.Ref);
                    WriteAnnotation(idx, n);
                    WriteLine(n.Depth, "");
                    ++idx;
                }
                else
                {
                    if ((n.Flags & YNode.Flag.ReferredTo) != 0)
                    {
                        Write(n.Depth, "&id{0}", idx);
                        WriteAnnotation(idx, n);
                        WriteLine(n.Depth, "");
                    }
                    else
                    {
                        if (WriteAnnotation(idx, n))
                        {
                            WriteLine(n.Depth, "");
                        }
                    }
                    idx = WriteChildren(idx, idx != 0 && n.Key != null);
                }
            }
            return(idx);
        }
예제 #3
0
 bool WriteHorizontalArray(ref int idx)
 {
     return(WriteHorizontalCollection(ref idx, "[", "]", n =>
                                      HorizontalArrWriter.WriteLeaf(n, HorizontalThresh)));
 }