Exemple #1
0
        /// <summary>
        /// Get a string representation of this InlineString.
        /// </summary>
        /// <param name="options">A set of options to control the string representation.</param>
        /// <returns>The string representation.</returns>
        public string ToString(InlineToString options)
        {
            var debug = options.HasFlag(InlineToString.ShowProp);
            var hide  = (InlineProperty)(options & InlineToString.HideMask);
            var b     = new StringBuilder();
            var prop  = InlineProperty.None;

            foreach (var rwp in _Contents)
            {
                if ((rwp.Property & hide) == 0)
                {
                    var s = rwp.Run.ToString(options);
                    if (debug && s.Length > 0 && prop != rwp.Property)
                    {
                        prop = rwp.Property;
                        b.Append("{" + prop + "}");
                    }
                    b.Append(s);
                }
            }
            return(b.ToString());
        }
Exemple #2
0
        /// <summary>
        /// Gets a string representation of this InlineTag.
        /// </summary>
        /// <param name="options">A set of options to control the string representation.</param>
        /// <returns>The string representation.</returns>
        /// <remarks>
        /// This method of <see cref="InlineTag"/> only cares <see cref="InlineToString.TagMask"/> flags.
        /// </remarks>
        public override string ToString(InlineToString options)
        {
            switch (options & InlineToString.TagMask)
            {
            case InlineToString.TagDebug:
                return(string.Format("{0}{1};{2}{3}", OPAR, Name, Id, CPAR));

            case InlineToString.TagHidden:
                return(string.Empty);

            case InlineToString.TagCode:
                return(Code ?? string.Empty);

            case InlineToString.TagNumber:
                return(Enclose(Number));

            case InlineToString.TagDisplay:
                return(Enclose(Display, Name));

            default:
                throw new ArgumentException("options");
            }
        }
Exemple #3
0
 /// <summary>
 /// Gets a string representation of this InlineElement.
 /// </summary>
 /// <param name="options">A set of options to control the string representation.</param>
 /// <returns>The string representation.</returns>
 public abstract string ToString(InlineToString options);
Exemple #4
0
 /// <summary>
 /// Gets a string representation of this InlineText.
 /// </summary>
 /// <param name="options">Not used in <see cref="InlineText.ToString(InlineToString)"/>.</param>
 /// <returns>The string representation.</returns>
 /// <remarks>
 /// This method always returns its <see cref="Text"/>, ignoring <paramref name="options"/>.
 /// </remarks>
 public override string ToString(InlineToString options)
 {
     return(Text);
 }