Example #1
0
        public string EncodeToString(Cori contextCori, CoralUsing usingDictionary)
        {
            StringBuilder builder = new StringBuilder();

            BuildString(builder, "", contextCori, usingDictionary);

            return(builder.ToString());
        }
Example #2
0
        public void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary)
        {
            Cori baseCori = contextCori;

            foreach (CoralItem item in _items)
            {
                if (item is CoralBaseDirective)
                {
                    baseCori = ((CoralBaseDirective)item).BaseValue;
                    item.BuildString(builder, pad, contextCori, usingDictionary);
                }
                else
                {
                    item.BuildString(builder, pad, baseCori, usingDictionary);
                }
            }
        }
Example #3
0
 public abstract void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary);
 /// <inheritdoc />
 public override void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary)
 {
     builder.Append(pad);
     if (contextCori != null)
     {
         builder.AppendFormat($"#base <{BaseValue.MakeRelative(contextCori)}>\n");
     }
     else
     {
         builder.AppendFormat($"#base <{BaseValue}>\n");
     }
 }
Example #5
0
        public override void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary)
        {
            builder.Append(pad);
            if (usingDictionary != null)
            {
                string t = usingDictionary.Abbreviate(RelationType.ToString());
                builder.Append(t);
            }
            else
            {
                builder.AppendFormat($"<{RelationType}>");
            }

            if (Target != null)
            {
                if (contextCori == null)
                {
                    builder.Append($" <{Target}>");
                }
                else
                {
                    builder.Append($" <{Target.MakeRelative(contextCori)}>");
                }
            }
            else if (Value != null)
            {
                builder.Append($" {Value}");
            }
            else if (TargetInt != null)
            {
                builder.Append($" ## {TargetInt} ##");
            }

            if (Body != null)
            {
                builder.Append(" [\n");
                Body.BuildString(builder, pad + "  ", contextCori, usingDictionary);
                builder.Append(pad);
                builder.Append("]");
            }

            builder.Append("\n");
        }
Example #6
0
 /// <inheritdoc />
 public override void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary)
 {
     builder.Append(pad);
     builder.Append(Uri);
     builder.Append("\n");
 }
Example #7
0
 /// <inheritdoc />
 public override void BuildString(StringBuilder builder, string pad, Cori contextCori, CoralUsing usingDictionary)
 {
     throw new System.NotImplementedException();
 }