Пример #1
0
 public YAMLWriter(TextWriter tw, int initialdepth, int horizontalthresh, IDictionary <Type, bool> bbd)
 {
     Depth            = new string(' ', initialdepth);
     HorizontalThresh = horizontalthresh;
     Lw                  = new LineWriter(tw, 0);
     BBD                 = bbd;
     VertWriter          = new LeafWriter(this, VertNeedsQuotes, s => LineBreak.IsMatch(s));
     HorizontalArrWriter = new LeafWriter(this, HArrNeedsQuotes, s => false);
     HorizontalDicWriter = new LeafWriter(this, HDicNeedsQuotes, s => false);
 }
Пример #2
0
        int GetMaxKey(LeafWriter lw, int idx, int childdepth)
        {
            int m = 0;

            do
            {
                var r = List[idx];
                if (r.Depth == childdepth)
                {
                    if (r.Key != null)
                    {
                        int l = lw.Escape(r.Key.ToString()).Length;
                        if (m < l)
                        {
                            m = l;
                        }
                    }
                }
                ++idx;
            } while(idx != List.Count && List[idx].Depth >= childdepth);
            return(m > 20?20:m);
        }
Пример #3
0
 int GetMaxKey(LeafWriter lw,int idx,int childdepth) {
     int m=0;
     do {
         var r=List[idx];
         if(r.Depth==childdepth) {
             if(r.Key!=null) {
                 int l=lw.Escape(r.Key.ToString()).Length;
                 if(m<l) m=l;
             }
         }
         ++idx;
     } while(idx!=List.Count && List[idx].Depth>=childdepth);
     return m>20?20:m;
 }
Пример #4
0
 public YAMLWriter(TextWriter tw,int initialdepth,int horizontalthresh,IDictionary<Type,bool> bbd) {
     Depth=new string(' ',initialdepth);
     HorizontalThresh=horizontalthresh;
     Lw=new LineWriter(tw,0);
     BBD=bbd;
     VertWriter=new LeafWriter(this,VertNeedsQuotes,s=>LineBreak.IsMatch(s));
     HorizontalArrWriter=new LeafWriter(this,HArrNeedsQuotes,s=>false);
     HorizontalDicWriter=new LeafWriter(this,HDicNeedsQuotes,s=>false);
 }